Bug #29248 MyISAMchk & MyISAMpack failing with * wildcard on Windows platform
Submitted: 20 Jun 2007 20:47 Modified: 12 May 2009 2:03
Reporter: Aaron Dow Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S3 (Non-critical)
Version:5.0.41 & 5.1.16 OS:Windows (XP & 2000)
Assigned to: Iggy Galarza CPU Architecture:Any
Tags: MyISAMchk, myisampack, regression, wildcard

[20 Jun 2007 20:47] Aaron Dow
Description:
When calling the myisamchk tool with a wildcard filename argument (e.g. *.MYI) the propram fails with the following message:

Myisamchk: Error: 22 when opening MyISAM-table '*.MYI'

However the MyISAMchk tool functions correctly if full filenames are used (i.e. no wildcards used). 

This behaviour occurs on MySQL Windows versions: 5.0.41 and 5.1.16.
This behaviour DOES NOT occur with MySQL Windows 5.0.22

MyISAMpack also exhibits the above behaviour

How to repeat:
Open a command window
Change to a sample database directory (e.g. "CD \DATABASE\MYSQL")
Call MyISAMchk with a * wildcard (e.g. "MyISAMCHK *.MYI")
Observe the error message.
[25 Jun 2007 14:51] MySQL Verification Team
Thank you for the bug report. It works on Linux:

[miguel@light db5]$ ../../bin/myisamchk *.MYI
Checking MyISAM file: tb1.MYI
Data records:       0   Deleted blocks:       0
- check file-size
- check record delete-chain
- check key delete-chain
- check index reference
- check data record references index: 1

---------

Checking MyISAM file: tb2.MYI
Data records:       0   Deleted blocks:       0
- check file-size
- check record delete-chain
- check key delete-chain
- check index reference
- check data record references index: 1

---------

Checking MyISAM file: tb3.MYI
Data records:       0   Deleted blocks:       0
- check file-size
- check record delete-chain
- check key delete-chain
- check index reference
- check data record references index: 1
[miguel@light db5]$
[27 Jun 2007 12:59] Sergei Golubchik
There's no bug here. myisamchk and myisampack accept a list of files, not a wildcard. If you use a wildcard on linux, for example, the shell will expand it and replace by a list of files. Windows default shell doesn't do it. If you'll use another shell on windows it may work.
[27 Jun 2007 19:51] Aaron Dow
If there is no bug, why does this behaviour not affect MySQL for Windows v5.0.22? Surely something has changed with the MySQL windows codebase that is causing this problem?
[27 Jun 2007 22:34] MySQL Verification Team
Sergei,
Below what reporter is saying when using 5.0.27 version:

c:\mysql-5.0.27-win32\bin>myisamchk db5\*.MYI
Checking MyISAM file: db5\tb1.MYI
Data records:       0   Deleted blocks:       0
- check file-size
- check record delete-chain
- check key delete-chain
- check index reference
- check data record references index: 1

---------

Checking MyISAM file: db5\tb2.MYI
Data records:       0   Deleted blocks:       0
- check file-size
- check record delete-chain
- check key delete-chain
- check index reference
- check data record references index: 1

c:\mysql-5.0.27-win32\bin>

The same test failed on the same computer >= 5.0.41 failed.
[28 Jun 2007 1:21] Jack Chan
HI 
  I get the same problem with myisamchk, i install the mysql-5.1.19-beta-win32.zip into D:\MySQL\MySQL Server 5.1

Problem 1, how do you pass the Folder Name with space, In my case my folder is "MySQL Server 5.1"
When i type myisamchk D:\mysql\mysql server 5.1\data\test\users.MYI
myisamchk: error: File 'D:\mysql\mysql' doesn't exist

---------

myisamchk: error: File 'server' doesn't exist

---------

myisamchk: error: File '5.1\data\test\users.MYI' doesn't exist

Then i move the database folder to D:\Mysql\
i use this command D:\MySQL\MySQL Server 5.1\bin>myisamchk D:\MySQL\test\*.MYI
myisamchk: error: 22 when opening MyISAM-table 'D:\MySQL\test\*.MYI'

It only work if i put
D:\MySQL\MySQL Server 5.1\bin>myisamchk D:\MySQL\test\users.MYI
Checking MyISAM file: D:\MySQL\test\users.MYI
Data records:      16   Deleted blocks:       1
- check file-size
- check record delete-chain
- check key delete-chain
- check index reference
- check data record references index: 1
- check data record references index: 2
- check data record references index: 3
- check record links
[1 Dec 2007 19:15] Guy Gordon
Sergei Golubchik wrote: "There's no bug here."

Don't tell people "There's no bug here." just because it works on your system and not theirs.  This bug report clearly states "OS: Microsoft Windows (XP & 2000)".  The documentation states you can use "myisamchk *.MYI".  You cannot.

This also fails on my Windows Server 2003 MySQL v5.0.45.

If the program operates on a list of files supplied by the shell then it should be documented that way.  Not dismissed.
[20 Dec 2007 18:57] Aaron Dow
If this IS a documentation bug can someone address my question from June?:

"If there is no bug, why does this behaviour NOT affect MySQL for Windows v5.0.22? Surely
something has changed with the MySQL windows codebase that is causing this problem?"
[20 Dec 2007 19:38] Sergei Golubchik
No, it's not documentation bug. At least not until we'll be able to answer you question from June. See the Category field of this budreport, it's not "Documentation"
[24 Jan 2008 18:45] Jim Winstead
This probably happened in the transition to using CMake for our builds, where we missed including setargv.obj (provided by MS) in the objects we link our command-line clients against.
[21 Mar 2008 8:39] Satish Varma
Hello all,

I am having the same problem with MysqlV5.0.23 on windows Xp
DO you have a Solution for this??

Please Advice....
---------------------------------------------------------------------------
E:\>cd E:\Mysql_Data\Mysql Server 5.1.23\bin

E:\Mysql_Data\Mysql Server 5.1.23\bin>myisamchk E:/Mysql_Data/data/*/*.MYI

myisamchk: error: 22 when opening MyISAM-table 'E:/Mysql_Data/data/*/*.MYI'

--------------------------------------------------------------------------

Thanks:
[3 Apr 2008 21:36] Dennis Troxell
I'm seeing the same issue on 5.0.42-enterprise-nt.  Wildcard dosen't work, using specific table name does.
[3 Apr 2008 21:47] Dennis Troxell
So whats the answer here?  Having to check individual tables one at a time is no good, especially when there are thousands of tables in the database that might need to be checked.  Any scripts out there that work around it?
[4 Apr 2008 10:40] Alan Fogarty
On windows you can use the following to pass the files to the myisamchk/myisampack

FOR %G IN (dir \b c:\mysql\data\mydb\*.myi) DO myisamchk -r -f %G
[10 Dec 2008 21:01] Iggy Galarza
=== modified file 'myisam/CMakeLists.txt'
--- myisam/CMakeLists.txt	2007-08-03 19:51:37 +0000
+++ myisam/CMakeLists.txt	2008-12-10 20:25:47 +0000
@@ -41,6 +41,8 @@
 ADD_EXECUTABLE(myisampack myisampack.c)
 TARGET_LINK_LIBRARIES(myisampack myisam mysys debug dbug strings zlib wsock32)
 
+SET_TARGET_PROPERTIES(myisamchk myisampack PROPERTIES LINK_FLAGS "setargv.obj")
+
 IF(EMBED_MANIFESTS)
   MYSQL_EMBED_MANIFEST("myisam_ftdump" "asInvoker")
   MYSQL_EMBED_MANIFEST("myisamchk" "asInvoker")
[4 Mar 2009 20:12] Kenneth Kolk
Has anyone resolved this issue on windows.  You physically have to name the file in order for this to work.
[31 Mar 2009 21:49] 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/70961

2720 Ignacio Galarza	2009-03-31
      Bug#29248 - MyISAMchk & MyISAMpack failing with * wildcard on Windows platform
      - Link against setargv.obj for wild-card expansion.
[31 Mar 2009 22:19] 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/70963

2841 Ignacio Galarza	2009-03-31 [merge]
      Bug#29248 MyISAMchk & MyISAMpack failing with * wildcard on Windows platform
[31 Mar 2009 22:26] 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/70964

3165 Ignacio Galarza	2009-03-31 [merge]
      Bug#29248 MyISAMchk & MyISAMpack failing with * wildcard on Windows platform
[1 Apr 2009 16:08] Iggy Galarza
Pushed changes to 5.0, 5.1, and 6.0 -bugteam trees.
[1 Apr 2009 16:23] 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/71102

2723 Ignacio Galarza	2009-04-01 [merge]
      Bug#29248 - MyISAMchk & MyISAMpack failing with * wildcard on Windows platform
      - Link against setargv.obj for wild-card expansion.
[1 Apr 2009 16:23] 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/71103

3169 Ignacio Galarza	2009-04-01 [merge]
      Bug#29248 - MyISAMchk & MyISAMpack failing with * wildcard on Windows platform
      - Link against setargv.obj for wild-card expansion.
[1 Apr 2009 16:25] 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/71107

2849 Ignacio Galarza	2009-04-01 [merge]
      Bug#29248 - MyISAMchk & MyISAMpack failing with * wildcard on Windows platform
      - Link against setargv.obj for wild-card expansion.
[3 Apr 2009 2:17] Peter Brawley
In 6.0.10 under Windows XP SP2, this bug remains alive and well. Running 

myisamchk --silent --force *.myi 

over a MySQL data folder still absurdly elicits errno:22. One has to use

for %f in (*.myi) do myisamchk --silent --force %f 

over each data folder!! (Note--NOT the cockeyed syntax suggested in an earlier message)

A server maintenance utility ought to be able to handle wildcards in the ways users of the supported OS expect, the problem oughtn't to have been declared a non-bug, and contrary to claims made on this page, it hasn't been fixed.
[3 Apr 2009 6:11] Sergei Golubchik
Peter, I don't know what you're complaining about. The bug is not closed, it's not declared a non-bug. On the contrary, it's fixed, and the fix is pushed, but the fix is not yet made into any of the releases. See the bug status.
[5 May 2009 18:53] Bugs System
Pushed into 5.0.82 (revid:davi.arnaut@sun.com-20090505184158-dvmedh8n472y8np5) (version source revid:davi.arnaut@sun.com-20090505184158-dvmedh8n472y8np5) (merge vers: 5.0.82) (pib:6)
[5 May 2009 19:42] Bugs System
Pushed into 5.1.35 (revid:davi.arnaut@sun.com-20090505190206-9xmh7dlc6kom8exp) (version source revid:davi.arnaut@sun.com-20090505190206-9xmh7dlc6kom8exp) (merge vers: 5.1.35) (pib:6)
[6 May 2009 14:10] Bugs System
Pushed into 6.0.12-alpha (revid:svoj@sun.com-20090506125450-yokcmvqf2g7jhujq) (version source revid:timothy.smith@sun.com-20090402053421-69bxipm08ri8rpnn) (merge vers: 6.0.11-alpha) (pib:6)
[12 May 2009 2:03] Paul DuBois
Noted in 5.0.82, 5.1.35, 6.0.12 changelogs.

myisamchk and myisampack were not being linked with the library that
enabled support for * filename pattern expansion.
[15 Jun 2009 8:29] Bugs System
Pushed into 5.1.35-ndb-6.3.26 (revid:jonas@mysql.com-20090615074202-0r5r2jmi83tww6sf) (version source revid:jonas@mysql.com-20090615070837-9pccutgc7repvb4d) (merge vers: 5.1.35-ndb-6.3.26) (pib:6)
[15 Jun 2009 9:08] Bugs System
Pushed into 5.1.35-ndb-7.0.7 (revid:jonas@mysql.com-20090615074335-9hcltksp5cu5fucn) (version source revid:jonas@mysql.com-20090615072714-rmfkvrbbipd9r32c) (merge vers: 5.1.35-ndb-7.0.7) (pib:6)
[15 Jun 2009 9:49] Bugs System
Pushed into 5.1.35-ndb-6.2.19 (revid:jonas@mysql.com-20090615061520-sq7ds4yw299ggugm) (version source revid:jonas@mysql.com-20090615054654-ebgpz7elwu1xj36j) (merge vers: 5.1.35-ndb-6.2.19) (pib:6)