Bug#635020: cereal-admin create fails when /var is full, but returns 0

2011-07-21 Thread Daniel Kahn Gillmor
Package: cereal
Version: 0.24-1
Severity: normal

when /var is full, cereal-admin create fails to work.  This is
probably to be expected, but if this kind of failure happens, it
should probably bail out earlier, and it should probably return a
value other than 0.

Below is an example failure.

  --dkg

---
0 root@foo:~# cereal-admin c bar /dev/ttyUSB0 115200 bar-console bar-console
mkdir: cannot create directory `/var/lib/cereal/sessions/bar': No space left on 
device
ln: creating symbolic link `/var/lib/cereal/sessions/bar/run': No such file or 
directory
ln: creating symbolic link `/var/lib/cereal/sessions/bar/finish': No such file 
or directory
touch: cannot touch `/var/lib/cereal/sessions/bar/down': No such file or 
directory
mkdir: cannot create directory `/var/lib/cereal/sessions/bar': No space left on 
device
/usr/sbin/cereal-admin: 306: cannot create 
/var/lib/cereal/sessions/bar/env/SESSION: Directory nonexistent
/usr/sbin/cereal-admin: 306: cannot create 
/var/lib/cereal/sessions/bar/env/TTY: Directory nonexistent
/usr/sbin/cereal-admin: 306: cannot create 
/var/lib/cereal/sessions/bar/env/BAUD: Directory nonexistent
/usr/sbin/cereal-admin: 306: cannot create 
/var/lib/cereal/sessions/bar/env/USER: Directory nonexistent
/usr/sbin/cereal-admin: 306: cannot create 
/var/lib/cereal/sessions/bar/env/GROUP: Directory nonexistent
/usr/sbin/cereal-admin: 306: cannot create 
/var/lib/cereal/sessions/bar/env/LOGUSER: Directory nonexistent
/usr/sbin/cereal-admin: 306: cannot create 
/var/lib/cereal/sessions/bar/env/LOGGROUP: Directory nonexistent
mkdir: cannot create directory `/var/lib/cereal/sessions/bar': No space left on 
device
ln: creating symbolic link `/var/lib/cereal/sessions/bar/log/run': No such file 
or directory
touch: cannot touch `/var/lib/cereal/sessions/bar/log/main/current': No such 
file or directory
chmod: cannot access `/var/lib/cereal/sessions/bar/log/main/current': No such 
file or directory
chown: cannot access `/var/lib/cereal/sessions/bar/log/main': No such file or 
directory
chgrp: cannot access `/var/lib/cereal/sessions/bar/log': No such file or 
directory
mkdir: cannot create directory `/var/lib/cereal/sessions/bar': No space left on 
device
mkdir: cannot create directory `/var/lib/cereal/sessions/bar': No space left on 
device
mkfifo: cannot create fifo `/var/lib/cereal/sessions/bar/socket': No such file 
or directory
chown: cannot access `/var/lib/cereal/sessions/bar/socket': No such file or 
directory
chmod: cannot access `/var/lib/cereal/sessions/bar/socket': No such file or 
directory
Created session 'bar':
cat: /var/lib/cereal/sessions/bar/env/USER: No such file or directory
[: 306: =: argument expected
cat: /var/lib/cereal/sessions/bar/env/LOGUSER: No such file or directory
cat: /var/lib/cereal/sessions/bar/env/LOGGROUP: No such file or directory
cd: 306: can't cd to /var/lib/cereal/sessions/bar/env
cat: TTY: No such file or directory
cat: BAUD: No such file or directory
cat: USER: No such file or directory
cat: LOGGROUP: No such file or directory
?-f bar
update-service: fatal: /var/lib/cereal/sessions/bar does not exist, or is not a 
directory.

0 root@foo:~# df -h




-- System Information:
Debian Release: wheezy/sid
  APT prefers testing
  APT policy: (500, 'testing'), (200, 'unstable'), (1, 'experimental')
Architecture: i386 (i686)

Kernel: Linux 3.0.0-rc6-686-pae (SMP w/1 CPU core)
Locale: LANG=en_US.utf8, LC_CTYPE=en_US.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages cereal depends on:
ii  adduser   3.113  add and remove users and groups
ii  procmail  3.22-19Versatile e-mail processor
ii  runit 2.1.1-6.2  system-wide service supervision
ii  screen4.0.3-14   terminal multiplexor with VT100/AN

cereal recommends no packages.

cereal suggests no packages.

-- 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



Bug#635020: cereal-admin create fails when /var is full, but returns 0

2011-07-21 Thread Jameson Graef Rollins
On Thu, 21 Jul 2011 21:40:53 +0200, Daniel Kahn Gillmor 
d...@fifthhorseman.net wrote:
 when /var is full, cereal-admin create fails to work.  This is
 probably to be expected, but if this kind of failure happens, it
 should probably bail out earlier, and it should probably return a
 value other than 0.

Yes, this is definitely not right.

I can think of two ways to fix this:

- run the cereal-admin script with the sh -e option.  This would have
  caused the script to halt immediately when the initial mkdir failed,
  and return with the mkdir return code.

- explicitly check all the return of all the critical commands, such as
  particular the mkdir, but also any of the other commands that
  potentially write to /var.

The first option is certainly easiest.  I'm also partial to this method,
since I think scripts should always be run with -e (I know other feel
differently).

Any other idea or thoughts on the above appreciated.

jamie.


pgpE6B1ARfYhD.pgp
Description: PGP signature