GNOME Bugzilla – Bug 138131
Cannot save changes to file owned by another user, even though group/other permissions allow it
Last modified: 2006-03-13 08:15:18 UTC
When editing a file that is owned by another user but has group write permissions, I can't save changes with gedit. Problem doesn't exist for vi. Reproduce by: 1. Create some scratch file 'xx' 2. sudo chown otheruser.any-group-i-am-in xx [i.e., make the file owner a different user, but make the file group a group that I belong to.] 3. sudo chmod 0660 xx <-- the group I'm in has write permission 4. gedit xx, make changes, click Save result: error dialog "Could not save the file ...." 5. vi xx, make a change, save without problems Similar case: sudo chmod 0666 xx <--- *everyone* has write permission Save still fails. Problem exists whether preferences->save->create backup file is checked or not.
Actually I have no problems modifying and saving a file in my home dir after having changed file owner to root and chmodded it tp 0666 (writable for all). Didn't try yet the group case...
You're right paolo (although the file ownership changes after saving). But try it in /tmp (which has perms: drwxrwxrwt) or in any directory where other/group has no write permissions. [The normal usage case of this bug for me is a file shared for writing in a directory that is read-only.] I see from the umbrella file-saving bug that this is part of that well-known problem. Thanks for looking at this. I hope it gets fixed, since gedit is one of the few ATK-enabled editors.
The quid is that the owner of the parent folder is also another user, a simple testcase: nelson@gnelson ~ $ pwd /home/nelson nelson@gnelson ~ $ su Password: gnelson nelson # mkdir test gnelson nelson # echo "hola" > test/hola.txt gnelson nelson # chmod a+w test/hola.txt gnelson nelson # ls -l test/hola.txt -rw-rw-rw- 1 root root 5 ago 21 14:23 test/hola.txt gnelson nelson # exit exit nelson@gnelson ~ $ gedit test/hola.txt (GEDIT OPENS THE FILE IN WRITE MODE BUT CANNOT SAVE IT ) Checks: nelson@gnelson ~ $ gnomevfs-info file:///home/nelson/test/hola.txt | grep able Readable : YES Writable : YES Executable : NO (GNOMEVFS IS RIGHT TELLING THE FILE IS WRITABLE) nelson@gnelson ~ $ vi test/hola.txt (VI EDIT AND SAVE THE FILE WITHOUT PROBLEM) If we put the owner of the test folder to the normal user then gedit can save it: nelson@gnelson ~ $ su Password: gnelson nelson # chown nelson test gnelson nelson # exit exit nelson@gnelson ~ $ gedit test/hola.txt (GEDIT CAN SAVE THE FILE WITHOUT PROBLEMS)
finally fixed in 2.14 The first time you save, you get a warning saying that a backup cannot be created (which is the reason why the old gedit couldn't save) and asks you if you want to go on anyway.