Starting from Geany 0.18.1, saving of remote files when opened via gvfs will cause the file to be wiped.
This is a MAJOR regression stemming from this commit:
* src/document.c:
Allow saving remote files using g_file_set_contents() as well
(patch by Алексей Антипов, thanks).
I don't know who's idea or theory it was to do this but I can assure you that it is wiping files. Someone should have tested this more thoroughly.
This bug just hit me, too. I was trying to save a file opened in Nautilus with a dav:// URL.
I am using Ubuntu 9.10 in a de_DE.UTF-8 locale. Other version numbers:
geany 0.18 (built on Aug 24 2009 with GTK 2.17.7, GLib 2.21.4)
Btw. other editors (e.g. gvim) also have problems saving to a dav:// URL, but they do not blank the file. gedit works just fine here.
Yes, this has happened to me too, every time that I try to save a remote file in Geany that I am connected to through FTP via .gvfs it effectively wipes it out. The only time that I do not end up with a 0 byte file after a save is if I am creating the file for the first time, but every subsequent time will produce the problem. If I "save as" an already existing file and change the name it will save the file properly too.
This has happened to me on 3 completely different hosts using FTP via .gvfs every time I save an existing file from within Geany.
It does not seem to happen when I am connected through SSH.
My environment:
geany 0.18 (built on Aug 20 2009 with GTK 2.16.1, GLib 2.20.1)
Ubuntu 9.04
When trying to save I get a GTK error dialogue:
"Error saving file. Input/output error"
Then I can inspect the file from Nautilus and see that it is 0 bytes, it also is empty when trying to re-open in Geany or Gedit.
And running geany with the -v option shows:
(geany:10600): Gtk-WARNING **: Operation not supported by backend
(geany:10600): Gtk-WARNING **: Operation not supported by backend
(geany:10600): Gtk-WARNING **: Operation not supported by backend
Hope somebody fixes this as I love Geany, and I do a lot of work for clients who use FTP. Thanks much!
I figured out that theres a hidden settings in ~/.config/geany called "use_safe_file_saving"
just change it to use_safe_file_saving=true and it should work for ssh://.
This setting should definitely be on by default.
SSH worked fine before, the problem (at least in my case) is FTP through gvfs. I changed that setting to true, but it did not affect the FTP bug. When using FTP through gvfs I still end up with a 0 byte file after saving in Geany.
After using Scite and cp, and having the same failure, this really seems more like a gvfs problem.
Maybe this:
https://bugs.launchpad.net/ubuntu/+source/gvfs/+bug/493716?comments=all
You are talking about different problems.
rhift's problem is a GVfs bug which is known and exists since a long time, it's not Geany's fault GVfs has problems with some FTP servers. Better to not use FTP anyway. See https://bugzilla.gnome.org/show_bug.cgi?id=585992.
jazzor's bug seems actually to be a regression. Sorry for that. I'll look a bit deeper into this soon.
Hi!
As I'm the author of that patch, I'd like to explain some things.
First, please consider the following GVFS issues: https://bugzilla.gnome.org/show_bug.cgi?id=608910 and https://bugzilla.gnome.org/show_bug.cgi?id=608908. The first one seems exactly the same as explained here. Both appear to happen when using low-level file API (fopen(), fprintf() etc.).
The solution to use higher-level API (g_file_set_contents) seems to deal with it, re-writing the whole file. If there are issues with this (when running Geany with use_safe_file_saving=true on remote filesystems), please provide some moredetailed information, i.e. target folder and file permissions and backend type. I have tested this with sftp:// and smb:// backends (after having lost some data without use_safe_file_saving:()
Second, it seems that at least gedit uses GIO API (GFile) that should work OK "by design". Though "Using the GIO API would require GLib 2.16. Currently we depend on 2.8." (see http://lists.uvena.de/geany-devel/2010-March/002079.html\).
IMHO the use of GIO API is probably the best solution here, though there should be an agreement between the developers. If you are interested and are using GLib>=2.16, I can send you another patch that makes Geany use GIO for file saving.
Please feel free to contact me at 1a_antipov<at>mail.ru
File saving has changed since this was last actioned, does it still cause problems with use_atomic_file_saving off?