Bug #42216 mysqltest: Use of diff belonging to current OS, with wrong option for Solaris
Submitted: 20 Jan 2009 13:07 Modified: 30 Jan 2009 18:10
Reporter: Matthias Leich Email Updates:
Status: Closed Impact on me:
None 
Category:Tools: MTR / mysql-test-run Severity:S7 (Test Cases)
Version:5.0,5.1,6.0 OS:Solaris
Assigned to: Bjørn Munch CPU Architecture:Any

[20 Jan 2009 13:07] Matthias Leich
Description:
mysqltest uses an option which does not exist for
"diff" on Solaris.

Details:
Regression tests on SunOS sol10-amd64-a 5.10
Generic_137112-08 i86pc i386 i86pc
...
main.wait_timeout_func         [ fail ]

diff: illegal option -- v
usage: diff [-bitw] [-c | -e | -f | -h | -n | -u] file1 file2
       diff [-bitw] [-C number | -U number] file1 file2
       diff [-bitw] [-D string] file1 file2
       diff [-bitw] [-c | -e | -f | -h | -n | -u] [-l] [-r] [-s] [-S name] directory1 directory2

mysql-5.0-bugteam-clean/client/mysqltest.c:
...
/*
  Test if diff is present.  This is needed on Windows systems
  as the OS returns 1 whether diff is successful or if it is
  not present.

  We run diff -v and look for output in stdout.
  We don't redirect stderr to stdout to make for a simplified check
  Windows will output '"diff"' is not recognized... to stderr if it is
  not present.
*/

int diff_check()
{
 char buf[512]= {0};
 FILE *res_file;
 const char *cmd = "diff -v";
 int have_diff = 0;

  if (!(res_file= popen(cmd, "r")))
    die("popen(\"%s\", \"r\") failed", cmd);

/* if diff is not present, nothing will be in stdout to increment have_diff */
  if (fgets(buf, sizeof(buf), res_file))
  {
    have_diff += 1;
  }
 pclose(res_file);
 return have_diff;
}
....

I assume the problem exists also in older MySQL versions.

How to repeat:
Please have a look into  client/mysqltest.c.

Suggested fix:
Either
- use the appropriate option for "diff" when running
  on Solaris
or
- implement a diff function within mysqltest
  Maybe lib/mtr_diff.pl or at least its concept
  could be reused.
[26 Jan 2009 17:23] Sergey Petrunya
Hi!

Please give this more priority as this problem makes it practically impossible to use Pushbuild2.
[27 Jan 2009 14:15] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/64143

2732 Bjorn Munch	2009-01-27
      Bug #42216 mysqltest: Use of diff belonging to current OS, with wrong option for Solaris
      Call the check_diff() only if Windows, also fixed wrong flag if diff failed
[28 Jan 2009 13:17] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/64288

2732 Bjorn Munch	2009-01-28
      Bug #42216 mysqltest: Use of diff belonging to current OS, with wrong option for Solaris
      Check for existence of diff fails on Solaris due to unsupported "-v"
      Fix is to do this check only on Windows where it was needed
[28 Jan 2009 16:28] Bjørn Munch
Pushed to (5.0|5.1|6.0)-build
[29 Jan 2009 21:53] Bugs System
Pushed into 5.0.78 (revid:joerg@mysql.com-20090129214352-b1hmbf67of4a0jrt) (version source revid:bjorn.munch@sun.com-20090128134422-brh7edfv7w9juyi7) (merge vers: 5.0.77) (pib:6)
[30 Jan 2009 18:10] Paul DuBois
Test suite changes. No changelog entry needed.
[3 Feb 2009 9:40] Bugs System
Pushed into 5.1.32 (revid:joro@sun.com-20090203090549-gos3v4320vimrzg6) (version source revid:joro@sun.com-20090130135702-rzak7gxhy2m247a5) (merge vers: 5.1.32) (pib:6)
[4 Feb 2009 11:16] Bugs System
Pushed into 6.0.10-alpha (revid:kostja@sun.com-20090204104420-mw1i2u9lum4bxjo6) (version source revid:joro@sun.com-20090131155335-nimzjjodg8kctjcw) (merge vers: 6.0.10-alpha) (pib:6)
[17 Feb 2009 14:56] Bugs System
Pushed into 5.1.32-ndb-6.3.23 (revid:tomas.ulin@sun.com-20090217131017-6u8qz1edkjfiobef) (version source revid:tomas.ulin@sun.com-20090203133556-9rclp06ol19bmzs4) (merge vers: 5.1.32-ndb-6.3.22) (pib:6)
[17 Feb 2009 16:44] Bugs System
Pushed into 5.1.32-ndb-6.4.3 (revid:tomas.ulin@sun.com-20090217134419-5ha6xg4dpedrbmau) (version source revid:tomas.ulin@sun.com-20090203133556-9rclp06ol19bmzs4) (merge vers: 5.1.32-ndb-6.3.22) (pib:6)
[17 Feb 2009 18:20] Bugs System
Pushed into 5.1.32-ndb-6.2.17 (revid:tomas.ulin@sun.com-20090217134216-5699eq74ws4oxa0j) (version source revid:tomas.ulin@sun.com-20090202111723-1zzwax187rtls913) (merge vers: 5.1.32-ndb-6.2.17) (pib:6)