CD into double backslash separated path makes TC consider files write protected even if they are not

Please report only one bug per message!

Moderators: white, Hacker, petermad, Stefan2

Post Reply
michaelkc
New Member
New Member
Posts: 1
Joined: 2020-07-03, 08:07 UTC

CD into double backslash separated path makes TC consider files write protected even if they are not

Post by *michaelkc »

(reproducable in TC 9.51)
Sometimes I quickly switch into directories by copying paths from JSON files and issuing "cd <path>" in the TC command line. Typically, these paths are double backslashed for escaping, e.g. "C:\\logs\\"

This works, but puts TC in a weird state, where the files inside are shown and supports most operations (e.g. copy, view), but specifically delete does not work - TC will claim the files are write protected and fail to delete them.
Steps to reproduce:
- Create a path C:\repro\
- Create a file C:\repro\repro.txt
- In TC command line issue the command "cd C:\\repro\\"
- Attempt to delete the file repro.txt.
- TC will fail to delete it, claiming the file is write protected

This is of course a very minor issue which is easily worked around.
User avatar
Horst.Epp
Power Member
Power Member
Posts: 6482
Joined: 2003-02-06, 17:36 UTC
Location: Germany

Re: CD into double backslash separated path makes TC consider files write protected even if they are not

Post by *Horst.Epp »

For me this pathname is an illegal syntax and should simply be rejected by TC
Windows 11 Home x64 Version 23H2 (OS Build 22631.3447)
TC 11.03 x64 / x86
Everything 1.5.0.1372a (x64), Everything Toolbar 1.3.3, Listary Pro 6.3.0.73
QAP 11.6.3.2 x64
User avatar
petermad
Power Member
Power Member
Posts: 14796
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: CD into double backslash separated path makes TC consider files write protected even if they are not

Post by *petermad »

2michaelkc
- Create a file C:\repro\repro.txt
- In TC command line issue the command "cd C:\\repro\\"
- Attempt to delete the file repro.txt.
- TC will fail to delete it, claiming the file is write protected
I cannot reproduce this - I can delete the file without problems. testet under Windows 7 and 10 with TC 9.51 x64
License #524 (1994)
Danish Total Commander Translator
TC 11.03 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1371a
TC 3.50 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
gdpr deleted 6
Power Member
Power Member
Posts: 872
Joined: 2013-09-04, 14:07 UTC

Re: CD into double backslash separated path makes TC consider files write protected even if they are not

Post by *gdpr deleted 6 »

Horst.Epp wrote: 2020-07-03, 12:42 UTC For me this pathname is an illegal syntax and should simply be rejected by TC
The APIs of the OS accept such paths, and TC should not spend effort to reject path constructs that are accepted by the OS itself.
It would be a different story if TC would be required to normalize such paths prior to handing them over to the respective OS functions, but this is not the case here.

UPDATE: I changed my opinion with regard to path normalization. See my next post below...
Last edited by gdpr deleted 6 on 2020-07-04, 14:02 UTC, edited 1 time in total.
User avatar
petermad
Power Member
Power Member
Posts: 14796
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: CD into double backslash separated path makes TC consider files write protected even if they are not

Post by *petermad »

2Horst.Epp
2elgonzo
Can any of you two actually confirm michaelkc's steps to reproduce:
- Create a path C:\repro\
- Create a file C:\repro\repro.txt
- In TC command line issue the command "cd C:\\repro\\"
- Attempt to delete the file repro.txt.
- TC will fail to delete it, claiming the file is write protected
Because I can NOT, as previously reported.
License #524 (1994)
Danish Total Commander Translator
TC 11.03 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1371a
TC 3.50 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
gdpr deleted 6
Power Member
Power Member
Posts: 872
Joined: 2013-09-04, 14:07 UTC

Re: CD into double backslash separated path makes TC consider files write protected even if they are not

Post by *gdpr deleted 6 »

petermad wrote: 2020-07-04, 12:59 UTC Can any of you two actually confirm michaelkc's steps to reproduce:
No. Like you, i cannot reproduce. Not with the 64-bit nor the 32-bit version of TC 9.1 (running on Win 7 Pro x64)

However, i noticed TC stumbling over the doubled backslashes when trying to navigate to the parent directory (either by 'entering' the ".." item in the file list, or by Ctrl+PgUp, or by doing "cd .." in TC's command line). First, note that TC is showing the double blackslashes in the path above the file list. When trying to navigate to the parent directory, TC seems to attempt doing it by locating the 2nd-last backslash in the path string and taking everything left of it as the parent directory path. Which, when double backslashes are involved like in this case, does not really work at the first try. Basically

1. Start path as shown above the file list: X:\\Dir1\\*.*
2. Attempting to move a directory up will fail, however now the path above the file list will show: X:\\Dir1\*.* (note how there is now only a single backslash before "*.*")
3. Now again attempting to move a directory up will succeed.

UPDATE: Having observed this experience, i change my opinion expressed in my last post. In my opinion, TC should normalize paths provided by the user (or from some plug-in or other 'external' source) as TC's internal path string handling and manipulation relies on clean and sane path strings (as demonstrated here)
Last edited by gdpr deleted 6 on 2020-07-04, 14:07 UTC, edited 4 times in total.
User avatar
Horst.Epp
Power Member
Power Member
Posts: 6482
Joined: 2003-02-06, 17:36 UTC
Location: Germany

Re: CD into double backslash separated path makes TC consider files write protected even if they are not

Post by *Horst.Epp »

petermad wrote: 2020-07-04, 12:59 UTC 2Horst.Epp
2elgonzo
Can any of you two actually confirm michaelkc's steps to reproduce:
- Create a path C:\repro\
- Create a file C:\repro\repro.txt
- In TC command line issue the command "cd C:\\repro\\"
- Attempt to delete the file repro.txt.
- TC will fail to delete it, claiming the file is write protected
Because I can NOT, as previously reported.
No, I can't confirm his steps in my Environment (see signature).
I can delete the file in this path without problems.
Windows 11 Home x64 Version 23H2 (OS Build 22631.3447)
TC 11.03 x64 / x86
Everything 1.5.0.1372a (x64), Everything Toolbar 1.3.3, Listary Pro 6.3.0.73
QAP 11.6.3.2 x64
siealex
Senior Member
Senior Member
Posts: 278
Joined: 2009-03-22, 16:36 UTC

Re: CD into double backslash separated path makes TC consider files write protected even if they are not

Post by *siealex »

Reproduced! TC 9.51 x32, Windows 10 v. 2004 x64. I can't delete using DEL (or F8), but: 1) I CAN delete it, if I choose "as admin" (!) and 2) I CAN delete it using Shift+DEL.
Image: http://ipic.su/img/img7/fs/1759.1594032510.jpg
Steps to reproduce:
1. Create a folder (e. g. M:\downloads\temp) on your hard drive.
2. Press Shift+F4 and create an empty file (1.txt).
3. Return to the root of that drive and type in the command line: cd m:\\downloads\\temp. Both times with two backslashes. The path in the panel must contain two backslashes.
4. Select the file and press DEL. If TC asks for confirmation, confirm (maybe, twice). Then you'll see the error message.
5. Select "As admin" in this message box and try to delete the file.
We are not so S.M.A.R.T. as we imagine...
User avatar
petermad
Power Member
Power Member
Posts: 14796
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: CD into double backslash separated path makes TC consider files write protected even if they are not

Post by *petermad »

II can now confirm it when I try to move the file to Recycle Bin. I have the Recycle Bin disabled system-wise for most of my partitions, and I have changed TC's configuration to delete directly for Del / F8, so that is why I couldn't reproduce it in the first place.

But if I try to delete from \\repro\\ on a drive with enabled Recycle Bin using Shift+Del (deleting to Recycle Bin in my TC), then I can confirm that TC cannot delete the file unless I choose to do it as Administrator.
License #524 (1994)
Danish Total Commander Translator
TC 11.03 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1371a
TC 3.50 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
gdpr deleted 6
Power Member
Power Member
Posts: 872
Joined: 2013-09-04, 14:07 UTC

Re: CD into double backslash separated path makes TC consider files write protected even if they are not

Post by *gdpr deleted 6 »

Using delete to recycle bin, i can now reproduce as well.
Post Reply