[Pm-utils] [patch commit] [015] POSIXification of pm-utils

Dan Nicholson dbn.lists at gmail.com
Wed Jan 30 06:01:43 PST 2008


On Jan 30, 2008 4:33 AM, Michael Biebl <mbiebl at gmail.com> wrote:
> 2008/1/30, Stefan Seyfried <seife at suse.de>:
> > On Mon, Jan 28, 2008 at 07:59:49PM +0000, Richard Hughes wrote:
> > > On Sun, 2008-01-27 at 14:57 -0600, Victor Lowther wrote:
> > > > All scripts are now POSIX compliant, change shebang lines to have them
> > > > run under /bin/sh instead of /bin/bash. Also take care of a few more
> > > > minor fixups.
> > >
> > > Applied, thanks.
> >
> > Who fixes all the user's hooks out there?
>
> I'm not sure, if there are that many user hooks out there. But anyway,
> if they didn't use #!/bin/bash in case they used bash-only features,
> they would have been fscked anyway for a system where /bin/sh !=
> /bin/bash.

That's not how it works for pm-utils. Since we source the scripts
instead of executing them, they run under the current interpreter,
which is /bin/sh. See for yourself:

$ cat > hook.sh << "EOF"
#!/bin/bash
declare -a foo=( foo bar baz )
declare -p foo
EOF
$ chmod +x hook.sh
$ ./hook.sh
declare -a foo='([0]="foo" [1]="bar" [2]="baz")'
$ dash -c "./hook.sh"
declare -a foo='([0]="foo" [1]="bar" [2]="baz")'
$ dash -c ". ./hook.sh"
./hook.sh: 3: Syntax error: "(" unexpected

So, I suppose that nothing is being done to ensure the user hooks will
run correctly if they contain bashisms.

--
Dan


More information about the Pm-utils mailing list