Problem with ash redirection changing behaviour
Cristian Ionescu-Idbohrn
cristian.ionescu-idbohrn at axis.com
Wed Jun 2 12:08:57 UTC 2010
On Wed, 2 Jun 2010, Richard Purdie wrote:
> I have an issue having recently upgraded busybox. The change that is
> causing me problems is:
>
> http://git.busybox.net/busybox/commit/?id=6a0ad2506116f4ddc3f9f617a90ba04a57eeef88
>
> which is sanity checking file descriptors before allowing redirection.
>
> A script that triggers the problem is:
>
> """
> exec 9>&0 </etc/fstab
> while read fs mnt type opts dump pass junk
> do
> echo $fs
> done
> exec 0>&9 9>&-
> """
That should work.
> The idea being to save stdin, read from a file and then restore stdin
> without forking.
But so should this (no forks here either, and simplier):
while read fs mnt type opts dump pass junk; do
case $fs in
\#*|'')
continue
;;
*)
echo $fs
;;
esac
done < /etc/fstab
Does the above work for you?
> This used to work but now when run as ". script" from ash
Any particular reason to 'source'? You end up with environment
clutter:
dump=''
fs=''
junk=''
mnt=''
opts=''
pass=''
type=''
Is that intentional?
Cheers,
--
Cristian
More information about the busybox
mailing list