Comment 6 for bug 26305

Revision history for this message
In , Henrique de Moraes Holschuh (hmh) wrote : Re: Bug#341060: initscript: completely broken

severity 341060 grave
thanks

(I am setting it back to grave so that apt-listbugs warns people off until
an upload fixing the bug hits the archive. See the rest of the email).

On Mon, 28 Nov 2005, Martin Pitt wrote:
> The script runs fine with bash and dash, and [ "$foo" ] is common

Well, here it broke with bash from sid depending on the values of $foo,
which is probably why you could not reproduce it.

> practice and described in test(1:
>
> -n STRING
> the length of STRING is nonzero
>
> STRING equivalent to -n STRING

Braindamaged common practice, that one is. If with "-<something test
recognizes>" the string is, stupid things test will do.

Never use naked strings with test, it is courting an error mode. I *think*
it is smart enough not to croak if you [ "$string" ], but it will on [
"$string" -a something -a "$string2" ]...

In this case it barfs when some of the strings are "-1", see attached error
dump.

Try this:
 a=1 ; b=-1 ; [ -n "$a" -a "$b" ] && echo ok

Interestingly enough,
 a=1 ; b=-1 ; [ "$a" -a "$b" ] && echo ok
won't croak. This is bash trying to be smart, as
 a=1 ; b=-1 ; /usr/bin/[ "$a" -a "$b" ] && echo ok
WILL croak.

> Please give me the output of sh -nx /etc/init.d/sysfsutils if it
> really breaks for you.

"if it really breaks"? I'd have worded that request very differently, the
way you did is not nice at all. I hope you did so because of the @d.o
address, and would not write something like that to a regular user.

Output attached, and sysfs.conf attached too. BTW, "-nx" gives no output, I
ran it with -x only.

also, just for completeness:
khazad-dum:/etc# ls -lad /bin/sh
lrwxrwxrwx 1 root root 4 Oct 14 19:47 /bin/sh -> bash

and
khazad-dum:/etc# head -n 1 /etc/init.d/sysfsutils
#! /bin/sh -e

--
  "One disk to rule them all, One disk to find them. One disk to bring
  them all and in the darkness grind them. In the Land of Redmond
  where the shadows lie." -- The Silicon Valley Tarot
  Henrique Holschuh