[Bug 22286] New: GetShortPathName -> GetLongPathName doesn't give back same file
http://bugs.winehq.org/show_bug.cgi?id=22286 Summary: GetShortPathName -> GetLongPathName doesn't give back same file Product: Wine Version: unspecified Platform: x86 URL: http://cmake.org OS/Version: Linux Status: NEW Severity: normal Priority: P2 Component: kernel32 AssignedTo: wine-bugs(a)winehq.org ReportedBy: cjstimpson(a)utwire.net Some people are using a cmake/mingw/msys/wine combination on Linux to compile/test code targeting Windows, and its currently being discussed on the cmake user's list. CMake uses a GetShortPathName() / GetLongPathName() trick to get the actual case for a filename. If the a directory contains these two files (from a CMake installation, but can be empty files), CMakeFortranInformation.cmake CMakeTestCXXCompiler.cmake and GetShortPathName()/GetLongPathName() is called for CMakeTestCXXCompiler.cmake, it returns the other file instead. ====== #include <windows.h> #include <stdio.h> int main(int argc, char** argv) { if(argc < 2) { printf("Usage: %s filename\n", argv[0]); return 1; } char buffer[MAX_PATH+1]; char buffer2[MAX_PATH+1]; GetShortPathName(argv[1], buffer, MAX_PATH+1); GetLongPathNameA(buffer, buffer2, MAX_PATH+1); printf("%s\n", buffer2); return 0; } -- Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email Do not reply to this email, post in Bugzilla using the above URL to reply. ------- You are receiving this mail because: ------- You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=22286 --- Comment #1 from Clinton Stimpson <cjstimpson(a)utwire.net> 2010-04-05 18:42:35 --- And the output I get when calling the program is this: $ ./a.out CMakeTestCXXCompiler.cmake CMakeFortranInformation.cmake -- Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email Do not reply to this email, post in Bugzilla using the above URL to reply. ------- You are receiving this mail because: ------- You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=22286 --- Comment #2 from Dmitry Timoshkov <dmitry(a)codeweavers.com> 2010-04-05 22:35:50 --- Wine version? Please add a test case to the Wine test suite and send it to wine-patches. -- Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email Do not reply to this email, post in Bugzilla using the above URL to reply. ------- You are receiving this mail because: ------- You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=22286 --- Comment #3 from Jeff Zaroyko <jeffz(a)jeffz.name> 2010-04-05 23:01:36 --- I can't reproduce this with your testcase under wine 1.1.42. jeffz(a)genera:/tmp/foo$ touch CMakeFortranInformation.cmake jeffz(a)genera:/tmp/foo$ touch CMakeTestCXXCompiler.cmake jeffz(a)genera:/tmp/foo$ ~/git/wine/wine ../name.exe CMakeTestCXXCompiler.cmake CMakeTestCXXCompiler.cmake -- Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email Do not reply to this email, post in Bugzilla using the above URL to reply. ------- You are receiving this mail because: ------- You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=22286 Austin English <austinenglish(a)gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |download, source, testcase -- Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email Do not reply to this email, post in Bugzilla using the above URL to reply. ------- You are receiving this mail because: ------- You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=22286 --- Comment #4 from Alexandre Julliard <julliard(a)winehq.org> 2010-04-06 03:19:23 --- That's a hash collision, the two names will hash to the same short name. I guess you are just unlucky... If you need reliable short names you have to use a vfat filesystem. -- Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email Do not reply to this email, post in Bugzilla using the above URL to reply. ------- You are receiving this mail because: ------- You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=22286 --- Comment #5 from Dmitry Timoshkov <dmitry(a)codeweavers.com> 2010-04-06 08:59:16 --- (In reply to comment #4)
That's a hash collision, the two names will hash to the same short name. I guess you are just unlucky... If you need reliable short names you have to use a vfat filesystem.
Is this basically a wontfix? -- Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email Do not reply to this email, post in Bugzilla using the above URL to reply. ------- You are receiving this mail because: ------- You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=22286 --- Comment #6 from Clinton Stimpson <cjstimpson(a)utwire.net> 2010-04-06 09:01:20 --- I'm using git from a few days ago. Is there another possible fix besides telling people to use vfat instead of ext3? Did you test on vfat? -- Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email Do not reply to this email, post in Bugzilla using the above URL to reply. ------- You are receiving this mail because: ------- You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=22286 John M. Drescher <drescherjm(a)gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |drescherjm(a)gmail.com --- Comment #7 from John M. Drescher <drescherjm(a)gmail.com> 2010-04-06 09:08:57 ---
That's a hash collision, the two names will hash to the same short name. I guess you are just unlucky... If you need reliable short names you have to use a vfat filesystem.
Is this basically a wontfix?
I think it will not be easy to fix. A hash algorithm will have collisions. The native windows system gets around this problem by retaining the short file name in the filesystem. I wonder how samba solves this? -- Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email Do not reply to this email, post in Bugzilla using the above URL to reply. ------- You are receiving this mail because: ------- You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=22286 Alexandre Julliard <julliard(a)winehq.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |WONTFIX --- Comment #8 from Alexandre Julliard <julliard(a)winehq.org> 2010-04-06 09:33:17 --- Yeah it's basically a wontfix. A correct solution would require storing short names on disk, that would be very complex and not worth the trouble. Short names need to die. -- Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email Do not reply to this email, post in Bugzilla using the above URL to reply. ------- You are receiving this mail because: ------- You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=22286 Dmitry Timoshkov <dmitry(a)codeweavers.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED --- Comment #9 from Dmitry Timoshkov <dmitry(a)codeweavers.com> 2010-04-06 09:58:40 --- Closing wontfix. -- Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email Do not reply to this email, post in Bugzilla using the above URL to reply. ------- You are receiving this mail because: ------- You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=22286 --- Comment #10 from Juan Lang <juan_lang(a)yahoo.com> 2010-04-06 11:22:24 --- (In reply to comment #7)
I wonder how samba solves this?
They don't, AFAIK. There isn't an API to convert one style of name to another. -- Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email Do not reply to this email, post in Bugzilla using the above URL to reply. ------- You are receiving this mail because: ------- You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=22286 --- Comment #11 from Juan Lang <juan_lang(a)yahoo.com> 2010-04-06 11:23:22 --- (In reply to comment #10)
They don't, AFAIK. There isn't an API to convert one style of name to another.
Er, obviously there's a Win32 API to do so. I mean, there isn't an SMB API to do so. -- Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email Do not reply to this email, post in Bugzilla using the above URL to reply. ------- You are receiving this mail because: ------- You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=22286 --- Comment #12 from John M. Drescher <drescherjm(a)gmail.com> 2010-04-06 11:38:19 --- I just tried the example from the first post from a samba share under windows using the same cmake files and it worked as expected for the samba share. [u:\]c:TestSambaShortFileNames.exe U:\jdrescher\TestSambaShort\CMakeTestFortranCompiler.cmake U:\jdrescher\TestSambaShort\CMakeTestFortranCompiler.cmake [u:\]c:TestSambaShortFileNames.exe U:\jdrescher\TestSambaShort\CMakeTestCXXCompiler.cmake U:\jdrescher\TestSambaShort\CMakeTestCXXCompiler.cmake [u:\]c:TestSambaShortFileNames.exe U:\jdrescher\TestSambaShort\CMakeTestForFreeVC.cxx U:\jdrescher\TestSambaShort\CMakeTestForFreeVC.cxx It looks like samba is doing the correct thing. However they may be storing the short filenames somewhere or I may just be lucky not to hit the hash collision. -- Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email Do not reply to this email, post in Bugzilla using the above URL to reply. ------- You are receiving this mail because: ------- You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=22286 --- Comment #13 from John M. Drescher <drescherjm(a)gmail.com> 2010-04-06 11:39:59 --- Here is a better example. Showing the case change. [u:\]c:TestSambaShortFileNames.exe U:\jdrescher\TestSambaShort\CMaketestForFreeVC.cxx U:\jdrescher\TestSambaShort\CMakeTestForFreeVC.cxx [u:\]c:TestSambaShortFileNames.exe U:\jdrescher\TestSambaShort\CMaketestCXXCompiler.cmake U:\jdrescher\TestSambaShort\CMakeTestCXXCompiler.cmake [u:\]c:TestSambaShortFileNames.exe U:\jdrescher\TestSambaShort\CMaketestFortranCompiler.cmake U:\jdrescher\TestSambaShort\CMakeTestFortranCompiler.cmake -- Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email Do not reply to this email, post in Bugzilla using the above URL to reply. ------- You are receiving this mail because: ------- You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=22286 --- Comment #14 from Juan Lang <juan_lang(a)yahoo.com> 2010-04-06 12:34:54 --- (In reply to comment #12)
It looks like samba is doing the correct thing. However they may be storing the short filenames somewhere or I may just be lucky not to hit the hash collision.
They are not storing the short filenames anywhere permanent. Samba does keep a cache of the last 50 (by default) name manglings on a share. You also may be getting lucky. Like Jeff, the app doesn't produce a failure under Wine for me, either. -- Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email Do not reply to this email, post in Bugzilla using the above URL to reply. ------- You are receiving this mail because: ------- You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=22286 --- Comment #15 from John M. Drescher <drescherjm(a)gmail.com> 2010-04-06 12:44:11 --- We should probably take any further discussion to mailing list(s) since it's closed/wontfix. -- Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email Do not reply to this email, post in Bugzilla using the above URL to reply. ------- You are receiving this mail because: ------- You are watching all bug changes.
participants (1)
-
wine-bugs@winehq.org