Changes lost if specified protected path in Compare&Edit
Moderators: Hacker, petermad, Stefan2, white
Changes lost if specified protected path in Compare&Edit
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.
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.
- ghisler(Author)
- Site Admin
- Posts: 50421
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
I have tried that, but I cannot reproduce it on XP. After step 5, I get the following error dialog from XP:
So how exactly did you write-protect the folder? I set the permissions for the user to "Deny write".
When I click "No", the compare dialog will remain open.---------------------------
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
---------------------------
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
https://www.ghisler.com
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.
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.
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.
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.
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.
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.
- ghisler(Author)
- Site Admin
- Posts: 50421
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
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
https://www.ghisler.com
That's strange because I can confirm it on at least 3 computers with Windows XP (SP3 and SP2). Please look at animation.
- ghisler(Author)
- Site Admin
- Posts: 50421
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
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
https://www.ghisler.com
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.
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.
-
- Junior Member
- Posts: 16
- Joined: 2005-04-04, 13:41 UTC
- Location: Hungary
- Contact:
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).
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).
- ghisler(Author)
- Site Admin
- Posts: 50421
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
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
https://www.ghisler.com