After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 138131 - Cannot save changes to file owned by another user, even though group/other permissions allow it
Cannot save changes to file owned by another user, even though group/other pe...
Status: RESOLVED FIXED
Product: gedit
Classification: Applications
Component: general
2.5.x
Other Linux
: Normal normal
: ---
Assigned To: Gedit maintainers
Gedit maintainers
Depends on:
Blocks: 130389
 
 
Reported: 2004-03-25 20:48 UTC by Jack Spaar
Modified: 2006-03-13 08:15 UTC
See Also:
GNOME target: ---
GNOME version: 2.9/2.10



Description Jack Spaar 2004-03-25 20:48:40 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.
Comment 1 Paolo Borelli 2004-03-28 13:47:42 UTC
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...
Comment 2 Jack Spaar 2004-03-28 18:43:07 UTC
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.
Comment 3 Nelson Benitez 2005-08-22 18:43:08 UTC
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)
Comment 4 Paolo Borelli 2006-03-13 08:15:18 UTC
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.