[Pkg-sysvinit-devel] Bug#339979: Minor cosmetic problems with lastest initscripts

Domenico Pasella dpasella at gmail.com
Thu Nov 24 17:17:57 UTC 2005


On 11/23/05, Thomas Hood <jdthood at yahoo.co.uk> wrote:
> Domenico Pasella wrote:
> >> Scripts can be sourced with positional parameters, so I don't see what
> >> is wrong with the code at line 336 of checkroot.sh, which you quote.
> >> Can you explain?
> >
> > I was sleeping. :)
>
>
> No you weren't.  I just discovered that providing positional parameters
> to sourced scripts is not supported in dash.  Do you have /bin/sh linked
> to dash?
>

ohhh yes. :-)


> =========
> $ cat /tmp/s
> echo arg0 "$0" arg1 "$1"
>
> $ cat /tmp/t
> #!/bin/bash
> . /tmp/s foo
>
> $ /tmp/t
> arg0 /tmp/t arg1 foo
>
> $ vi /tmp/t  # and s/bash/dash
> $ cat /tmp/t
> #!/bin/dash
> . /tmp/s foo
>
> $ /tmp/t
> arg0 /tmp/t arg1
> ==========
>
>
> > Wed Nov 23 16:19:13 2005: Done checking root file system.
> > Wed Nov 23 16:19:13 2005: Usage: /etc/rcS.d/S10checkroot.sh start|stop
> > Wed Nov 23 16:19:13 2005: Cleaning up ifupdown...done.
>
>
> Doh, I forgot to fix the Usage line in mountvirtfs.  Please apply
> this patch to your mountvirtfs:
>
> -       echo "Usage: $0 start|stop" >&2
> +       echo "Usage: mountvirtfs start|stop" >&2
>
> Assuming that you are using dash and that this is the reason you are
> seeing the message, the next question is whether dash or checkroot.sh is
> at fault.  That is, _should_ dash support sourcing with arguments?
>
> Sourcing is performed using the dot command which, like the colon command,
> is a "Special Built-in Utility"[0].  The Open Group Base Specification
> Issue 6 does not say[1] that the dot can be given more than one argument.
> Hence, I conclude that the bug is in checkroot.sh: a bashism.
>
> [0]http://www.opengroup.org/onlinepubs/009695399/idx/sbi.html
> [1]http://www.opengroup.org/onlinepubs/009695399/utilities/dot.html
>
> I will fix this by removing the 'start' argument of the dot command you
> quoted and I will make mountvirtfs default to start if $1 is empty.
> Here is a diff for you to try.
>

I have tried the patch and the output looks like as one would expect.
The output seems like that i expect.


Thanks for your work
bye
.yo.mo.




More information about the Pkg-sysvinit-devel mailing list