Bug#373099: cron-apt: could handle full /tmp in a more graceful way
Ola Lundqvist wrote: Thanks for the patch. However I think it will only work with bash, and cron-apt uses /bin/sh as shell. Or do other shells handle $(()) ? Using $(( expression )) is okay for POSIX shells and /bin/sh. Here is a documentation pointer. http://www.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html#tag_02_06_04 Do you also need as much as 10MB in /tmp? I disagree with the premise behind this however. I think trying to predict the space needed is not the best way. I think if /tmp is full and the output cannot be written that that problem should be treated as an error and reported at the point that the output cannot be written. I would much rather see something such as that instead of trying to guess at how much space is needed. Setting an arbitrary size will always be incorrect. The question I have is what should be done when a failure is noted. If the script can simply exit with an error then setting 'set -e' might be the simplest way to address this issue. It would take careful review to ensure that the script is ready for that though. Personally I prefer to check each command as it goes. Bob -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]
Bug#373099: cron-apt: could handle full /tmp in a more graceful way
Hi On Sun, Jul 29, 2007 at 02:37:25AM -0600, Bob Proulx wrote: Ola Lundqvist wrote: Thanks for the patch. However I think it will only work with bash, and cron-apt uses /bin/sh as shell. Or do other shells handle $(()) ? Using $(( expression )) is okay for POSIX shells and /bin/sh. Here is a documentation pointer. http://www.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html#tag_02_06_04 Really good to know! Thanks. Do you also need as much as 10MB in /tmp? I disagree with the premise behind this however. I think trying to predict the space needed is not the best way. I think if /tmp is full and the output cannot be written that that problem should be treated as an error and reported at the point that the output cannot be written. I would much rather see something such as that instead of trying to guess at how much space is needed. Setting an arbitrary size will always be incorrect. True. The question I have is what should be done when a failure is noted. If the script can simply exit with an error then setting 'set -e' might be the simplest way to address this issue. It would take careful review to ensure that the script is ready for that though. Personally I prefer to check each command as it goes. I think I change this so that it shecks that there are any free space on the device, or actually that free space is configurable value. This way the admin can choose this value, which is better than hard coded. But I agree that we should check each command in most cases. Best regards, // Ola Bob -- --- Ola Lundqvist systemkonsult --- M Sc in IT Engineering / [EMAIL PROTECTED] Annebergsslingan 37\ | [EMAIL PROTECTED] 654 65 KARLSTAD| | http://opalsys.net/ Mobile: +46 (0)70-332 1551 | \ gpg/f.p.: 7090 A92B 18FE 7994 0C36 4FE4 18A1 B1CF 0FE5 3DD9 / --- -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]
Bug#373099: cron-apt: could handle full /tmp in a more graceful way
On Mon, Jun 12, 2006 at 10:52:20PM +0200, Ola Lundqvist wrote: On Mon, Jun 12, 2006 at 09:22:15PM +0200, Marc Haber wrote: cron-apt could check for free space on /tmp in the beginning and print a more meaningful error message if, say, less than 10 MB is free. This will still break if /tmp fills up while cron-apt is running though. I Agree. Let's see what I can do about it. See attached, untested patch. Greetings Marc -- - Marc Haber | I don't trust Computers. They | Mailadresse im Header Mannheim, Germany | lose things.Winona Ryder | Fon: *49 621 72739834 Nordisch by Nature | How to make an American Quilt | Fax: *49 621 72739835 --- cron-apt.orig 2007-07-28 09:08:16.0 +0200 +++ cron-apt2007-07-28 09:26:10.0 +0200 @@ -142,7 +142,11 @@ CONFIGDIRNAME=$(echo $CONFIG | sed 's|/|_-_|g') TMPDIR=$(mktemp -d -t cron-apt.XX) if [ $? -ne 0 ]; then -echo Error: Can not create a safe temporary directory. +echo 2 Error: Can not create a safe temporary directory. +exit 1 +fi +if [ $(( $(stat --file-system --format=%S $TMPDIR) * $(stat --file-system --format=%a $TMPDIR) / 1024 )) -lt 1 ]; then +echo 2 Error: Not enough free space in $TMPDIR. exit 1 fi
Bug#373099: cron-apt: could handle full /tmp in a more graceful way
Hi Marc Thanks for the patch. However I think it will only work with bash, and cron-apt uses /bin/sh as shell. Or do other shells handle $(()) ? Do you also need as much as 10MB in /tmp? Best regards, // Ola On Sat, Jul 28, 2007 at 09:26:57AM +0200, Marc Haber wrote: On Mon, Jun 12, 2006 at 10:52:20PM +0200, Ola Lundqvist wrote: On Mon, Jun 12, 2006 at 09:22:15PM +0200, Marc Haber wrote: cron-apt could check for free space on /tmp in the beginning and print a more meaningful error message if, say, less than 10 MB is free. This will still break if /tmp fills up while cron-apt is running though. I Agree. Let's see what I can do about it. See attached, untested patch. Greetings Marc -- - Marc Haber | I don't trust Computers. They | Mailadresse im Header Mannheim, Germany | lose things.Winona Ryder | Fon: *49 621 72739834 Nordisch by Nature | How to make an American Quilt | Fax: *49 621 72739835 --- cron-apt.orig 2007-07-28 09:08:16.0 +0200 +++ cron-apt 2007-07-28 09:26:10.0 +0200 @@ -142,7 +142,11 @@ CONFIGDIRNAME=$(echo $CONFIG | sed 's|/|_-_|g') TMPDIR=$(mktemp -d -t cron-apt.XX) if [ $? -ne 0 ]; then -echo Error: Can not create a safe temporary directory. +echo 2 Error: Can not create a safe temporary directory. +exit 1 +fi +if [ $(( $(stat --file-system --format=%S $TMPDIR) * $(stat --file-system --format=%a $TMPDIR) / 1024 )) -lt 1 ]; then +echo 2 Error: Not enough free space in $TMPDIR. exit 1 fi -- --- Ola Lundqvist systemkonsult --- M Sc in IT Engineering / [EMAIL PROTECTED] Annebergsslingan 37\ | [EMAIL PROTECTED] 654 65 KARLSTAD| | http://opalsys.net/ Mobile: +46 (0)70-332 1551 | \ gpg/f.p.: 7090 A92B 18FE 7994 0C36 4FE4 18A1 B1CF 0FE5 3DD9 / --- -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]
Bug#373099: cron-apt: could handle full /tmp in a more graceful way
On Sat, Jul 28, 2007 at 12:07:37PM +0200, Ola Lundqvist wrote: Thanks for the patch. However I think it will only work with bash, and cron-apt uses /bin/sh as shell. Or do other shells handle $(()) ? I do not have any idea about that. However, we need to calculate things since stat returns its output in blocks. Do you also need as much as 10MB in /tmp? That's just a guess how many space cron-apt needs. Having 10 MB free allows cron-apt to complete even if other apps write stuff to /tmp whil cron-apt runs. Feel free to change. Greetings Marc -- - Marc Haber | I don't trust Computers. They | Mailadresse im Header Mannheim, Germany | lose things.Winona Ryder | Fon: *49 621 72739834 Nordisch by Nature | How to make an American Quilt | Fax: *49 3221 2323190 -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]
Bug#373099: cron-apt: could handle full /tmp in a more graceful way
Package: cron-apt Version: 0.4.6 Severity: wishlist When /tmp runs out of space, cron-apt sends an empty report message and prints some error messages on stderr, which gets mailed to the user in a cron message. cron-apt could check for free space on /tmp in the beginning and print a more meaningful error message if, say, less than 10 MB is free. This will still break if /tmp fills up while cron-apt is running though. Greetings Marc -- System Information: Debian Release: testing/unstable APT prefers unstable APT policy: (500, 'unstable'), (500, 'stable') Architecture: i386 (i686) Shell: /bin/sh linked to /bin/bash Kernel: Linux 2.6.17-rc6-zgsrv Locale: LANG=C, LC_CTYPE=de_DE (charmap=ISO-8859-1) Versions of packages cron-apt depends on: ii apt 0.6.44.1 Advanced front-end for dpkg ii debianutils 2.16.1 Miscellaneous utilities specific t Versions of packages cron-apt recommends: ii liblockfile1 1.06.1 NFS-safe locking library, includes ii mailx1:8.1.2-0.20050715cvs-1 A simple mail user agent -- no debconf information -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]
Bug#373099: cron-apt: could handle full /tmp in a more graceful way
Hi On Mon, Jun 12, 2006 at 09:22:15PM +0200, Marc Haber wrote: Package: cron-apt Version: 0.4.6 Severity: wishlist When /tmp runs out of space, cron-apt sends an empty report message and prints some error messages on stderr, which gets mailed to the user in a cron message. cron-apt could check for free space on /tmp in the beginning and print a more meaningful error message if, say, less than 10 MB is free. This will still break if /tmp fills up while cron-apt is running though. I Agree. Let's see what I can do about it. Regards, // Ola Greetings Marc -- System Information: Debian Release: testing/unstable APT prefers unstable APT policy: (500, 'unstable'), (500, 'stable') Architecture: i386 (i686) Shell: /bin/sh linked to /bin/bash Kernel: Linux 2.6.17-rc6-zgsrv Locale: LANG=C, LC_CTYPE=de_DE (charmap=ISO-8859-1) Versions of packages cron-apt depends on: ii apt 0.6.44.1 Advanced front-end for dpkg ii debianutils 2.16.1 Miscellaneous utilities specific t Versions of packages cron-apt recommends: ii liblockfile1 1.06.1 NFS-safe locking library, includes ii mailx1:8.1.2-0.20050715cvs-1 A simple mail user agent -- no debconf information -- - Ola Lundqvist --- / [EMAIL PROTECTED] Annebergsslingan 37 \ | [EMAIL PROTECTED] 654 65 KARLSTAD | | +46 (0)54-10 14 30 +46 (0)70-332 1551 | | http://www.opal.dhs.org UIN/icq: 4912500 | \ gpg/f.p.: 7090 A92B 18FE 7994 0C36 4FE4 18A1 B1CF 0FE5 3DD9 / --- -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]