rename with illegal character: wrong error message

The behaviour described in the bug report is either by design, or would be far too complex/time-consuming to be changed

Moderators: sheep, Hacker, Stefan2, white

Post Reply
Thany
Senior Member
Senior Member
Posts: 251
Joined: 2003-09-30, 09:20 UTC
Location: Netherlands

rename with illegal character: wrong error message

Post by *Thany » 2018-08-16, 19:30 UTC

Running TC 9.21 x64 in Windows 10. I was trying to rename `test.mp4` to `Glamor : FULL HD.mp4`, just as an example I copied from somewhere, which shouldn't work, and it doesn't. But I was expecting TC to tell me which characters, among `:` is one, not to use in filenames. Instead, it gives me an error "please remove the write protection".

Why this message in the first place? How does TC come to the conclusion the file isn't writable, when it actually really *is* writable, and I'm not even trying to write to it! Clearly this is a bug if not the illegal character thing. Iow: only display the write protection message if the file actually isn't writable *and* has to be written to.

But more importantly, where's the message that says "you cannot use these characters: ..." gone to?

(btw, how to attach an image? I have a screenshot, the image button in the editor just inserts some tags but doesn't let me upload)

User avatar
Usher
Power Member
Power Member
Posts: 588
Joined: 2011-03-11, 10:11 UTC

Re: rename with illegal character: wrong error message

Post by *Usher » 2018-08-16, 21:34 UTC

The error message is NOT about directory or file name. It's about (MS-DOS) DEVICE NAME (like LTP1:, COM2:, C:, D:, CON:), as you have used colon.
Regards from Poland
Andrzej P. Wozniak

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

Re: rename with illegal character: wrong error message

Post by *ghisler(Author) » 2018-08-17, 07:04 UTC

The colon is indeed special, that's why you get that strange error message. You will be warned about invalid characters when you use other forbidden characters like: <>|"
Author of Total Commander
http://www.ghisler.com

Thany
Senior Member
Senior Member
Posts: 251
Joined: 2003-09-30, 09:20 UTC
Location: Netherlands

Re: rename with illegal character: wrong error message

Post by *Thany » 2018-08-17, 08:42 UTC

What does it have to do with DOS device names when we're renaming a file?
There's no way in heaven or hell that it's ever valid to rename a file to a device name, so it's safe to assume that a colon is always an illegal filename character and should be treated as such, right?

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

Re: rename with illegal character: wrong error message

Post by *ghisler(Author) » 2018-08-17, 08:49 UTC

The problem is that Glamor : FULL HD.mp4 isn't really an illegal name - It tells windows to create a file named "Glamor" with alternate data stream "FULL HD.mp4". TC prevents the user from doing this, otherwise it wouldn't be possible to access the data any more. But you can create such streams with Shift+F4. I cannot use the message about illegal characters because : isn't really illegal.
Author of Total Commander
http://www.ghisler.com

User avatar
Usher
Power Member
Power Member
Posts: 588
Joined: 2011-03-11, 10:11 UTC

Re: rename with illegal character: wrong error message

Post by *Usher » 2018-08-17, 13:45 UTC

Thany wrote:
2018-08-17, 08:42 UTC
What does it have to do with DOS device names when we're renaming a file?
It's not rename only, it's rename OR MOVE, depending on what you type there. You can easy rename file test.txt to newtest.txt or move it to another subdir like ..\new\test.txt.
You can also try to move file to another partition, f.e. from C:\test\test.txt to D:\test\test.txt – but in this case if you use Shift+F6, you will see another misleading error message "Error: Cannot read c:\test\test.txt!"

In your case it was probably try to move a file to alternate file stream, as 2ghisler(Author) said, and colon is just reusing of existing naming convention. You can check what will happen if you try to move (F6) rather than copy (F5) test.txt to LPT1:

As you see, there is a possibility to use device name…

There might be another problem there - trailing space in name ("Glamor "). You should really be very careful with spaces and dots. Some tools (including TC plugins like dbxplug) can create directory or file name ending with space or dot (f.e. based on email subject), but most tools strip trailing space or dot in a target name (if it's without extension), many tools strip trailing space or dot in source names, and some tools also strip leading spaces. F.e. Windows Explorer don't display trailing dot and you can't copy, rename or delete such names using Explorer in a common way.
Regards from Poland
Andrzej P. Wozniak

Thany
Senior Member
Senior Member
Posts: 251
Joined: 2003-09-30, 09:20 UTC
Location: Netherlands

Re: rename with illegal character: wrong error message

Post by *Thany » 2018-08-18, 19:11 UTC

First of all, there is a space before the colon, which in this indicates againt the use of a device.
Secondly, the device name it assumed, doesn't exist (which I'm sure can be checked if need be) so it shouldn't be assumed to be a device.
Third, renaming a file with F2 (which I did) is really weird if it could move to a device. Not only because such devices are seldom used anymore (hey, it's 2018, remember, who has an LPT port these days ;)) but also because F2 means to primarily rename a file, as is convention.

As for your last statement, I have never had the kind of problems you described. They seem very far fetched, and also irrelevant to the issue.

At any rate, no matter how this problem is explained away (sorry, no offense, it just feels that way to me), the error message is still incorrect.

Post Reply