Problem with PPID and bb grep

Marc Blumentritt marc.blumentritt at arcor.de
Fri Nov 2 19:59:05 UTC 2007


Hi bb list,

I'm working on my first embedded system, using Gentoo and of course
busybox [1]. The complete root fs is placed in initramfs. During my work
on this I stumbled about two things, which could be bugs of bb:

1.) I use an initialization script, which is called by init. This script
starts with this:

#!/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?


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?


Thanks for busybox. It is really great!
Regrads,
Marc




[1] http://article.gmane.org/gmane.linux.gentoo.embedded/1791




More information about the busybox mailing list