[9.12] TC damages long command line for long files

Bug reports will be moved here when the described bug has been fixed

Moderators: white, Hacker, petermad, Stefan2

Post Reply
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

[9.12] TC damages long command line for long files

Post by *MVV »

When you have some EM-command with long parameter line that contains %P placeholder, TC starts program with damaged command line (its middle part is cut) when path is relatively long (even if path is much shorter than MAX_PATH).

Test command:
[em_usercmd1]
button=
cmd=%COMMANDER_PATH%\Addons\AskParam\AskParam64.exe
param=/c"Source Encoding" /u"Cyrillic (windows-1251): 1251" /t"System Default Encoding: 65536" /t"Unicode (UTF-16LE): 65537" /t"Unicode (UTF-16BE): 65538" /t"Unicode (UTF-8): 65001" /t"Unicode (UTF-7): 65000" /t"Binary (ASCII View): 65539" /t"Binary (Hexadecimal View): 65540" /t"Cyrillic (cp866): 866" /t"Cyrillic (iso-8859-5): 28595" /t"Cyrillic (koi8-r): 20866" /t"Cyrillic (koi8-ru): 21866" /t"Detects all encodings: 1048576" /t"Detects Unicode signature (BOM): 131072" /t"Detects UTF-8: 262144" /t"Detects HTML/XML Charset: 524288" /p(h) /c"Target Encoding" /u"Cyrillic (windows-1251): 1251" /t"System Default Encoding: 65536" /t"Unicode (UTF-16LE): 65537" /t"Unicode (UTF-16BE): 65538" /t"Unicode (UTF-8): 65001" /t"Unicode (UTF-7): 65000" /p(h) /cBOM /u"With Unicode signature (BOM): +" /t"Without Unicode signature (BOM): -" /p(h) D:\MASM32\projects\cmdline.exe "D:\Program Files\EmEditor\EmEditor.exe" "%P%O.%E" /nr /sp /cp %%1 /cps %%2 /ss%%3 /sa "%P%O.%%2"
Program command lines for different path lengths:

1. File "D:\Temp\Test folder name with spaces\z":
"D:\TOTALCMD\Addons\AskParam\AskParam64.exe" /cSource Encoding " /uCyrillic (windows-1251): 1251 " /tSystem Default Encoding: 65536 " /tUnicode (UTF-16LE): 65537 " /tUnicode (UTF-16BE): 65538 " /tUnicode (UTF-8): 65001 " /tUnicode (UTF-7): 65000 " /tBinary (ASCII View): 65539 " /tBinary (Hexadecimal View): 65540 " /tCyrillic (cp866): 866 " /tCyrillic (iso-8859-5): 28595 " /tCyrillic (koi8-r): 20866 " /tCyrillic (koi8-ru): 21866 " /tDetects all encodings: 1048576 " /tDetects Unicode signature (BOM): 131072 " /tDetects UTF-8: 262144 " /tDetects HTML/XML Charset: 524288 " /p(h /c"Target Encoding" /u"Cyrillic (windows-1251): 1251" /t"System Default Encoding: 65536" /t"Unicode (UTF-16LE): 65537" /t"Unicode (UTF-16BE): 65538" /t"Unicode (UTF-8): 65001" /t"Unicode (UTF-7): 65000" /p(h) /cBOM /u"With Unicode signature (BOM): +" /t"Without Unicode signature (BOM): -" /p(h) D:\MASM32\projects\cmdline.exe "D:\Program Files\EmEditor\EmEditor.exe" "D:\Temp\Test folder name with spaces\z." /nr /sp /cp %1 /cps %2 /ss%3 /sa "D:\Temp\Test folder name with spaces\z.%2"
2. File "D:\Temp\0123456789\Test folder name with spaces\z":
"D:\TOTALCMD\Addons\AskParam\AskParam64.exe" /cSource Encoding " /uCyrillic (windows-1251): 1251 " /tSystem Default Encoding: 65536 " /tUnicode (UTF-16LE): 65537 " /tUnicode (UTF-16BE): 65538 " /tUnicode (UTF-8): 65001 " /tUnicode (UTF-7): 65000 " /tBinary (ASCII View): 65539 " /tBinary (Hexadecimal View): 65540 " /tCyrillic (cp866): 866 " /tCyrillic (iso-8859-5): 28595 " /tCyrillic (koi8-r): 20866 " /tCyrillic (koi8-ru): 21866 " /tDetects all encodings: 1048576 " /tDetects Unicode signature (BOM): 131072 " /tDetects UTF-8: 262144 " /tDetects HTML/XML Charset: 524288 " /p(h /c"Target Encoding" /u"Cyrillic (windows-1251): 1251" /t"System Default Encoding: 65536" /t"Unicode (UTF-16LE): 65537" /t"Unicode (UTF-16BE): 65538" /t"Unicode (UTF-8): 65001" /t"Unicode (UTF-7): 65000" /p(h) /cBOM /u"With Unicode signature (BOM): +" /t"Without Unicode signature (BOM): -" /p(h) D:\MASM32\projects\cmdline.exe "D:\Program Files\EmEditor\EmEditor.exe" "D:\Temp\0123456789\Test folder name with spaces\z." /nr /sp /cp %1 /cps %2 /ss%3 /sa "D:\Temp\0123456789\Test folder .%2"

3. File "D:\Temp\0123456789\012345678901234567890123456789012345678901234567890123456789\Test folder name with spaces\z":
"D:\TOTALCMD\Addons\AskParam\AskParam64.exe" /cSource Encoding " /uCyrillic (windows-1251): 1251 " /tSystem Default Encoding: 65536 " /tUnicode (UTF-16LE): 65537 " /tUnicode (UTF-16BE): 65538 " /tUnicode (UTF-8): 65001 " /tUnicode (UTF-7): 65000 " /tBinary (ASCII View): 65539 " /tBinary (Hexadecimal View): 65540 " /tCyrillic (cp866): 866 " /tCyrillic (iso-8859-5): 28595 " /tCyrillic (koi8-r): 20866 " /tCyrillic (koi8-ru): 21866 " /tDetects all encodings: 1048576 " /tDetects Unicode signature (BOM): 131072 " /tDetects UTF-8: 262144 " /tDetects HTML/XML Charset: 524288 " /p(h /c"Target Encoding" /u"Cyrillic (windows-1251): 1251" /t"System Default Encoding: 65536" /t"Unicode (UTF-16LE): 65537" /t"Unicode (UTF-16BE): 65538" /t"Unicode (UTF-8): 65001" /t"Unicode (UTF-7): 65000" /p(h) /cBOM /u"With Unicode signature (BOM): +" /t"Without Unicode signature (BOM): -" /p(h) D:\MASM32\projects\cmdline.exe "D:\Program Files\EmEditor\EmEditor.exe" "D:\Temp\0123456789\012345678901234567890123456789012345678901234567890123456789\Test folder name with spaces\z." /nr .%2"

4. File "D:\Temp\0123456789\012345678901234567890123456789012345678901234567890123456789\012345678901234567890123456789012345678901234567890123456789\Test folder name with spaces\z":
"D:\TOTALCMD\Addons\AskParam\AskParam64.exe" /cSource Encoding " /uCyrillic (windows-1251): 1251 " /tSystem Default Encoding: 65536 " /tUnicode (UTF-16LE): 65537 " /tUnicode (UTF-16BE): 65538 " /tUnicode (UTF-8): 65001 " /tUnicode (UTF-7): 65000 " /tBinary (ASCII View): 65539 " /tBinary (Hexadecimal View): 65540 " /tCyrillic (cp866): 866 " /tCyrillic (iso-8859-5): 28595 " /tCyrillic (koi8-r): 20866 " /tCyrillic (koi8-ru): 21866 " /tDetects all encodings: 1048576 " /tDetects Unicode signature (BOM): 131072 " /tDetects UTF-8: 262144 " /tDetects HTML/XML Charset: 524288 " /p(h /c"Target Encoding" /u"Cyrillic (windows-1251): 1251" /t"System Default Encoding: 65536" /t"Unicode (UTF-16LE): 65537" /t"Unicode (UTF-16BE): 65538" /t"Unicode (UTF-8): 65001" /t"Unicode (UTF-7): 65000" /p(h) /cBOM /u"With Unicode signature (BOM): +" /t"Without Unicode signature (BOM): -" /p(h) D:\MASM32\projects\cmdline.exe "D:\Program Files\EmEditor\EmEditor.exe" "D:\Temp\0123456789\012345678901234567890123456789012345678901234567890123456789\0123456789012345678901234567890123456.%2"

5. File "D:\Temp\0123456789\012345678901234567890123456789012345678901234567890123456789\012345678901234567890123456789012345678901234567890123456789\012345678901234567890123456789012345678901234567890123456789\Test folder name with spaces\z":
"D:\TOTALCMD\Addons\AskParam\AskParam64.exe" /cSource Encoding " /uCyrillic (windows-1251): 1251 " /tSystem Default Encoding: 65536 " /tUnicode (UTF-16LE): 65537 " /tUnicode (UTF-16BE): 65538 " /tUnicode (UTF-8): 65001 " /tUnicode (UTF-7): 65000 " /tBinary (ASCII View): 65539 " /tBinary (Hexadecimal View): 65540 " /tCyrillic (cp866): 866 " /tCyrillic (iso-8859-5): 28595 " /tCyrillic (koi8-r): 20866 " /tCyrillic (koi8-ru): 21866 " /tDetects all encodings: 1048576 " /tDetects Unicode signature (BOM): 131072 " /tDetects UTF-8: 262144 " /tDetects HTML/XML Charset: 524288 " /p(h /c"Target Encoding" /u"Cyrillic (windows-1251): 1251" /t"System Default Encoding: 65536" /t"Unicode (UTF-16LE): 65537" /t"Unicode (UTF-16BE): 65538" /t"Unicode (UTF-8): 65001" /t"Unicode (UTF-7): 65000" /p(h) /cBOM /u"With Unicode signature (BOM): +" /t"Without Unicode signature (BOM): -" /p(h) D:\MASM32\projects\cmdline.exe "D:\Program Files\EmEditor\EmEditor.exe" "D:\Temp\0123456789\012345678901234567890123456789012345678901234567890123456789\0123456789012345678901234567890123456.%2"
I've noticed that overage length of damaged command lines is the same so it seems that it is caused by some buffer limitation in TC.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

This should be fixed in TC 9.20 beta 1, please test it!

It's a bug of the %O parameter only.
Author of Total Commander
https://www.ghisler.com
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

Fixed, thanks!
Post Reply