http://bugs.winehq.org/show_bug.cgi?id=26888
Summary: Wine limits file names to 255 bytes even on NTFS Product: Wine Version: unspecified Platform: x86 OS/Version: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: -unknown AssignedTo: wine-bugs@winehq.org ReportedBy: jjudin+wine@iki.fi
Wine limits file names to 255 bytes even when underlying file system permits longer file names (like NTFS) when creating a file. This is an issue with programs that can create file names that are something like 140 characters but if one character takes 2 or 3 bytes, this 255 byte filename limit will be evident when same files that can be created in Windows can't be created with Wine. NTFS supports 255 UTF-16 code units that can easily result in longer file names than 255 bytes, especially for users of Japanese systems.
You can test this by creating a NTFS file system and some files with long names on it:
truncate -s 2g /tmp/ntfsfs losetup /dev/loop7 /tmp/ntfsfs mkfs.ntfs -f /dev/loop7 mkdir /tmp/ntfsfs-mnt mount -t ntfs-3g /dev/loop7 /tmp/ntfsfs-mnt # Do this or whatever enables regular user to access this file system. chmod 777 /tmp/ntfsfs-mnt
Then you can try to create long files outside of Wine:
# 257 UTF-8 bytes, 129 characters echo foo > /tmp/ntfsfs-mnt/ääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääa # 325 UTF-8 bytes, 109 characters echo foo > /tmp/ntfsfs-mnt/亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜a
And inside Wine:
wine cmd
# 257 UTF-8 bytes, 129 characters echo foo > /tmp/ntfsfs-mnt/ääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääb # 325 UTF-8 bytes, 109 characters echo foo > /tmp/ntfsfs-mnt/亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜亜b
Remember to have UTF-8 support enabled in your system.
http://bugs.winehq.org/show_bug.cgi?id=26888
--- Comment #1 from Dmitry Timoshkov dmitry@codeweavers.com 2011-04-22 23:45:35 CDT --- Wine version? Do you have an application that is affected by this or this is a pure speculation?
http://bugs.winehq.org/show_bug.cgi?id=26888
Jerome Leclanche adys.wh@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |adys.wh@gmail.com
http://bugs.winehq.org/show_bug.cgi?id=26888
--- Comment #2 from Jussi Judin jjudin+wine@iki.fi 2011-04-23 04:25:49 CDT --- (In reply to comment #1)
Wine version? Do you have an application that is affected by this or this is a pure speculation?
This affects any application that tries to create files which is why I used cmd here as an example. You can try this by using any of those file names I have given here as an example that they indeed can be created in Windows and in bash or by using touch (on a NTFS file system) but inside Wine this is not possible. I have explicitly verified this in Windows 2008 Server R2 with Notepad++ and trying the same with Wine 1.3.18.
This problem can happen in cases where you have existing files with longish names (they are not that long when you use characters that take 2 or 3 bytes per character, especially with some East Asian based languages, like Japanese) and you can't explicitly choose a file name that the program tries to save with (like with many programs that are used to share files). Also when program appends some string besides the original file name to create a temporary file (like Firefox with its downloads and originalname.part file names) it can result in overly long file names.
If you are using these files on any Linux file systems, you are out of luck but if you know about the problem, you should be able to create a NTFS file system to go around this. Or HFS+ on Mac.
And I wouldn't have reported this bug if I hadn't encountered this bug myself and it hadn't forced me to painfully use Windows to go around this problem =)
http://bugs.winehq.org/show_bug.cgi?id=26888
Dmitry Timoshkov dmitry@codeweavers.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Version|unspecified |1.3.18 Severity|normal |minor
--- Comment #3 from Dmitry Timoshkov dmitry@codeweavers.com 2011-04-23 06:33:37 CDT --- Neither Wine nor NTFS internally store file names in multibyte encodings, so you probably got misguided somewhere.
http://bugs.winehq.org/show_bug.cgi?id=26888
--- Comment #4 from Jussi Judin jjudin+wine@iki.fi 2011-04-23 09:01:28 CDT --- (In reply to comment #3)
Neither Wine nor NTFS internally store file names in multibyte encodings, so you probably got misguided somewhere.
Wine doesn't clearly take multibyte characters into account but imposes a limit that clearly comes from the file name length in bytes, not in something that is imposed by file system. But claiming that NTFS doesn't take multibyte encodings into account is completely wrong as Wikipedia (https://secure.wikimedia.org/wikipedia/en/wiki/NTFS) states that NTFS limits its file length to 255 UTF-16 code units, 1 code unit is 2 bytes => 510 bytes (some of the 1 code unit characters can result in 3 byte strings with UTF-8 encoding). This usually results 255 character limit but if you use characters that don't fit into basic multilingual plane, like
http://bugs.winehq.org/show_bug.cgi?id=26888
--- Comment #5 from Jussi Judin jjudin+wine@iki.fi 2011-04-23 09:03:23 CDT --- Let's try this without that one character that breaks bugzilla:
(In reply to comment #3)
Neither Wine nor NTFS internally store file names in multibyte encodings, so you probably got misguided somewhere.
Wine doesn't clearly take multibyte characters into account but imposes a limit that clearly comes from the file name length in bytes, not in something that is imposed by file system. But claiming that NTFS doesn't take multibyte encodings into account is completely wrong as Wikipedia (https://secure.wikimedia.org/wikipedia/en/wiki/NTFS) states that NTFS limits its file length to 255 UTF-16 code units, 1 code unit is 2 bytes => 510 bytes (some of the 1 code unit characters can result in 3 byte strings with UTF-8 encoding). This usually results 255 character limit but if you use characters that don't fit into basic multilingual plane, like \U103A0, then you are limited to less characters as now one character takes 2 UTF-16 code units to encode.
You can test everything I have said to confirm yourself if you are doubtful with the commands I have given to create a NTFS files system, mount it with NTFS-3G and to create files from your favorite shell that will result in file names that are over 255 bytes when they are UTF-8 encoded but they still hold under 255 characters and therefore work. You can also run these commands inside Windows cmd (these characters will look like question marks but you can use explorer to confirm that the correct file has been created), any unix shell or inside Wine cmd and see that if executed on NTFS file system, Wine cmd will fail and other shells will succeed. Or use any other program that can create files and be run through Wine (like Notepad++).
http://bugs.winehq.org/show_bug.cgi?id=26888
--- Comment #6 from Dmitry Timoshkov dmitry@codeweavers.com 2011-04-23 10:22:23 CDT --- This all sounds very like a pure speculation and misunderstanding. Testing with cmd.exe doesn't count as a test case. Write it programmatically in win32, using appropriate file name prefixes.
What did you make to file this as a bug in the first place?
http://bugs.winehq.org/show_bug.cgi?id=26888
--- Comment #7 from Alexandre Julliard julliard@winehq.org 2011-04-23 10:54:57 CDT --- Dmitry, please stop, this is clearly a legitimate bug.
http://bugs.winehq.org/show_bug.cgi?id=26888
Ken Sharp kennybobs@o2.co.uk changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |download, source Status|UNCONFIRMED |NEW Ever Confirmed|0 |1
--- Comment #8 from Ken Sharp kennybobs@o2.co.uk 2011-04-25 19:37:41 CDT --- Confirming.
Unhandled exception: page fault on execute access to 0x00740078 in 32-bit code (0x00740078).
http://bugs.winehq.org/show_bug.cgi?id=26888
--- Comment #9 from Jussi Judin jjudin+wine@iki.fi 2011-05-01 13:55:58 CDT --- Created an attachment (id=34419) --> (http://bugs.winehq.org/attachment.cgi?id=34419) Program to create chosen length file names with single 3-byte UTF-8 character
Here's a small program to test creation of file names with multibyte characters in them. File names that have UTF-8 length over 255 won't work in Wine on NTFS file system even though they will work in Windows (tested in Windows 2000), as long as UTF-16 length is less than 256. File names that have their length in shorter than 256 UTF-8 bytes will be created successfully.
Here's the program output on Windows 2000:
C:>unicode-file-create 255 UTF-8 length: 765 UTF-16 length: 255 Great success Closed: 1
C:>unicode-file-create 256 UTF-8 length: 768 UTF-16 length: 256 Error: 123
C:>unicode-file-create 257 UTF-8 length: 771 UTF-16 length: 257 Error: 3
And with Wine 1.3.18:
jussi@jussiblet:/tmp/ntfsfs-mnt$ wine unicode-file-create.exe 85 UTF-8 length: 255 UTF-16 length: 85 Great success Closed: 1
jussi@jussiblet:/tmp/ntfsfs-mnt$ wine unicode-file-create.exe 86 UTF-8 length: 258 UTF-16 length: 86 Error: 2
jussi@jussiblet:/tmp/ntfsfs-mnt$ wine unicode-file-create.exe 87 UTF-8 length: 261 UTF-16 length: 87 Error: 2
And I did encounter this problem in real-world application usage that led me to investigate that what did that file creation failure message in logs with error code 2 meant. So this didn't come up just in some theoretical Wine's file creation limit testing.
http://bugs.winehq.org/show_bug.cgi?id=26888
--- Comment #10 from butraxz@gmail.com 2013-11-24 12:15:02 CST --- This ticket has not been updated for over 900 days. Development recommends to check the status on your bug every release or two and let to be known if the bug is still present. If not, mark it fixed. If you are no longer able to put effort to this ticket, you can abandon it.
Is this still an issue with 1.7.7 or higher ?
http://bugs.winehq.org/show_bug.cgi?id=26888
Simon swdevelop1981@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |swdevelop1981@gmail.com
http://bugs.winehq.org/show_bug.cgi?id=26888
Dr 4asm ignas2526@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |ignas2526@gmail.com
--- Comment #11 from Dr 4asm ignas2526@gmail.com --- Still an issue in 1.7.15. I've compiled and ran the program. On Windows XP, it works as OP described: works up to and including 255, fails after.
No matter how many characters filename has, 1, 85, 255, etc., on wine, it always fails with error 2, the ERROR_FILE_NOT_FOUND. The wine prefix is on the standard Mac OS X filesystem, Mac OS Extended (Journaled). I'm pretty sure, that it is not an issue with my filesystem, since creating file with many characters from the terminal works fine, and according to wikipedia, Mac OS Extended can have maximum filename of "255 characters (255 UTF-16 encoding units, normalized to Apple-modified variant of Unicode Normalization Format D)".
http://bugs.winehq.org/show_bug.cgi?id=26888
Ken Sharp imwellcushtymelike@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Attachment #34419|application/octet-stream |text/plain mime type| |
http://bugs.winehq.org/show_bug.cgi?id=26888
Ken Sharp imwellcushtymelike@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |testcase URL| |http://notepad-plus-plus.or | |g/download/
http://bugs.winehq.org/show_bug.cgi?id=26888
Brandon Corujo haku08879@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |haku08879@gmail.com
https://bugs.winehq.org/show_bug.cgi?id=26888
--- Comment #12 from Janne janne.kekkonen@gmail.com --- Created attachment 77356 --> https://bugs.winehq.org/attachment.cgi?id=77356 file creation testlog
Hello,
I tested this with Wine 9.00.
I created 4 files with lengths of: 50,75,255 and 257. Program shows that everything is OK and files are being created. After creations there are 3 files with lengths: 50,75 and 85. File with name length 85 is from last creation.
I tested also with Windows 10. In Windows 10, maximum filename length is 240. Longer than that there will be error 3.
Folder where above tests were done is Windows NTFS drive that was mounted to linux.
See attached log.
https://bugs.winehq.org/show_bug.cgi?id=26888
--- Comment #13 from Janne janne.kekkonen@gmail.com --- Created attachment 77360 --> https://bugs.winehq.org/attachment.cgi?id=77360 linux_file_creation_test
I tested to create files with long names with touch command. Seems that maximum filename length is 255 bytes. Used system Ubuntu: 24.04
Could it be that in this case this is not problem in wine?
See attached log for details.
https://bugs.winehq.org/show_bug.cgi?id=26888
Janne janne.kekkonen@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |janne.kekkonen@gmail.com
--- Comment #14 from Janne janne.kekkonen@gmail.com --- My previous comment can be ignored. Test was not done NTFS drive.