TC 9.22a hangs

Please report only one bug per message!

Moderators: white, Hacker, petermad, Stefan2

billiebub
Member
Member
Posts: 187
Joined: 2011-04-12, 19:49 UTC

TC 9.22a hangs

Post by *billiebub »

TC 9.22a hangs when accessing a file that appears to have an invalid file size as detected by Windows. Follow the steps below to reproduce. Tested on Windows 7, 10.

First thing's first, download file i2c.tar.gz below:

https://www.dropbox.com/s/nesfyul37zyl3iq/i2c.tar.gz?dl=0

Steps to reproduce:

Take 1):

1- From TC, [Ctrl]-[Down] on file i2c.tar.gz
2- [Enter] on i2c.tar
3- [Enter] on i2c/
4- [F3] on aux.c. Agree to "Overwrite" if prompted by TC
5- TC hangs
6- Kill TC


Take 2):

1- Use tar to extract i2c.tar.gz to a folder. I used Cygwin and MSYS. Don't use 7zip.

Code: Select all

tar xfvz i2c.tar.gz
2- Go to extracted folder i2c/ in TC
3- [Alt]-[F7]-[Find text]. Search for "hello" in i2c/ folder. [Start search]
4- TC hangs on file aux.c
5- Kill TC
User avatar
Dalai
Power Member
Power Member
Posts: 9364
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Re: TC 9.22a hangs

Post by *Dalai »

TC doesn't provide any overwrite prompt for me whatsoever. I only get "Access denied on file <temp_path>\_tc\aux.c" with the only two options Skip and Cancel. WinRAR 5.x asks whether or not to overwrite (the non-existent temporary file) when trying to view aux.c, and if confirmed, it shows the file contents; but it shouldn't ask for confirmation in the first place. 7zip extracts aux.c as _aux.c. WinRAR 5.x and 7zip both extract the file just fine with its intended size of 2791 bytes.

So, something is odd with the archive, but it's not because of the file size but its name. And I don't think that it's TC's fault since other programs also struggle with it. I guess it's something about "AUX" because that's one of the reserved names like CON, NUL and so on.

Regards
Dalai
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
billiebub
Member
Member
Posts: 187
Joined: 2011-04-12, 19:49 UTC

Re: TC 9.22a hangs

Post by *billiebub »

It would be wise for TC to treat special named files in a different way. For example, 7zip will rename the file to "_aux.c" during extraction. Cygwin and MSYS are capable of viewing the "aux.c" file so TC should act the same rather than hang. My workaround so far is to make exclusions during search to exclude files "aux.c" and "aux.h" from search. You don't understand how annoying it can be when TC hangs on aux.c/aux.h during a lengthy search and I'm in the middle of an investigation and I end up killing TC and start all over again.
User avatar
Dalai
Power Member
Power Member
Posts: 9364
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Re: TC 9.22a hangs

Post by *Dalai »

billiebub wrote: 2019-06-13, 13:35 UTCYou don't understand how annoying it can be when TC hang [...]
Oh, believe me, I do! But I can't reproduce this, as I already said above.

Is anyone else able to make TC hang on such files?

Regards
Dalai
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
billiebub
Member
Member
Posts: 187
Joined: 2011-04-12, 19:49 UTC

Re: TC 9.22a hangs

Post by *billiebub »

Looking through file handles opened by TC in process explorer during the time when I press [F3] to view the file (or do file copy on aux.c), TC opens a handle to /Device/Serial1. AUX is Auxiliary device, usually a serial port. During a file copy using [F5], TC halts for a few seconds, closes handle to /Device/Serial1, then resumes execution without actually copying the aux.c file.
Last edited by billiebub on 2019-06-13, 16:56 UTC, edited 1 time in total.
User avatar
Horst.Epp
Power Member
Power Member
Posts: 6449
Joined: 2003-02-06, 17:36 UTC
Location: Germany

Re: TC 9.22a hangs

Post by *Horst.Epp »

There is no hang for me.
On the F3 step it just says Error writing some temp file.
Nothing hangs and I can continue work as usual.
Windows 11 Home x64 Version 23H2 (OS Build 22631.3374)
TC 11.03 x64 / x86
Everything 1.5.0.1371a (x64), Everything Toolbar 1.3.2, Listary Pro 6.3.0.69
QAP 11.6.3.2 x64
billiebub
Member
Member
Posts: 187
Joined: 2011-04-12, 19:49 UTC

Re: TC 9.22a hangs

Post by *billiebub »

I've added screenshots to show how TC opens file handle to /Device/Serial1, which is mapped for COM1 port on my system

/Device/Serial1 query
Image: https://imgur.com/v5Ummjl


TC opening /Device/Serial1 from process explorer:
Image: https://imgur.com/geeUrbe
User avatar
Usher
Power Member
Power Member
Posts: 1675
Joined: 2011-03-11, 10:11 UTC

Re: TC 9.22a hangs

Post by *Usher »

billiebub
Did you test only 32-bit TC on 64-bit Windows?
Andrzej P. Wozniak
Polish subforum moderator
User avatar
Horst.Epp
Power Member
Power Member
Posts: 6449
Joined: 2003-02-06, 17:36 UTC
Location: Germany

Re: TC 9.22a hangs

Post by *Horst.Epp »

Usher wrote: 2019-06-13, 18:08 UTC billiebub
Did you test only 32-bit TC on 64-bit Windows?
For me there is no hang on x86 and x64 TC on Windows 10 x64.
Windows 11 Home x64 Version 23H2 (OS Build 22631.3374)
TC 11.03 x64 / x86
Everything 1.5.0.1371a (x64), Everything Toolbar 1.3.2, Listary Pro 6.3.0.69
QAP 11.6.3.2 x64
billiebub
Member
Member
Posts: 187
Joined: 2011-04-12, 19:49 UTC

Re: TC 9.22a hangs

Post by *billiebub »

Both Windows 7 and 10 are 64-bit and I'm using 32-bit of TC 9.22a
User avatar
Horst.Epp
Power Member
Power Member
Posts: 6449
Joined: 2003-02-06, 17:36 UTC
Location: Germany

Re: TC 9.22a hangs

Post by *Horst.Epp »

billiebub wrote: 2019-06-13, 19:26 UTC Both Windows 7 and 10 are 64-bit and I'm using 32-bit of TC 9.22a
Even with a fresh ini-file I can't produce any hang regardless of the TC bitness.
Did you test with a fresh ini-file also ?
Windows 11 Home x64 Version 23H2 (OS Build 22631.3374)
TC 11.03 x64 / x86
Everything 1.5.0.1371a (x64), Everything Toolbar 1.3.2, Listary Pro 6.3.0.69
QAP 11.6.3.2 x64
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: TC 9.22a hangs

Post by *ghisler(Author) »

There are some reserved names like com1, aux, lpt1 which are used for devices, but they do not exist on all PCs. for example, most modern PCs no longer have a parallel port, so lpt1 is no longer reserved. And if a PC doesn't have a serial port either, com1 and aux will not be reserved names either.
Author of Total Commander
https://www.ghisler.com
billiebub
Member
Member
Posts: 187
Joined: 2011-04-12, 19:49 UTC

Re: TC 9.22a hangs

Post by *billiebub »

This now begs the question as whether it is possible to handle such reserved device names for PCs that have said interfaces? For example, Cygwin, MSYS, 7zip, etc. are capable of treating such special-named files in their own way. Is it possible to handle these reserved device name in an upcoming version of TC?
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: TC 9.22a hangs

Post by *ghisler(Author) »

I'm not aware of any functions to detect whether a file name is reserved or not. If anyone knows of such a Windows function, please let me know.
Author of Total Commander
https://www.ghisler.com
billiebub
Member
Member
Posts: 187
Joined: 2011-04-12, 19:49 UTC

Re: TC 9.22a hangs

Post by *billiebub »

The secret lies in file path format. For example, Cygwin states the following:
Invalid filenames
Filenames invalid under Win32 are not necessarily invalid under Cygwin. There are a few rules which apply to Windows filenames. Most notably, DOS device names like AUX, COM1, LPT1 or PRN (to name a few) cannot be used as filename or extension in a native Win32 application. So filenames like prn.txt or foo.aux are invalid filenames for native Win32 applications.

This restriction doesn't apply to Cygwin applications. Cygwin can create and access files with such names just fine. Just don't try to use these files with native Win32 applications.
Looking at Cygwin source code and tracing calls to mkdir AUX, we can see Nt* Windows API calls using \??\ in the beginning of the path:
1482 333244 [main] mkdir 7128 normalize_posix_path: src AUX
505 333749 [main] mkdir 7128 cwdstuff::get: posix /cygdrive/c/Users/billy/Downloads/___test___
944 334693 [main] mkdir 7128 cwdstuff::get: (/cygdrive/c/Users/billy/Downloads/___test___) = cwdstuff::get (0x600000010, 32768, 1, 0), errno 0
984 335677 [main] mkdir 7128 normalize_posix_path: /cygdrive/c/Users/billy/Downloads/___test___/AUX = normalize_posix_path (AUX)
983 336660 [main] mkdir 7128 mount_info::conv_to_win32_path: conv_to_win32_path (/cygdrive/c/Users/billy/Downloads/___test___/AUX)
1025 337685 [main] mkdir 7128 mount_info::cygdrive_win32_path: src '/cygdrive/c/Users/billy/Downloads/___test___/AUX', dst 'C:\Users\billy\Downloads\___test___\AUX'
985 338670 [main] mkdir 7128 set_flags: flags: binary (0x2)
926 339596 [main] mkdir 7128 mount_info::conv_to_win32_path: src_path /cygdrive/c/Users/billy/Downloads/___test___/AUX, dst C:\Users\billy\Downloads\___test___\AUX, flags 0x4022, rc 0
1081 340677 [main] mkdir 7128 symlink_info::check: 0xC0000034 = NtCreateFile (\??\C:\Users\billy\Downloads\___test___\AUX)
954 341631 [main] mkdir 7128 symlink_info::check: 0xC0000034 = NtQueryInformationFile (\??\C:\Users\billy\Downloads\___test___\AUX)
1046 342677 [main] mkdir 7128 symlink_info::check: 0xC0000034 = NtCreateFile (\??\C:\Users\billy\Downloads\___test___\AUX.lnk)
924 343601 [main] mkdir 7128 symlink_info::check: 0xC0000034 = NtQueryInformationFile (\??\C:\Users\billy\Downloads\___test___\AUX.lnk)
1001 344602 [main] mkdir 7128 symlink_info::check: 0 = symlink.check(C:\Users\billy\Downloads\___test___\AUX, 0xFFFFB680) (0x4022)
If you open CMD, and do the following:
mkdir \\.\c:\Users\<USER_ID>\path\AUX
Windows will happily create the AUX folder. You can also do the following to create CON.txt using Notepad:
notepad.exe \\.\c:\Users\billy\Downloads\__test__\CON.txt
Notepad will first state that it cannot find the file \\.\c:\Users\billy\Downloads\__test__\CON.txt and asks whether it should create it. If you click Yes, it will create file CON.txt. Note that neither TC, CMD, or explorer will see the file. If you repeat the same command "notepad.exe \\.\c:\Users\billy\Downloads\__test__\CON.txt", notepad will open the file successfully. I'm not sure if these files are created as alternate data streams but nevertheless, path formatting is necessary to work with special filenames.

Also, take a look at "\newlib-cygwin\winsup\cygwin\path.cc" in the Cygwin source.
Post Reply