Bug#284731: update-grub doesn't clean files it had wrote in /tmp
Shaul Karl
Shaul Karl <shaulk@013.net>, 284731@bugs.debian.org
Wed, 08 Dec 2004 14:25:44 +0200
Package: grub
Version: 0.95+cvs20040624-12
Severity: normal
Tags: patch
Please see bug #246284 for previous discussion.
Of course update-grub might write to /tmp. The reason is tempfile(1).
Quoting tempfile(1):
The directory to place the file is searched for in the following order:
a) The directory specified by the environment variable TMPDIR, if
it is writable.
b) The directory specified by the --directory argument, if given.
c) The directory /tmp.
I believe the following patch removes those files:
--- grub/update-grub 2004-12-08 14:18:34.000000000 +0200
+++ grub/update-grub.patched 2004-12-08 14:17:43.000000000 +0200
@@ -547,6 +547,7 @@
# Test if our menu file exists
if [ -f "$menu_file" ] ; then
menu="$menu_file"
+ rm -f "$newtemplate"
unset newtemplate
echo "found: $menu_file ."
cp -f "$menu_file" "$menu_file~"
@@ -569,6 +570,7 @@
case "$answer" in
y* | Y*)
cat "$newtemplate" > $menu_file
+ rm -f "$newtemplate"
unset newtemplate
;;
*)
@@ -795,6 +797,7 @@
# Insert the new options into the menu
if ! grep -q "^$start" $menu ; then
cat $buffer >> $menu
+ rm -f "$buffer"
else
umask 077
sed -e "/^$start/,/^$end/{
-- System Information:
Debian Release: 3.1
APT prefers testing
APT policy: (500, 'testing'), (50, 'unstable')
Architecture: i386 (i586)
Kernel: Linux 2.6.8-7.pentium1.1
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)
Versions of packages grub depends on:
ii libc6 2.3.2.ds1-18 GNU C Library: Shared libraries an
ii libncurses5 5.4-4 Shared libraries for terminal hand
-- no debconf information