Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 657462 - app-editors/leafpad truncates files opened via GVFS when saving
Summary: app-editors/leafpad truncates files opened via GVFS when saving
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: No maintainer - Look at https://wiki.gentoo.org/wiki/Project:Proxy_Maintainers if you want to take care of it
URL:
Whiteboard:
Keywords: PullRequest
Depends on:
Blocks:
 
Reported: 2018-06-06 14:15 UTC by Alexander Kurakin
Modified: 2020-05-31 10:48 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Kurakin 2018-06-06 14:15:38 UTC
Leafpad has a bug/undefined behavior saving files opened via GVFS (and maybe else situations). It truncates them (resulting file size is a 4096 bytes multiplicator as I understand).

So *data corruption is happened*.

There are different opinions if this is a Leafpad's issue or GVFS or else. But changing this to lines solves the problem [1]:

diff --git a/src/file.c b/src/file.c
index c4f50cf..08e0a1f 100644
--- a/src/file.c
+++ b/src/file.c
@@ -224,8 +224,8 @@ gint file_save_real(GtkWidget *view, FileInfo *fi)
 		return -1;
 	}
 
-	gtk_text_buffer_set_modified(buffer, FALSE);
 	fclose(fp);
+	gtk_text_buffer_set_modified(buffer, FALSE);
 	g_free(cstr);
 
 	return 0;

I think it's a Leafpad issue [2]. The author didn't reply on my message. There is no reply in GVFS conversation.

--

[1]: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=680418#29
[2]: https://github.com/stevenhoneyman/l3afpad/issues/13#issuecomment-393278934
[3]: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=680418
[4]: https://github.com/stevenhoneyman/l3afpad/issues/13
[5]: https://bugzilla.redhat.com/show_bug.cgi?id=1295007
[6]: https://bugs.launchpad.net/ubuntu/+source/leafpad/+bug/708829
[7]: https://bugs.archlinux.org/task/44681
[8]: https://bugs.launchpad.net/ubuntu/+source/gvfs/+bug/658069
[9]: https://bugs.launchpad.net/ubuntu/+source/eclipse/+bug/655434
[10]: http://forums.fedoraforum.org/showthread.php?t=249927
Comment 1 Larry the Git Cow gentoo-dev 2018-10-20 16:53:30 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2a58c0bbe20e4e31e68f826fa0197deb7ea91f9a

commit 2a58c0bbe20e4e31e68f826fa0197deb7ea91f9a
Author:     Pacho Ramos <pacho@gentoo.org>
AuthorDate: 2018-10-20 16:45:59 +0000
Commit:     Pacho Ramos <pacho@gentoo.org>
CommitDate: 2018-10-20 16:53:18 +0000

    app-editors/leafpad: Fix truncation bug (#657462 by Alexander Kurakin)
    
    Closes: https://bugs.gentoo.org/657462
    Signed-off-by: Pacho Ramos <pacho@gentoo.org>
    Package-Manager: Portage-2.3.51, Repoman-2.3.11

 .../leafpad/files/leafpad-0.8.18.1-truncate.patch  | 20 +++++++++
 app-editors/leafpad/leafpad-0.8.18.1-r1.ebuild     | 49 ++++++++++++++++++++++
 2 files changed, 69 insertions(+)
Comment 2 Alexander Kurakin 2020-05-18 13:17:50 UTC
BTW, I think we have to mask all previous versions (better late than never :)).