GNOME Bugzilla – Bug 104432
changes owner and group id's when file is saved
Last modified: 2006-01-30 21:25:34 UTC
If a file is owned by user A and group GA, user B can open the file because user B is in group GA. When user B saves the file, the file's owner and group id are changed to user B. When the above is done with vi, the owner and group id remain as they were setup.
We definitely need to improve that part of the code. See also bug #92896.
Here's how it operates right now (from what I'm seeing): 1) file.txt moved to file.txt~ maintaining ownership, permissions, etc. 2) file.txt created under CURRENT ownership, permissions, etc. 3) data written to file.txt Care to guess what happens when you save twice in a row? Yeah. Kiss that ownership bye-bye. The real problem at hand is developing an intelligent approach to backing up files. Obviously, in the case of multiple users (as here), we can't just move/create. Overwriting the file without a backup when one might be possible or even wanted isn't much better, either. We need a copy/overwrite scheme to solve this particular problem. That's what 92896 is all about (this bug is safer for me, though.)
Created attachment 27488 [details] [review] Changes have been made so that the owner and the group id remains as they were before, when a user belonging to same group but not owner of that file saves the file. Whenever a user belonging to the group same as that of the owner of a file, edits and saves the file, that user id was being changed to that of the user editing the file. The this is not the right way. The GID and UID suppose to be remain intact. In this patch the care is taken so that the UID and GIDs of the file remain same as they were before.
Thanks for the patch. Note that I'm rewriting the "save" function in order to use gnome-vfs.
Bug 169816 also has a patch.
Christian: we appreciate your triaging bug efforts, however Paolo Maggi and me are quite aware of the bugzilla status of gedit... the patch attached to bug 169816 solves a completely different problem with the save a copy plugin. As Paolo Maggi said above this bug will be fixed with the gnome-vfs rewrite of the saving routines, which should happen soon.
thanks for pointing that out Paolo Borelli
Created attachment 47683 [details] Plugin for GEDIT 2.10.x Convert between MAC-DOS-UNIX text formats. This patch contains the convert/ plugin code. It guesses the file type {DOS,MAC,UNIX} and uses gedit_document_replace_string(); It runs a dialog in the middle, for user to abort conversions, or convert from Dos-Unix-Mac-Dos-Unix, All the 6 conversion combo's are possible, but based on your file type.
this is fixed in 2.13.X