[Geany-devel] Safe file saving - permissions issue

Алексей Антипов 1a_antipov at xxxxx
Tue Mar 30 12:28:25 UTC 2010


I've found one more issue with Geany's "Safe file saving" option. When using g_file_set_contents(), file ownership and permissions are replaced with those for a new file. That fully conforms to GLib documentation (http://library.gnome.org/devel/glib/unstable/glib-File-Utilities.html#g-file-set-contents), but is not good sometimes (e.g. editing an executable script file). 
I propose to use GIO API (GFile) instead of g_file_set_contents; the patch is attached. This solution, however, raises some questions:
 - It does work for my system (Ubuntu 9.10), but will it work for others, especially Windows? It seems that GIO is also available on Win32, but it requires some testing
 - This cannot be named "Safe" file saving, as it does not create a backup first (we can call g_file_replace_contents with make_backup = TRUE, but it would not delete this backup file when the operation completes). Maybe there should be some other configuration option to use (or not to use) this setting? Or should I replace "unsafe" file saving with GIO functions instead of replacing "safe"? 
Or even more - make this option work like in GEdit (which, I suppose, uses g_file_replace_contents for both cases, with make_backup=TRUE in "safe" case), adding the corresponding checkbox to preferences dialog?
What do you think?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 40_file_saving.dpatch
Type: application/octet-stream
Size: 696 bytes
Desc: not available
URL: <http://lists.geany.org/pipermail/devel/attachments/20100330/4df0e138/attachment.obj>


More information about the Devel mailing list