This forum uses cookies. Click X button to hide this message. What is stored? / Privacy
Total Commander Forum Index Total Commander
Forum - Public Discussion and Support
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Incorrect file length count in "long name" warning
Goto page 1, 2  Next
 
Post new topic   Reply to topic    Total Commander Forum Index -> TC9.1x bug reports (English) Printable version
View previous topic :: View next topic  
Author Message
Flint
Power Member
Power Member


Joined: 27 Oct 2003
Posts: 3141
Location: Moscow, Russia

PostPosted: Mon Nov 27, 2017 4:54 pm    Post subject: Incorrect file length count in "long name" warning Reply with quote

1. Create a file with some short name.
2. Try to rename it into exactly 256-character length name.
3. TC displays the warning dialog:
Quote:
The target name length (264) is more than 259 characters!
Additionally, the last part of the name is 257 characters long, which is longer than the maximum possible 256 characters!


Problems:
* First, it claims the file name length is 257 characters instead of actual 256.
* Second, it says the maximum possible length is 256 characters, but does not allow to create such a file.

According to NTFS specifications, the maximum possible length is actually 255 characters, so that explains why 256-chars file name cannot be created, but the translation line 1699 should then look like "…longer than the maximum possible 255 characters!".

P.S. Maybe TC takes into account the trailing zero byte, but from the users' point of view it's not obvious.
_________________
Flint's Homepage: Full TC Russification Package, VirtualDisk, NTFS Links, NoClose Replacer, other stuff!
 
Using TC 9.20rc2 / Win7 x32 & x64 SP1
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Dalai
Power Member
Power Member


Joined: 28 Jan 2005
Posts: 6076
Location: Meiningen (Südthüringen)

PostPosted: Tue Nov 28, 2017 9:29 am    Post subject: Reply with quote

I can confirm both issues. This also applies to TC 8.52a.

Regards
Dalai
_________________
#101164 Personal licence
Athlon X4 880K, 16 GiB RAM, Gigabyte F2A88X-D3HP, Win7 x64

Plugins: Services2, Startups
Back to top
View user's profile Send private message Send e-mail
ghisler(Author)
Site Admin
Site Admin


Joined: 04 Feb 2003
Posts: 35943
Location: Switzerland

PostPosted: Tue Nov 28, 2017 9:40 am    Post subject: Reply with quote

Yes indeed, the 257 character is with the terminating 0, and the 256 too.
_________________
Author of Total Commander
http://www.ghisler.com
Back to top
View user's profile Send private message Send e-mail Visit poster's website
ghisler(Author)
Site Admin
Site Admin


Joined: 04 Feb 2003
Posts: 35943
Location: Switzerland

PostPosted: Wed May 16, 2018 10:49 am    Post subject: Reply with quote

This should finally be fixed in beta 3, please test it!
_________________
Author of Total Commander
http://www.ghisler.com
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Dalai
Power Member
Power Member


Joined: 28 Jan 2005
Posts: 6076
Location: Meiningen (Südthüringen)

PostPosted: Wed May 16, 2018 2:34 pm    Post subject: Reply with quote

Well, the incorrect count issue is fixed, but another closely related one is still present. Making the name exactly 256 characters long (name including extension and the separating dot!) shows the error message
Code:
---------------------------
Total Commander
---------------------------
Error: Cannot write H:\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...!

Please remove the write protection!
---------------------------
OK   Abbrechen   
---------------------------
Making the name one character shorter works OK, and when making it one character longer (257 chars) TC shows the confirmation of whether to keep the long name (also mentioned in the OP).

Looks to me like some comparison (if-statement) uses an incorrect number.

Regards
Dalai
_________________
#101164 Personal licence
Athlon X4 880K, 16 GiB RAM, Gigabyte F2A88X-D3HP, Win7 x64

Plugins: Services2, Startups
Back to top
View user's profile Send private message Send e-mail
Flint
Power Member
Power Member


Joined: 27 Oct 2003
Posts: 3141
Location: Moscow, Russia

PostPosted: Wed May 16, 2018 4:57 pm    Post subject: Reply with quote

I confirm what Dalai posted.
_________________
Flint's Homepage: Full TC Russification Package, VirtualDisk, NTFS Links, NoClose Replacer, other stuff!
 
Using TC 9.20rc2 / Win7 x32 & x64 SP1
Back to top
View user's profile Send private message Send e-mail Visit poster's website
ghisler(Author)
Site Admin
Site Admin


Joined: 04 Feb 2003
Posts: 35943
Location: Switzerland

PostPosted: Thu May 17, 2018 4:14 am    Post subject: Reply with quote

That's because the path name isn't longer than the Windows limit of 259 characters, but the individual name within the directory is longer than 255 characters. Since it's impossible to create such names even with the prefix, TC shows a rename error directly.
_________________
Author of Total Commander
http://www.ghisler.com
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Flint
Power Member
Power Member


Joined: 27 Oct 2003
Posts: 3141
Location: Moscow, Russia

PostPosted: Thu May 17, 2018 7:23 am    Post subject: Reply with quote

I see what you mean, I forgot that the dialog's intention is to warn about long paths, not about long names.

But come to think of it, maybe it's better to show the specific message to user instead of generic "Cannot write"? Because now the user might remain confused about what happened. TC says, "Please remove the write protection!", but there is no write protection.
_________________
Flint's Homepage: Full TC Russification Package, VirtualDisk, NTFS Links, NoClose Replacer, other stuff!
 
Using TC 9.20rc2 / Win7 x32 & x64 SP1
Back to top
View user's profile Send private message Send e-mail Visit poster's website
MarcinW
Power Member
Power Member


Joined: 23 Jan 2012
Posts: 852
Location: Poland

PostPosted: Thu May 17, 2018 1:57 pm    Post subject: Reply with quote

Same observations here.

When trying to create a file name having 257 chars, we always get a warning (because even drive prefix alone will make the path longer than 259 chars).

When trying to create a file name having 256 chars in any directory, we always get a warning (because drive prefix + even shortest directory name will make the path longer than 259 chars).

When trying to create a file name having 256 chars in a root directory, we get no warning (because drive prefix alone will make the path having exactly 259 chars).

And the last case is confusing - we get only "cannot write" error. The best solution would be to warn also in the last case - with a shorter warning text, informing only about too long name (not the whole path). This is what every user expects, I think.

Since the user sees a warning about too long name and too long path, he doesn't expect, that path length is the only factor, that is taken into consideration when launching the warning window.

Regards
Back to top
View user's profile Send private message Send e-mail
ghisler(Author)
Site Admin
Site Admin


Joined: 04 Feb 2003
Posts: 35943
Location: Switzerland

PostPosted: Fri May 18, 2018 4:17 am    Post subject: Reply with quote

You get an error, that's sufficient.
_________________
Author of Total Commander
http://www.ghisler.com
Back to top
View user's profile Send private message Send e-mail Visit poster's website
MarcinW
Power Member
Power Member


Joined: 23 Jan 2012
Posts: 852
Location: Poland

PostPosted: Fri May 18, 2018 4:20 am    Post subject: Reply with quote

Ok. So please make the error message more meaningful! "Cannot write... Please remove the write protection!" is highly confusing.

Regards
Back to top
View user's profile Send private message Send e-mail
ghisler(Author)
Site Admin
Site Admin


Joined: 04 Feb 2003
Posts: 35943
Location: Switzerland

PostPosted: Mon May 21, 2018 1:56 am    Post subject: Reply with quote

The reason why I don't do this: The 259 character limit per path and the 255 character limit are two completely different things:
1. The 259 character limit is a limit of Windows functions like CreateFile, DeleteFile etc. It means that when you create a file with a longer name, it can only be accessed with a trick (by putting \\?\ or \\?\UNC\ in front of the name). Most Windows program do not use this workaround, so they will be unable to access these files.

2. The 255 character limit per name within a directory is a limit specific to the NTFS file system. Other file system may have other limits. For example, the FAT file system limits the number of files in the root of a drive, because the root is stored in a fixed location and not as a (growable) file. Therefore the hint about the 255 character limit is just a hint, it doesn't mean that creating such a file will fail in every case. There may be file systems where such a name would actually be allowed. Therefore TC allows to try to create such a file.

Howerver, it's a good idea to report "Invalid file name" in this case.
_________________
Author of Total Commander
http://www.ghisler.com
Back to top
View user's profile Send private message Send e-mail Visit poster's website
MarcinW
Power Member
Power Member


Joined: 23 Jan 2012
Posts: 852
Location: Poland

PostPosted: Tue May 22, 2018 4:08 am    Post subject: Reply with quote

ghisler(Author) wrote:
However, it's a good idea to report "Invalid file name" in this case.

Thanks!
Back to top
View user's profile Send private message Send e-mail
ghisler(Author)
Site Admin
Site Admin


Joined: 04 Feb 2003
Posts: 35943
Location: Switzerland

PostPosted: Wed May 23, 2018 9:38 am    Post subject: Reply with quote

OK, I changed it in beta 4 to "Invalid name", please test it!
_________________
Author of Total Commander
http://www.ghisler.com
Back to top
View user's profile Send private message Send e-mail Visit poster's website
MarcinW
Power Member
Power Member


Joined: 23 Jan 2012
Posts: 852
Location: Poland

PostPosted: Thu May 24, 2018 8:01 am    Post subject: Reply with quote

Problem solved. Thanks!
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    Total Commander Forum Index -> TC9.1x bug reports (English) All times are GMT - 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Imprint/Impressum: This site is maintained by Ghisler Software GmbH
Privacy Policy | Datenschutzerklärung | Politique de Confidentialité

Using phpBB © phpBB Group