Bug #56657 Test still uses "--exec rm -f ..." which is non-portable
Submitted: 8 Sep 2010 14:53 Modified: 16 Nov 2010 2:00
Reporter: Joerg Bruehe Email Updates:
Status: Closed Impact on me:
None 
Category:Tests: Server Severity:S3 (Non-critical)
Version:5.5.6-rc OS:Windows
Assigned to: Mattias Jonsson CPU Architecture:Any

[8 Sep 2010 14:53] Joerg Bruehe
Description:
Found in the release build of 5.5.6-rc:

=====
parts.partition_alter3_innodb            [ retry-fail ]
        Test ended at YYYY-MM-DD HH:MM:SS

CURRENT_TEST: parts.partition_alter3_innodb
'rm' is not recognized as an internal or external command,
operable program or batch file.
'true' is not recognized as an internal or external command,
operable program or batch file.
mysqltest: In included file "./suite/parts/inc/partition_check_drop.inc": At line 69: command "rm -f $MYSQLD_DATADIR/test/t1* || true" failed

Output from before failure:
exec of 'rm -f /PATH/mysql-test/var/mysqld.1/data/test/t1* || true' failed, error: 1, status: 1, errno: 2

...
=====

Caused by these lines in mysql-test/suite/parts/inc/partition_check_drop.inc:
=====
    61     # Do a manual cleanup, because the following tests should not suffer from
    62     # remaining files
    63     --exec rm -f $MYSQLD_DATADIR/test/t1* || true
    64     if ($with_directories)
    65     {
    66             --exec rm -f $MYSQLTEST_VARDIR/tmp/t1* || true
    67     }
    68  }
    69  --enable_query_log
=====

How to repeat:
Run the test suite on Windows in a cmake build environment,
without Cygwin, Gnuwin32 or other non-native additions.

I know the code is old (2008), and I know it hasn't failed till now, but the consensus on IRC is this was just a by-product of the (build +) test running in a Cygwin environment till now.

By now, builds of 5.5.5 and up are run in a native Windows setup without a Cygwin layer, so it now shows up.
[8 Sep 2010 14:57] Bjørn Munch
The code may have been written like this because the mysqltest command remove_file does not take wild cards.

But now there's a command remove_files_wildcard which can do this.
[10 Sep 2010 0:39] Vladislav Vaintroub
there is more to this test case than just "rm".
there is also "true" and also "||" , a syntax than is unix shell specific, so this would not run even if both true.exe and rm.exe are there (unless maybe the whole suite is ran in bash.exe:)
[15 Sep 2010 8:24] 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/118277

3207 Mattias Jonsson	2010-09-15
      Bug#56659: Mismatch of CAPITAL vs small letters in "unified filelist" partitioning output
      Bug#56657: Test still uses "--exec rm -f ..." which is non-portable
      Bug#56601: Test uses Unix path for temporary file, fails, and writes misleading message
      
      Several tests that was written in a non portable way (failed on windows)
      
      Fixed by
      1) backporting the fix for replace_result to also apply to list_files
      (mysqltest from mysql-trunk)
      2) replacing all #p#/#sp#/#tmp# to #P#/#SP#/#TMP#/
      (innodb always converts filenames to lower case in windows).
      3) replacing '--exec rm -f' with '--remove_files_wildcard'
      4) replacing a perl snippet with '--write_file'
     @ client/mysqltest.cc
        backport from mysql-trunk to allow replace_result to apply
        also on list_files
     @ mysql-test/suite/parts/inc/partition_check_drop.inc
        Compensate for differences between innodb on windows vs unix.
        Using mysqltest command, instead of unix command to remove files.
     @ mysql-test/suite/parts/inc/partition_crash.inc
        compensate for differences between innodb on windows vs unix
     @ mysql-test/suite/parts/inc/partition_fail.inc
        compensate for differences between innodb on windows vs unix
     @ mysql-test/suite/parts/inc/partition_layout.inc
        compensate for differences between innodb on windows vs unix
     @ mysql-test/suite/parts/inc/partition_layout_check1.inc
        compensate for differences between innodb on windows vs unix
     @ mysql-test/suite/parts/inc/partition_layout_check2.inc
        compensate for differences between innodb on windows vs unix
     @ mysql-test/suite/parts/r/partition_recover_myisam.result
        updated result
     @ mysql-test/suite/parts/r/partition_special_myisam.result
        updated result
     @ mysql-test/suite/parts/t/part_supported_sql_func_innodb.test
        Test takes very long time, require --big flag
     @ mysql-test/suite/parts/t/partition_alter1_1_2_innodb.test
        Test takes very long time, require --big flag
     @ mysql-test/suite/parts/t/partition_alter1_2_innodb.test
        Test takes very long time, require --big flag
     @ mysql-test/suite/parts/t/partition_alter2_1_1_innodb.test
        Test takes very long time, require --big flag
     @ mysql-test/suite/parts/t/partition_alter2_1_2_innodb.test
        Test takes very long time, require --big flag
     @ mysql-test/suite/parts/t/partition_alter2_2_2_innodb.test
        Test takes very long time, require --big flag
     @ mysql-test/suite/parts/t/partition_alter4_innodb.test
        Test takes very long time, require --big flag
     @ mysql-test/suite/parts/t/partition_debug_sync_innodb.test
        compensate for differences between innodb on windows vs unix
     @ mysql-test/suite/parts/t/partition_recover_myisam.test
        more generic suppression (failed in windows)
     @ mysql-test/suite/parts/t/partition_special_myisam.test
        Using portable mysqltest command 'write_file' instead of perl snippet.
[21 Sep 2010 10:37] Joerg Bruehe
See review comment in bug#56601, it is all one big changeset.
[22 Sep 2010 14:19] John Embretsen
Patch conditionally approved. See review comment for Bug#56659 (changeset fixes multiple bugs).
[1 Oct 2010 19:51] Mattias Jonsson
Pushed into mysql-5.5-bugteam and mysql-trunk-merge
[3 Oct 2010 1:19] Paul DuBois
Changes to test suite. No changelog entry needed.
[9 Nov 2010 19:47] Bugs System
Pushed into mysql-5.5 5.5.7-rc (revid:sunanda.menon@sun.com-20101109182959-otkxq8vo2dcd13la) (version source revid:sunanda.menon@sun.com-20101109182959-otkxq8vo2dcd13la) (merge vers: 5.5.7-rc) (pib:21)
[13 Nov 2010 16:08] Bugs System
Pushed into mysql-trunk 5.6.99-m5 (revid:alexander.nozdrin@oracle.com-20101113155825-czmva9kg4n31anmu) (version source revid:alexander.nozdrin@oracle.com-20101113152450-2zzcm50e7i4j35v7) (merge vers: 5.6.1-m4) (pib:21)
[13 Nov 2010 16:38] Bugs System
Pushed into mysql-next-mr (revid:alexander.nozdrin@oracle.com-20101113160336-atmtmfb3mzm4pz4i) (version source revid:vasil.dimov@oracle.com-20100629074804-359l9m9gniauxr94) (pib:21)