Hi Michael,

I'm still mentioning to look in detail on the content of the
environment. I know awk itself shell not need PATH etc., but Busybox
does. As Busybox is a multi call binary it contains common code. First
to invoke the applet and second for internal library functions. Some of
those code need environment information or other information possibly
not required by a bare awk.

Running awk from a shell script which is run as /bin/init differs in
environment from running a second shell and invoking awk from there. As
soon as an interactive shell is invoked the shell startup code set
several environment defaults in case there are needed. This may indeed
fix your segfault problem.

I know I had trouble for weeks as I stumbled on this. And came of a so
simple solution ... it was just to invoke awk via env that is:

env - awk AWKARGS

This sometimes solved my segfaulting start problem with awk. In othe
cases I needed to manually set some environment values.

It is good practice to set some environment variables right at the start
of the script running as init:

export TERM=linux
export USER=root
export HOME=/root
export SHELL=/bin/sh
export PATH=/bin:/sbin:/usr/bin:/usr/sbin

This shall give you a sane environment where most commands work as
expected. Without this the contents of the environment is purely
random (system/kernel version depended), as Busybox does not setup
a full initial environment, if invoked as init script (default
behavior of POSIX sh for non interactive invocation).

Harald
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to