Package: moreutils
Version: 0.26
Severity: grave
Tags: patch
If TMPDIR lives on a filesystem that is full, vidir will be able to open
a temp file, but not write to it. The user will then be presented with an
empty file, and if they leave their editor, vidir will act as if all
lines were deleted, and attempt to rm every file.
(I hesitate to use "grave" for one small program in a package with many
others, but this could cause some severe data loss. I was saved by the
fact that vidir does not attempt to recursively delete directories.)
I fixed this by checking the return value of close as well (see trivial
patch). You might want to change the first die to "cannot create" or
something like that to distinguish between the two different sorts of
errors that can happen.
-- System Information:
Debian Release: lenny/sid
APT prefers unstable
APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)
Kernel: Linux 2.6.24-rc5 (PREEMPT)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash
Versions of packages moreutils depends on:
ii libc6 2.7-5 GNU C Library: Shared libraries
ii perl 5.8.8-12 Larry Wall's Practical Extraction
moreutils recommends no packages.
-- no debconf information
--- /usr/bin/vidir 2007-11-28 14:37:45.000000000 -0500
+++ /home/decklin/bin/vidir 2008-02-02 16:02:03.000000000 -0500
@@ -102,7 +102,7 @@
print OUT "$c\t$_\n";
}
@dir=();
-close OUT;
+close OUT || die "$0: cannot write ".$tmp->filename.": $!\n";
my @editor="vi";
if (-x "/usr/bin/editor") {