On Thu, 25 Nov 2010, Jonathan Nieder wrote: > severity 604993 normal > quit > > Hi Tim, > > Tim Connors wrote: > > > 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. > > Could you give an example? I tried: > > $ sh -c 'echo $PPID; echo $$' > 18562 > 18564 > $ python -c 'import os; os.system("echo $PPID; echo $$");' > 18577 > 18578 > > so I suspect I am missing something.
75427,45> ps $$ PID TTY STAT TIME COMMAND 2520 pts/29 Ss 0:01 bash 75428,46> /bin/bash -c "bash -c \"echo \\\$PPID ; ps \\\$PPID\"" 2520 PID TTY STAT TIME COMMAND 2520 pts/29 Ss 0:01 bash 75429,47> /bin/dash -c "bash -c \"echo \\\$PPID ; ps \\\$PPID\"" 5542 PID TTY STAT TIME COMMAND 5542 pts/29 S+ 0:00 /bin/dash -c bash -c "echo \$PPID ; ps \$PPID" (the first /bin/bash or /bin/dash mimics /bin/sh being called with those set as links, the second /bin/bash mimicks the #!/bin/bash line of a script being called by system() (equivalentl results with #!/bin/sh or #!/bin/dash), or indeed any process that reads the PPid line from /proc/.../status. > > I have marked this as "grave", because it breaks unrelated parts of > > the system > > No. I strongly disagree. It causes the PPid line in /proc/$pid/status to be WRONG for any program or script if it was executed by the system() routine provided in libc, if and only if dash is installed as /bin/sh. -- TimC If you ever fear that machines will surpass humans in intelligence, just ask Microsoft to write the OS. -- POTU in RHOD -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org