GNU bug report logs - #20595
24.4; Data lost when modifying file on filesystem with no space left on device / disc full

Previous Next

Package: emacs;

Reported by: Matthew Blissett <mailgateway <at> blissett.me.uk>

Date: Sun, 17 May 2015 17:50:03 UTC

Severity: important

Tags: confirmed

Found in version 24.4

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 20595 in the body.
You can then email your comments to 20595 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#20595; Package emacs. (Sun, 17 May 2015 17:50:04 GMT) Full text and rfc822 format available.

Acknowledgement sent to Matthew Blissett <mailgateway <at> blissett.me.uk>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sun, 17 May 2015 17:50:04 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Matthew Blissett <mailgateway <at> blissett.me.uk>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.4;
 Data lost when modifying file on filesystem with no space left on
 device / disc full
Date: Sun, 17 May 2015 11:52:47 +0000
I attempted to edit a file on the filesystem containing $HOME, with no
space left (for non-root users).

Filesystem           1B-blocks            Used Available Use% Mounted on
/dev/sdb1      105,559,908,352 104,591,810,560         0 100% /home

When I saved the file (C-x C-s) Emacs gave the error "Write error: no
space left on device, /home", so I quit (C-x C-c), pressed "n" to not
save the file, and "yes" to exit with a modified buffer.  I expected the
original file to exist, but instead I have three zero-byte files:

-rwx------ 1 matt users     0 2015-05-17 11:57 script~
-rwxr-xr-x 1 matt users     0 2015-05-17 11:57 script
-rwxr-xr-x 1 matt users     0 2015-05-17 11:58 #script#

Example steps to reproduce:

dd if=/dev/zero of=small bs=1M count=10
mkfs.ext4 small
sudo mount -o loop small /mnt
sudo dd if=/dev/zero of=/mnt/85pc bs=1k count=8500
man man | sudo tee /mnt/man > /dev/null
sudo mkdir /mnt/.emacs.d
sudo chown -R $USER /mnt
HOME=/mnt emacs /mnt/man

(Edit the file, attempt to save, then exit discarding changes.)

ls -lAr /mnt

/mnt:
total 8,718,336
-rw-r--r-- 1 matt root  8,704,000 2015-05-17 11:31 85pc
drwxr-xr-x 2 matt root      1,024 2015-05-17 11:31 .emacs.d
drwx------ 2 matt root     12,288 2015-05-17 11:31 lost+found
-rw-r--r-- 1 matt root          0 2015-05-17 11:31 man
-rw-r--r-- 1 matt users         0 2015-05-17 11:31 #man#
-rw------- 1 matt users         0 2015-05-17 11:31 man~

/mnt/.emacs.d:
total 0
-rw------- 1 matt users 0 2015-05-17 11:31 %backup%~

I'd expect /mnt/man to be unchanged, or at minimum one of /mnt/man~ or
~/.emacs.d/%backup%~ to contain the original file's contents.

Cheers,

Matt



In GNU Emacs 24.4.1 (arm-unknown-linux-gnueabihf)
 of 2014-12-19 on henze, modified by Debian
System Description:	Debian GNU/Linux 8.0 (jessie)

Configured using:
 `configure --build arm-linux-gnueabihf --prefix=/usr
 --sharedstatedir=/var/lib --libexecdir=/usr/lib
 --localstatedir=/var/lib --infodir=/usr/share/info
 --mandir=/usr/share/man --with-pop=yes
 --enable-locallisppath=/etc/emacs24:/etc/emacs:/usr/local/share/emacs/24.4/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.4/site-lisp:/usr/share/emacs/site-lisp
 --build arm-linux-gnueabihf --prefix=/usr --sharedstatedir=/var/lib
 --libexecdir=/usr/lib --localstatedir=/var/lib
 --infodir=/usr/share/info --mandir=/usr/share/man --with-pop=yes
 --enable-locallisppath=/etc/emacs24:/etc/emacs:/usr/local/share/emacs/24.4/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.4/site-lisp:/usr/share/emacs/site-lisp
 --with-x=no --without-gconf --without-gsettings 'CFLAGS=-g -O2
 -fstack-protector-strong -Wformat -Werror=format-security -Wall'
 CPPFLAGS=-D_FORTIFY_SOURCE=2 LDFLAGS=-Wl,-z,relro'

Important settings:
  value of $LANG: en_GB.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Fundamental

Minor modes in effect:
  tooltip-mode: t
  electric-indent-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
ESC [ > 0 ; 1 1 5 ; 0 c C-x C-f DEL DEL / t m p / x 
DEL TAB TAB y RET C-x b RET RET C-x C-s C-x C-k RET 
n C-x k RET y e s RET ESC x r e p - e - b TAB RET

Recent messages:
Loading 00debian-vars...done
Loading /etc/emacs/site-start.d/50puppet-el.el (source)...done
For information about GNU Emacs and the GNU system, type C-h C-a.
Making completion list...
Saving file /mnt/man...
Cannot write backup file; backing up in ~/.emacs.d/%backup%~
basic-save-buffer-2: Write error: no space left on device, /mnt/man
No keyboard macro defined.  Create one? (y or n) n
Quit

Load-path shadows:
/usr/share/emacs/24.4/site-lisp/debian-startup hides /usr/share/emacs/site-lisp/debian-startup
/usr/share/emacs/24.4/site-lisp/puppet-el/puppet-mode hides /usr/share/emacs/site-lisp/puppet-mode

Features:
(shadow sort gnus-util mail-extr emacsbug message format-spec rfc822 mml
mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev
gmm-utils mailheader sendmail regexp-opt rfc2047 rfc2045 ietf-drums
mm-util help-fns mail-prsvr mail-utils edmacro cl-loaddefs cl-lib kmacro
help-mode easymenu image xterm time-date tooltip electric uniquify
ediff-hook vc-hooks lisp-float-type tabulated-list newcomment lisp-mode
prog-mode register page menu-bar rfn-eshadow timer select mouse jit-lock
font-lock syntax facemenu font-core frame cham georgian utf-8-lang
misc-lang vietnamese tibetan thai tai-viet lao korean japanese hebrew
greek romanian slovak czech european ethiopic indian cyrillic chinese
case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer nadvice
loaddefs button faces cus-face macroexp files text-properties overlay
sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote make-network-process dbusbind
gfilenotify multi-tty emacs)

Memory information:
((conses 8 76608 7488)
 (symbols 24 17393 0)
 (miscs 20 35 135)
 (strings 16 10778 7177)
 (string-bytes 1 311082)
 (vectors 8 14096)
 (vector-slots 4 1145426 57182)
 (floats 8 65 408)
 (intervals 28 226 29)
 (buffers 512 13)
 (heap 1024 7950 543))




Added tag(s) confirmed. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Wed, 20 May 2015 15:52:02 GMT) Full text and rfc822 format available.

Reply sent to Paul Eggert <eggert <at> cs.ucla.edu>:
You have taken responsibility. (Sat, 30 May 2015 06:26:02 GMT) Full text and rfc822 format available.

Notification sent to Matthew Blissett <mailgateway <at> blissett.me.uk>:
bug acknowledged by developer. (Sat, 30 May 2015 06:26:05 GMT) Full text and rfc822 format available.

Message #12 received at 20595-done <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Matthew Blissett <mailgateway <at> blissett.me.uk>
Cc: 20595-done <at> debbugs.gnu.org
Subject: Re: 24.4; Data lost when modifying file on filesystem with no space
 left on device / disc full
Date: Fri, 29 May 2015 23:24:56 -0700
[Message part 1 (text/plain, inline)]
Thank you for reporting this, and for the recipe for reproducing this important 
bug in Emacs.  I installed the attached patches into the GNU Emacs master to fix 
the problem.  The 1st patch doesn't actually fix the bug, but it fixes some 
related ones.  The 2nd patch fixes the bug -- at least, it worked for me on your 
test case.  I generated the 2nd patch with "diff -b" so its indenting won't 
match the source code; you can pick up the full gory details in savannah git 
master, around commit ab27722721afca4647a7eec0933ac9209e0eac30.
[0001-copy-file-now-truncates-output-after-writing.patch (text/x-patch, attachment)]
[bugfix.patch (text/x-patch, attachment)]

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 27 Jun 2015 11:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 10 years ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.