+Bad dir opened on cd stuff /a or cd stuff \3

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

Moderators: Hacker, petermad, Stefan2, white

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

Post by *ghisler(Author) »

Hmm, but doesn't it fail also when "Stuff " actually exists?
Author of Total Commander
https://www.ghisler.com
User avatar
MVV
Power Member
Power Member
Posts: 8711
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

I created directory "F:\Stuff \" near existing "F:\Stuff\" and tried it. This code creates directory "F:\Stuff \11":

Code: Select all

int r=SetCurrentDirectory("F:\\Stuff \\");
CreateDirectory("11", 0);
So it works for path with spaces at the end of directory names when such directories exist.
User avatar
white
Power Member
Power Member
Posts: 5815
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Post by *white »

I did some tests with Delphi 2 and the function SetCurrentDir from the SysUtils unit. I get the same results as MVV.
User avatar
MVV
Power Member
Power Member
Posts: 8711
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

Thanks, works much better in 8.50b10!
TC doesn't enter non-existing folder more.
User avatar
white
Power Member
Power Member
Posts: 5815
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Post by *white »

MVV wrote:Thanks, works much better in 8.50b10!
TC doesn't enter non-existing folder more.
That's true, but I see several side effects.

* Create folder "tmp"
* Rename folder to "tmp "
* Rename folder to "tmp3"
* Rename folder to "tmp "
* Now 2 folders are created, "tmp " and "tmp"
* Place cursor on "tmp " (with trailing space)
* Del "tmp " (with trailing space)
* Now 2 folders are deleted, "tmp " and "tmp"


There are now variable results when creating and renaming and deleting folders with trailing spaces. For example, if I create a folder "z " with trailing space and no backslash, sometimes the folder is created with trailing space but mostly not.
User avatar
MVV
Power Member
Power Member
Posts: 8711
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

I confirm that after renaming "tmp3" to "tmp \" extra folder "tmp" is created. And on deletion of "tmp " folder "tmp" is deleted (TC even shows a confirmation like for non-empty dir).
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50541
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

That's what I meant with side effects! I will revert to how it was in TC 8.01.

Edit: It seems that the delete error was already in TC 8.01 too...

Edit2: The second dir creation has nothing to do with spaces at the end, you also get an error when trying to rename tmp3 to tmp\ (reason: TC tries to create dir tmp\ and move tmp3 inside).
Author of Total Commander
https://www.ghisler.com
User avatar
MVV
Power Member
Power Member
Posts: 8711
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

That's nice that some issues were found while testing this thing. :)

I think TC shouldn't move dir if its name after slash is not specified. E.g. rename tmp3 to "tmp \" is rename only while rename tmp3 to "tmp \1" is move with rename.

BTW if I move dir "tmp " to other dir, it loses space at the end.
User avatar
white
Power Member
Power Member
Posts: 5815
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Post by *white »

ghisler(Author) wrote:Edit: It seems that the delete error was already in TC 8.01 too...
Confirmed.
MVV wrote:I think TC shouldn't move dir if its name after slash is not specified. E.g. rename tmp3 to "tmp \" is rename only while rename tmp3 to "tmp \1" is move with rename.
Well, it isn't in TC 8.01. So this seems to be a side effect.
MVV wrote:BTW if I move dir "tmp " to other dir, it loses space at the end.
Confirmed for 8.01 and 8.50b10.
User avatar
MVV
Power Member
Power Member
Posts: 8711
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

Well, it isn't in TC 8.01. So this seems to be a side effect.
It may be a side effect of something but not changing directory with cd command. :)

BTW I tried to rename dir "xxx" to "yyy\" in TC 7.56a and TC 8.01 and they simply renamed it w/o moving to subdir. TC 8.50b1-8.50b9 show error message and create folder yyy. So I think it should be changed back to older behaviour with ignoring backslash at the end of name. But here we can apply new feature to keep spaces if slash is specified.

TC 8.50b2 can't be started directly because of expired message (bad thing for testing purposes but may be easilly overriden using RunAsDate).
User avatar
white
Power Member
Power Member
Posts: 5815
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Post by *white »

MVV wrote:
Well, it isn't in TC 8.01. So this seems to be a side effect.
It may be a side effect of something but not changing directory with cd command. :)

BTW I tried to rename dir "xxx" to "yyy\" in TC 7.56a and TC 8.01 and they simply renamed it w/o moving to subdir. TC 8.50b1-8.50b9 show error message and create folder yyy.
Confirmed. So it's probably a side effect of:
HISTORY.TXT wrote:13.02.13 Added: Rename file (main program or sync tool): If the user specifies a directory, e.g. subdir\file.ext which doesn't exist yet, create it (32/64)
User avatar
MVV
Power Member
Power Member
Posts: 8711
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

Maybe of mix with:
13.02.13 Fixed: Inplace rename: Do not warn about existing target directory if the user added a trailing backslash, e.g. target\ (32/64)
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50541
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Yes, this is the problem, I didn't check whether there was anything after the backslash or not.
There are now variable results when creating and renaming and deleting folders with trailing spaces. For example, if I create a folder "z " with trailing space and no backslash, sometimes the folder is created with trailing space but mostly not.
I couldn't reproduce this - TC should never create folders with trailing spaces directly. The only way to create them is by renaming an existing folder.

Can you give me an example when this happens?
Author of Total Commander
https://www.ghisler.com
User avatar
white
Power Member
Power Member
Posts: 5815
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Post by *white »

ghisler(Author) wrote:
There are now variable results when creating and renaming and deleting folders with trailing spaces. For example, if I create a folder "z " with trailing space and no backslash, sometimes the folder is created with trailing space but mostly not.
I couldn't reproduce this - TC should never create folders with trailing spaces directly. The only way to create them is by renaming an existing folder.

Can you give me an example when this happens?
I cannot reproduce anymore. Makes me wonder if I was mistaken. I suggest to ignore my statement. I will see if I can find anything wrong with the next version.
User avatar
white
Power Member
Power Member
Posts: 5815
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Post by *white »

HISTORY.TXT wrote:21.11.13 Fixed: Inplace rename "test" to "test2" -> TC created test2 instead of renaming (due to the backslash) (32/64)
...
21.11.13 Fixed: Delete folder "test " directly (not to recycle bin) -> also deleted folder "test" in same directory (with warning) (32/64)
Tested OK using TC 8.50b11 32bit.

I did quite some tests and couldn't find much wrong. I found a minor issue when doing "cd stuff \a" or "cd stuff /a" (on command line). If the folder "stuff " exists and "stuff" does not, the command does not enter the folder but only put the cursor on the folder. If the folder "stuff " and "stuff" both exist then the command does enter the folder.
Post Reply