FS#44681 - [leafpad] wipes file content when saving on gvfs
Attached to Project:
Arch Linux
Opened by Vizitor (Vizitor) - Tuesday, 21 April 2015, 17:45 GMT
Last edited by Christian Hesse (eworm) - Saturday, 05 August 2017, 18:06 GMT
Opened by Vizitor (Vizitor) - Tuesday, 21 April 2015, 17:45 GMT
Last edited by Christian Hesse (eworm) - Saturday, 05 August 2017, 18:06 GMT
|
Details
Description:
When editing text file on samba shares, after saving AND exiting leafpad, complete text (you see that when opening again, with leafpad or other txt editor) is wiped out. I rarely use leafpad over LAN files, and can roughly say that last year 10/2014, there was no this bug. Additional info: * package version(s) 0.8.18.1 * config and/or log files etc. 3.19.3-3-ARCH x86_64, Mate Desktop, everything regular without any special modifications. Steps to reproduce: Open some text file with leafpad (make backup first!) on some of the samba shared text files over your LAN; type few letters for testing, save and exit. Now, open it again - file is completely blank - no text at all. |
This task depends upon
Closed by Christian Hesse (eworm)
Saturday, 05 August 2017, 18:06 GMT
Reason for closing: Fixed
Additional comments about closing: leafpad 0.8.18.1-7
Saturday, 05 August 2017, 18:06 GMT
Reason for closing: Fixed
Additional comments about closing: leafpad 0.8.18.1-7
If you reverse lines 232 & 233 in src/file.c so that it becomes:
fclose(fp);
gtk_text_buffer_set_modified(buffer, FALSE);
and recompile it seems to fix the bug - the files save correctly. I think the above change still makes sense logically? There must be some issue between GVFS and gtk_text_buffer_set_modified where the buffer is lost.
BTW, after Benny mention GVFS, I noticed that (with all those buggy versions) error ocures only if samba shares is mounted through file manager (which uses gvfs).
If I mount SAME LOCATION of Samba Share with "mount -t cifs //192.168.10.15/Volume_1 /mnt/v1 -o guest,sec=ntlm"
and then open some file, let's say "leafpad /mnt/v1/some_text_file" blanking/erasing text, does not occure.
Can you explain briefly why the line gtk_text_buffer_set_modified(buffer,FALSE); should go where you put it rather than where I suggested? I'm not a C or GTK programmer, but am learning. Why does the bug only appear on GVFS, not when saving locally? Cheers.
Not sure why the original code works for regular filesystems but fails for gvfs. Probably undefined and/or racy behaviour.
https://people.gnome.org/~shaunm/girdoc/C/Gtk.TextBuffer.set_modified.html