Package: moreutils
Version: 0.47
Severity: normal

Dear Maintainer,

I have found what seems to be a bug in "sponge", which does not propagate the
write error when writing to its output file, failing silently.

   * What led up to the situation?

$ echo  | sponge /dev/full && echo OK
OK

   * What exactly did you do (or not do) that was effective (or
     ineffective)?

   * What was the outcome of this action?

It could not obviously write to /dev/full, but returned EXIT_SUCESS.

   * What outcome did you expect instead?

I would expect it to return a non-zero return value and a message.

   * Debug details

$ echo | strace sponge /dev/full
[...]
open("/dev/full", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 4
lseek(3, 0, SEEK_SET)                   = 0
read(3, "\n", 8192)                     = 1
fstat(4, {st_mode=S_IFCHR|0666, st_rdev=makedev(1, 7), ...}) = 0
ioctl(4, SNDCTL_TMR_TIMEBASE or TCGETS, 0x7fff7e925e80) = -1 ENOTTY
(Inappropriate ioctl for device)
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) =
0x7f8e389b8000
read(3, "", 8192)                       = 0
close(3)                                = 0
munmap(0x7f8e389b9000, 4096)            = 0
write(4, "\n", 1)                       = -1 ENOSPC (No space left on device)
close(4)                                = 0
munmap(0x7f8e389b8000, 4096)            = 0
rt_sigprocmask(SIG_BLOCK, [HUP INT QUIT PIPE ALRM TERM XCPU XFSZ VTALRM PROF
IO], [], 8) = 0
unlink("/tmp/sponge.wsOZkV")            = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
exit_group(0)                           = ?
[...]

As you can see, the write() fails but the error is not propagated.

I think this issue is potentially (although remotely probably) serious since
sponge lends itself to be used to automatically edit files, but it will thrash
them if the concerning filesystem happens to become full during the editing.

Thank you.

Raúl Salinas



-- System Information:
Debian Release: 7.0
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.2.0-1-amd64 (SMP w/2 CPU cores)
Locale: LANG=eo.UTF-8, LC_CTYPE=eo.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages moreutils depends on:
ii  libc6            2.13-38
ii  libipc-run-perl  0.92-1
ii  perl             5.14.2-19

moreutils recommends no packages.

Versions of packages moreutils suggests:
pn  libtime-duration-perl  <none>
ii  libtimedate-perl       1.2000-1

-- no debconf information


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to