TC 9.22a hangs

Please report only one bug per message!

Moderators: sheep, Hacker, Stefan2, white

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

TC 9.22a hangs

Post by *billiebub » 2019-06-12, 17:12 UTC

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: 6778
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Re: TC 9.22a hangs

Post by *Dalai » 2019-06-12, 17:57 UTC

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

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

Re: TC 9.22a hangs

Post by *billiebub » 2019-06-13, 13:35 UTC

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: 6778
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Re: TC 9.22a hangs

Post by *Dalai » 2019-06-13, 13:47 UTC

billiebub wrote:
2019-06-13, 13:35 UTC
You 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

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

Re: TC 9.22a hangs

Post by *billiebub » 2019-06-13, 15:44 UTC

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: 3475
Joined: 2003-02-06, 17:36 UTC
Location: Germany

Re: TC 9.22a hangs

Post by *Horst.Epp » 2019-06-13, 16:31 UTC

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 10 Home x64 November 2019 Update, Version 1909 (OS Build 18363.476)
Intel(R) Core(TM) i7-4770 CPU @ 3.40GH, 16GB RAM
TC 9.50ß8 x64 / x86, Everything 1.4.1.959 (x64)

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

Re: TC 9.22a hangs

Post by *billiebub » 2019-06-13, 17:12 UTC

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: 630
Joined: 2011-03-11, 10:11 UTC

Re: TC 9.22a hangs

Post by *Usher » 2019-06-13, 18:08 UTC

billiebub
Did you test only 32-bit TC on 64-bit Windows?
Regards from Poland
Andrzej P. Wozniak

User avatar
Horst.Epp
Power Member
Power Member
Posts: 3475
Joined: 2003-02-06, 17:36 UTC
Location: Germany

Re: TC 9.22a hangs

Post by *Horst.Epp » 2019-06-13, 19:06 UTC

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 10 Home x64 November 2019 Update, Version 1909 (OS Build 18363.476)
Intel(R) Core(TM) i7-4770 CPU @ 3.40GH, 16GB RAM
TC 9.50ß8 x64 / x86, Everything 1.4.1.959 (x64)

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

Re: TC 9.22a hangs

Post by *billiebub » 2019-06-13, 19:26 UTC

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: 3475
Joined: 2003-02-06, 17:36 UTC
Location: Germany

Re: TC 9.22a hangs

Post by *Horst.Epp » 2019-06-13, 19:34 UTC

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 10 Home x64 November 2019 Update, Version 1909 (OS Build 18363.476)
Intel(R) Core(TM) i7-4770 CPU @ 3.40GH, 16GB RAM
TC 9.50ß8 x64 / x86, Everything 1.4.1.959 (x64)

User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 38408
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: TC 9.22a hangs

Post by *ghisler(Author) » 2019-06-13, 19:42 UTC

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
http://www.ghisler.com

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

Re: TC 9.22a hangs

Post by *billiebub » 2019-06-13, 21:54 UTC

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: 38408
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: TC 9.22a hangs

Post by *ghisler(Author) » 2019-06-14, 10:06 UTC

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
http://www.ghisler.com

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

Re: TC 9.22a hangs

Post by *billiebub » 2019-06-15, 18:42 UTC

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