https://bugs.winehq.org/show_bug.cgi?id=56381
Bug ID: 56381 Summary: "type" does not support binary files Product: Wine Version: 9.0 Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: cmd Assignee: wine-bugs@winehq.org Reporter: dan@coneharvesters.com Distribution: ---
"type" truncates binary files when redirecting the output to stdout. For example:
c:>type c:\windows\winhelp.exe >foo
c:>dir c:\windows\winhelp.exe foo Volume in drive c has no label. Volume Serial Number is 0000-0000
Directory of c:\windows
28/02/2022 5:32 PM 257 winhelp.exe 1 file 257 bytes 0 directories
Directory of c:
29/02/2024 1:21 PM 2 foo 1 file 2 bytes 0 directories 19,394,506,752 bytes free
The file is truncated after the second byte (byte 3 is NUL). Windows 10 and Windows XP copy the entire file in this case. However, Windows 95 truncates the file.
This is causing real-world compatibility issues, as the z88dk compiler suite inexplicably uses "type" to copy binary files like this on Windows.
http://bugs.winehq.org/show_bug.cgi?id=56381
JoeS jsouza@geocities.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |jsouza@geocities.com
--- Comment #1 from JoeS jsouza@geocities.com --- Just noting that the truncation occurs whether redirecting output or not. type c:\windows\winhelp.exe displays only the first two bytes of the file.
http://bugs.winehq.org/show_bug.cgi?id=56381
--- Comment #2 from JoeS jsouza@geocities.com --- The problem here is that Wine assumes that TYPE will be displaying text and attempts to convert the read text to Unicode. This text conversion stops at the NUL character because that is the end of the text file. Native Win10 TYPE command does not seem to handle Unicode and displays Unicode text as single-byte characters which appear to be gibberish, at least in U.S. page codes. To fix this, Wine's TYPE command would probably need to be rewritten to read and display the text as single-byte characters.
http://bugs.winehq.org/show_bug.cgi?id=56381
--- Comment #3 from JoeS jsouza@geocities.com --- Also note that I don't know how the TYPE command operates on Far East code pages which handle Unicode by default.
http://bugs.winehq.org/show_bug.cgi?id=56381
--- Comment #4 from JoeS jsouza@geocities.com --- I am working on a fix for this.