Package: dash
Version: 0.5.5.1-7.2
Severity: grave

Any calls to system() invokes 

sh -c <prog> <args>

When /bin/sh is linked to dash, if <prog> is a shell script (/bin/sh
or /bin/bash), that shell script sees $PPID as being the "sh -c" process.

If /bin/sh is linked to bash, <prog> sees $PPID as being the actual
parent, which is a hell of a lot more useful (and in my case, required
for functionality of scripts I wrote a long time ago and I believe are
acting correctly).

My suspicion is that dash is doing an extra fork before exec, which
seems entirely useless, and not exactly in keeping with the
"lightweight and fast" aims of dash (forks can be expensive - glad
I don't have dash installed on our slowaris boxes!).

I think I can confirm this with this simple example:

75318,3> perl -e 'system("/bin/bash -c \"sleep 60\"");'
    75319,7> ps axuf | grep -A5 perl.*[s]ystem
    twc      19561  0.0  0.0  20132  1676 pts/118  S+   13:49   0:00            
          \_ perl -e system("/bin/bash -c \"sleep 60\"");
twc      19562  0.0  0.0   9512   616 pts/118  S+   13:49   0:00                
          \_ sleep 60


75320,5> perl -e 'system("/bin/dash -c \"sleep 60\"");'
    75320,8> ps axuf | grep -A5 perl.*[s]ystem
    twc      19752  0.0  0.0  20132  1676 pts/118  S+   13:49   0:00            
          \_ perl -e system("/bin/dash -c \"sleep 60\"");
    twc      19753  0.0  0.0   8104   632 pts/118  S+   13:49   0:00            
              \_ /bin/dash -c sleep 60
    twc      19754  0.0  0.0   9512   616 pts/118  S+   13:49   0:00            
                  \_ sleep 60



I have marked this as "grave", because it breaks unrelated parts of
the system: Sure, it's a shell script using /bin/sh (linked to dash)
that broke in this case, but anyone is free to use $PPID (via
/proc/.../status), and all it took was for the job of "sh -c" (that
system() always uses) having been taken over by the dash package
instead of bash.  Never mind the fact that I didn't actively install
dash - it came in with dependencies and eventually decided to ignore
my choice for /bin/sh to be manually linked to bash after several
upgrades where it obeyed me).

-- System Information:
Debian Release: squeeze/sid
  APT prefers testing
  APT policy: (500, 'testing'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.32-5-amd64 (SMP w/8 CPU cores)
Locale: LANG=en_AU.UTF-8, LC_CTYPE=en_AU.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages dash depends on:
ii  debianutils                   3.4        Miscellaneous utilities specific t
ii  dpkg                          1.15.8.5   Debian package management system
ii  libc6                         2.11.2-7   Embedded GNU C Library: Shared lib

dash recommends no packages.

dash suggests no packages.

-- debconf information:
* dash/sh: true



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