Hello,
I have recently faced a problem when Geany seemed to corrupt my files over GVFS. The issues were as follows: 1. Saving a modified text file (removing 1 line) over Samba (gvfsd-smb): - geany: makes a mess at the end of file - gedit: all OK 2. Saving a modified text file over SFTP (gvfsd-sftp): - geany: makes a file empty (0 bytes), e.g. all content is lost - gedit: all OK It seems that this bug is more GVFS-related than Geany's ('cause low-level utils like cat and echo also have some strange behaviour, which is not reproducible over shares mounted with mount.cifs), so I'm going to file these to GVFS bug tracker. But it also seems that g_file_set_contents works OK. I have found out that Geany is able to use g_file_set_contents (with use_save_file_saving=true), but on local files only. So I suggest: 1. Patching src/document.c to allow g_file_set_contents on both local and remote files: --- ./src/document.c 2010-02-03 21:01:27.000000000 +0300 +++ ./src/document.c 2010-02-03 20:59:37.000000000 +0300 @@ -1691,10 +1691,8 @@ g_return_val_if_fail(doc != NULL, g_strdup(g_strerror(EINVAL))); g_return_val_if_fail(data != NULL, g_strdup(g_strerror(EINVAL)));
- /* we never use g_file_set_contents() for remote files as Geany only writes such files - * 'into' the Fuse mountpoint, the file itself is then written by GVfs on the target - * remote filesystem. */ - if (! file_prefs.use_safe_file_saving || doc->priv->is_remote) + // GVFS can be buggy, so let user choose the behaviour + if (! file_prefs.use_safe_file_saving )//|| doc->priv->is_remote) { fp = g_fopen(locale_filename, "wb"); if (G_UNLIKELY(fp == NULL))
2. (Possibly, but not necessarily) make this option (use_save_file_saving) accessible through the GUI If someone's interested, here's my configuration: Geany 0.19 svn >= r4637 Gnome 2.28.1 (gvfs 1.4.2)
On Wed, 03 Feb 2010 21:03:12 +0300, Алексей wrote:
Hello,
I have recently faced a problem when Geany seemed to corrupt my files over GVFS. The issues were as follows:
- Saving a modified text file (removing 1 line) over Samba
(gvfsd-smb):
- geany: makes a mess at the end of file
- gedit: all OK
- Saving a modified text file over SFTP (gvfsd-sftp):
- geany: makes a file empty (0 bytes), e.g. all content is lost
- gedit: all OK
It seems that this bug is more GVFS-related than Geany's ('cause low-level utils like cat and echo also have some strange behaviour, which is not reproducible over shares mounted with mount.cifs), so I'm going to file these to GVFS bug tracker. But it also seems that g_file_set_contents works OK. I have found out that Geany is able to use g_file_set_contents (with use_save_file_saving=true), but on local files only. So I suggest:
- Patching src/document.c to allow g_file_set_contents on both local
and remote files:
That's probably ok. IIRC the main reason why I disabled g_file_set_contents() for remote files was that GVfs does for remote files the same thing the option in Geany provides: first saving to a temporary file and then move the temporary file to the target file. I didn't assume g_file_set_contents would make any difference for remote files. OTOH I know that the GVfs-Fuse backend isn't that stable and has lots of bugs, especially with some FTP servers. If there are no objections, I'll apply the patch soon.
- (Possibly, but not necessarily) make this option
(use_save_file_saving) accessible through the GUI
Really? I think this would cause mainly just confusion. It just isn't that easy to explain what's the story behind this option. No idea.
Regards, Enrico
- (Possibly, but not necessarily) make this option
(use_save_file_saving) accessible through the GUI
Really? I think this would cause mainly just confusion. It just isn't that easy to explain what's the story behind this option. No idea.
Alright; IMHO, all the configuration options should be documented somewhere (I've found this one only while looking through the code), but it's not a question of that issue.
-----Original Message----- From: Enrico Tr?ger enrico.troeger@uvena.de To: geany-devel@uvena.de Date: Thu, 4 Feb 2010 22:06:08 +0100 Subject: Re: [Geany-devel] Safe file saving
On Wed, 03 Feb 2010 21:03:12 +0300, Алексей wrote:
Hello,
I have recently faced a problem when Geany seemed to corrupt my files over GVFS. The issues were as follows:
- Saving a modified text file (removing 1 line) over Samba
(gvfsd-smb):
- geany: makes a mess at the end of file
- gedit: all OK
- Saving a modified text file over SFTP (gvfsd-sftp):
- geany: makes a file empty (0 bytes), e.g. all content is lost
- gedit: all OK
It seems that this bug is more GVFS-related than Geany's ('cause low-level utils like cat and echo also have some strange behaviour, which is not reproducible over shares mounted with mount.cifs), so I'm going to file these to GVFS bug tracker. But it also seems that g_file_set_contents works OK. I have found out that Geany is able to use g_file_set_contents (with use_save_file_saving=true), but on local files only. So I suggest:
- Patching src/document.c to allow g_file_set_contents on both local
and remote files:
That's probably ok. IIRC the main reason why I disabled g_file_set_contents() for remote files was that GVfs does for remote files the same thing the option in Geany provides: first saving to a temporary file and then move the temporary file to the target file. I didn't assume g_file_set_contents would make any difference for remote files. OTOH I know that the GVfs-Fuse backend isn't that stable and has lots of bugs, especially with some FTP servers. If there are no objections, I'll apply the patch soon.
- (Possibly, but not necessarily) make this option
(use_save_file_saving) accessible through the GUI
Really? I think this would cause mainly just confusion. It just isn't that easy to explain what's the story behind this option. No idea.
Regards, Enrico
-- Get my GPG key from http://www.uvena.de/pub.asc
ATTACHMENT: application/pgp-signature
Тесты новейших гаджетов на Hi-tech.Mail.Ru http://r.mail.ru/cln5823/hi-tech.mail.ru/
Am Freitag, den 05.02.2010, 12:14 +0300 schrieb Алексей Антипов:
- (Possibly, but not necessarily) make this option
(use_save_file_saving) accessible through the GUI
Really? I think this would cause mainly just confusion. It just isn't that easy to explain what's the story behind this option. No idea.
Alright; IMHO, all the configuration options should be documented somewhere (I've found this one only while looking through the code), but it's not a question of that issue.
I'd suggest to make this a hidden setting. Those already are documented: http://geany.org/manual/#hidden-preferences
General documentation for the preferences dialog also is available:
Best Regards, Dominic
On Fri, 05 Feb 2010 18:40:38 +0100, Dominic wrote:
Am Freitag, den 05.02.2010, 12:14 +0300 schrieb Алексей Антипов:
- (Possibly, but not necessarily) make this option
(use_save_file_saving) accessible through the GUI
Really? I think this would cause mainly just confusion. It just isn't that easy to explain what's the story behind this option. No idea.
Alright; IMHO, all the configuration options should be documented somewhere (I've found this one only while looking through the code), but it's not a question of that issue.
I'd suggest to make this a hidden setting. Those already are
It is already.
documented: http://geany.org/manual/#hidden-preferences
All hidden preferences are already documented in the manual, this is also true for the mentioned use_save_file_saving setting, see the link above.
Regards, Enrico
On Wed, 03 Feb 2010 21:03:12 +0300, Алексей wrote:
Hello,
I have recently faced a problem when Geany seemed to corrupt my files over GVFS. The issues were as follows:
- Saving a modified text file (removing 1 line) over Samba
(gvfsd-smb):
- geany: makes a mess at the end of file
- gedit: all OK
- Saving a modified text file over SFTP (gvfsd-sftp):
- geany: makes a file empty (0 bytes), e.g. all content is lost
- gedit: all OK
It seems that this bug is more GVFS-related than Geany's ('cause low-level utils like cat and echo also have some strange behaviour, which is not reproducible over shares mounted with mount.cifs), so I'm going to file these to GVFS bug tracker. But it also seems that g_file_set_contents works OK. I have found out that Geany is able to use g_file_set_contents (with use_save_file_saving=true), but on local files only. So I suggest:
- Patching src/document.c to allow g_file_set_contents on both local
and remote files:
Committed, thanks.
Regards, Enrico