Problem with PPID and bb grep

Denys Vlasenko vda.linux at googlemail.com
Sun Nov 4 00:32:07 UTC 2007


On Friday 02 November 2007 19:59, Marc Blumentritt wrote:
> Hi bb list,
> 
> #!/bin/sh
> # Copyright 2006-2007 Gentoo Foundation
> # Distributed under the terms of the GNU General Public License v2
> 
> # Ensure we are called by init
> echo "PPID = $PPID"
> #[ "$PPID" == "1" ] || exit 0
> 
> I would expect a PPID of 1, bit I get something like 833! But if a check
> with ps, init has PID of 1?! I cannot explain this. I also used sysvinit
> instead of bb init and checked PPID in a similar way and got the same
> result! The only idea I have, where this could come from is, that
> /bin/sh is of course a link to /bin/busybox. Perhaps this breaks
> checking PPID? Or this is some kind of bug? Or is this related with
> running a system in rootfs of initramfs?

I think that your process gets started from a child if init, not
an init itself. Do "ps -A" and send output to the list,
and alsoo look up what process has PID 833.


> 2.) There seems to be a bug in bb grep. I did this on my machine:
> 
> hive ~ # busybox grep -Fow usbfs /proc/filesystems
> Segmentation fault
> hive ~ # busybox grep -Fo usbfs /proc/filesystems
> Segmentation fault
> hive ~ # busybox grep -F usbfs /proc/filesystems
> nodev   usbfs
> hive ~ # busybox grep -o usbfs /proc/filesystems
> usbfs
> hive ~ # busybox grep -w usbfs /proc/filesystems
> nodev   usbfs
> hive ~ # busybox grep -ow usbfs /proc/filesystems
> usbfs
> hive ~ # busybox grep usbfs /proc/filesystems
> nodev   usbfs
> 
> The first two should certainly not result in a Segmentation fault, right?

It's easier to track reports if you have one bug report per mail,
not several unrelated bugs.

Try attached patch.
--
vda
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 8.patch
Type: text/x-diff
Size: 1034 bytes
Desc: not available
Url : http://lists.busybox.net/pipermail/busybox/attachments/20071104/93ba0c25/attachment-0002.bin 


More information about the busybox mailing list