Changes lost if specified protected path in Compare&Edit

Bug reports will be moved here when the described bug has been fixed

Moderators: white, Hacker, petermad, Stefan2

User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Changes lost if specified protected path in Compare&Edit

Post by *MVV »

How to reproduce:
1. Compare two different files, one of them must be in write-protected folder.
2. Edit one in write-protected folder.
3. Press Compare, TC will ask to save, press Save.
4. TC will show error that .bak can't be created, click OK.
5. TC will open Save file dialog, choose protected one and click Save.

TC shows error saving file and reverts all changes w/o saving it. Expected that TC will display Save file dialog again until user choose writeable folder or cancels operation manually.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48077
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

I have tried that, but I cannot reproduce it on XP. After step 5, I get the following error dialog from XP:
---------------------------
Save as
---------------------------
test.txt
You do not have the permission to save to this directory.
Contact the administrator to receive the permission.

Would you like to save it to the folder "My Documents" instead?
---------------------------
Yes No
---------------------------
When I click "No", the compare dialog will remain open.

So how exactly did you write-protect the folder? I set the permissions for the user to "Deny write".
Author of Total Commander
https://www.ghisler.com
User avatar
ts4242
Power Member
Power Member
Posts: 2081
Joined: 2004-02-02, 20:08 UTC
Contact:

Post by *ts4242 »

MVV wrote:TC shows error saving file and reverts all changes w/o saving it.
Cannot confirm on Windows 7, changes are remains, and TC continuously display Save dialog.

Edit:

I have tried with CompareSaveOriginal=0 and cannot confirm too.
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

Well, I'll try to reproduce it now.

Windows XP SP3, TC 7.55pb3, I'm under restricted account,

Left panel - %WINDIR%, right - any w/o restrictions,

I'm copying win.ini to right panel and slightly modify, then open compare tool, switch to edit mode,

Then I'm adding some section to the end of %WINDIR%\win.ini,

Then be careful:

If I use Save button, TC asks to save left file, I press Save Left, then TC warns that folder is read-only and shows Save dialog, I'm choosing %WINDIR%\system folder and pressing Save. TC shows save error... and keeps modifications in win.ini.

But (and I mentioned it in first post) if I use Compare button instead of Save button, TC reloads left win.ini even if it wasn't saved properly.

Maybe you will say again that Compare button is not for saving, but I think that it shoud work in same way. E.g. compare button's processor may call save button's processor and not to reload files if save was unsuccessful.
User avatar
ts4242
Power Member
Power Member
Posts: 2081
Joined: 2004-02-02, 20:08 UTC
Contact:

Post by *ts4242 »

2MVV

Do you mean press "Compare" then press "Don't save"? If so then I don't think it is a bug because when you ask TC to compare again, TC needs to re-load the file therefore pressing "Don't save" actually means "Ignore changes".

In order to prevent this confusion, the label "Don't save" requires to be changed to "Ignore changes"or to something like the string 5918="R&eload file" which is more clear for the user to know that if he pressed it, changes will be lost.
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

As I said (twice :)) I press Compare, and then Save, but if file is write-protected, TC asks to save it into another place. If you by mistake specify write-protected folder, TC will show error and reload file so changes will be lost.
User avatar
ts4242
Power Member
Power Member
Posts: 2081
Joined: 2004-02-02, 20:08 UTC
Contact:

Post by *ts4242 »

2MVV

Well, as I said (twice :D) I cannot reproduce according your steps!!!
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

ts4242,

Especially for you I started my virtual machine with Windows 7. You're right, under Windows 7 it seems to work right, when I try to save to write-protected folder, Windows tells that folder is write-protected and suggests to save into My Documents folder, and TC doesn't reload files if I cancel operation. But under Windows XP there is no such dialog and bug described by me has place.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48077
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Sorry, cannot reproduce even when I click on "Compare" instead of the disk button. I still get the dialog above that Windows cannot write to that directory, even on XP...
Author of Total Commander
https://www.ghisler.com
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

That's strange because I can confirm it on at least 3 computers with Windows XP (SP3 and SP2). Please look at animation.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48077
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Can you give me the exact permissions of folder "two", please? Maybe it only occurs if there are very special permissions. As I wrote above, the "Save as" dialog gives me this permissions warning, so it's a Windows problem...
Author of Total Commander
https://www.ghisler.com
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

Permissions are quite simple: current user have no write permissions to that folder, just read (just like Program Files folder for regular user).

Maybe it is a Windows problem, but I think that TC should expect that returned file path may be non-writeable, so TC shouldn't refresh panels if saving failed.
TWiStErRob
Junior Member
Junior Member
Posts: 16
Joined: 2005-04-04, 13:41 UTC
Location: Hungary
Contact:

Post by *TWiStErRob »

Maybe you could explain how that restricted user is created... and try a repro with that.
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

Just open Security tab of folder properties and forbid write permission for your user/group (select your group and check 'Write' in Forbid' column).
As I said, Program Files dir for group 'Users' has required for this bug permissions.
And, you need CompareSaveOriginal=1 in [Configuration] section of wincmd.ini (which is by default).
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48077
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Unfortunately I still cannot reproduce the error. However, I could reproduce a similar one: Just change the "save as" name to some other name in that forbidden directory. Windows will not give a warning then, but saving will fail. I will keep the two files unchanged in that case, it may also fix your problem.
Author of Total Commander
https://www.ghisler.com
Post Reply