leafpad erases files over SMB

Bug #1542096 reported by Mark Bertolina
20
This bug affects 4 people
Affects Status Importance Assigned to Milestone
leafpad (Debian)
New
Unknown
leafpad (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

Whenever you edit a text file on an SMB share, leafpad erases the entire file instead of saving your edits. I mention this to the lubuntu group, since leafpad is the default program associated with file extensions such as .txt and thus very likely to be where new users start editing such files. But in fact, they will be silently erasing those files contents. No other applications seem to have this problem over the SMB share, and I tested to 2 different smb shares, one a NAS4Free server running samba, the other a commercial NAS .

As a work around I uninstalled leafpad and installed mousepad, then associated files types with mousepad. I encourage the lubuntu group to look into fixing this issue in Leafpad, or switching the default graphical text editor to something else.
sudo apt-get remove leafpad
sudo apt-get install mousepad

Leafpad doesn't seem to be under much development lately, though I have not contacted the author:
http://tarot.freeshell.org/leafpad/

Others have noticed this problem with leafpad in general:

FS#44681 - [leafpad] wipest content of text files on smb when saving
https://bugs.archlinux.org/task/44681

Samba erases content of files when saving
http://unix.stackexchange.com/questi...es-when-saving

I am happy to help test this problem further, just drop me a line. If there is a better place for me to post this info / request let me know.
Mark Bertolina

ProblemType: Bug
DistroRelease: Ubuntu 15.10
Package: leafpad 0.8.18.1-4
ProcVersionSignature: Ubuntu 4.2.0-27.32-generic 4.2.8-ckt1
Uname: Linux 4.2.0-27-generic x86_64
ApportVersion: 2.19.1-0ubuntu5
Architecture: amd64
Date: Thu Feb 4 18:29:30 2016
ProcEnviron:
 LANGUAGE=en_US
 TERM=xterm
 PATH=(custom, no user)
 LANG=en_US.UTF-8
 SHELL=/bin/bash
SourcePackage: leafpad
UpgradeStatus: No upgrade log present (probably fresh install)

Revision history for this message
Mark Bertolina (u-mark-5) wrote :
Revision history for this message
hippieshaker (bladeboy2000au) wrote :

I confirmed this happens on SFTP connections as well as SMB, and seems to only occur on text files less than 4096 bytes. Yes this is a dangerous bug - I was just lucky to notice before losing important notes.

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.

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in leafpad (Ubuntu):
status: New → Confirmed
Juhani Numminen (jsonic)
tags: added: patch
Changed in leafpad (Debian):
status: Unknown → New
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.