initscript: completely broken

Bug #26305 reported by Debian Bug Importer
4
Affects Status Importance Assigned to Milestone
sysfsutils (Debian)
Fix Released
Unknown
sysfsutils (Ubuntu)
Invalid
High
Martin Pitt

Bug Description

Automatically imported from Debian bug report #341060 http://bugs.debian.org/341060

Revision history for this message
Debian Bug Importer (debzilla) wrote :

Automatically imported from Debian bug report #341060 http://bugs.debian.org/341060

Revision history for this message
Debian Bug Importer (debzilla) wrote :

Message-ID: <email address hidden>
Date: Mon, 28 Nov 2005 00:22:57 -0200
From: Henrique de Moraes Holschuh <email address hidden>
To: Debian Bug Tracking System <email address hidden>
Subject: initscript: completely broken

Package: sysfsutils
Version: 1.3.0-3
Severity: grave
Justification: renders package unusable

if [ "$f1" ] ;... is NOT valid shell syntax. Nor is [ ... -a "$f2" ].
You're missing a "-n" in front of all bare string tests inside [ ].

-- System Information:
Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (990, 'unstable')
Architecture: i386 (i686)
Shell: /bin/sh linked to /bin/bash
Kernel: Linux 2.6.13.4-debian1+libata+bluesmoke+imq+lm85
Locale: LANG=pt_BR.ISO-8859-1, LC_CTYPE=pt_BR.ISO-8859-1 (charmap=ISO-8859-1)

Versions of packages sysfsutils depends on:
ii libc6 2.3.5-8.1 GNU C Library: Shared libraries an
ii libsysfs1 1.3.0-3 interface library to sysfs

sysfsutils recommends no packages.

-- no debconf information

--
  "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

Revision history for this message
Martin Pitt (pitti) wrote :

This is really a bogus report; I track it in Debian as normal
severity/needinfo+unreproducible.

Revision history for this message
In , Martin Pitt (pitti) wrote : Re: Bug#341060: initscript: completely broken

severity 341060 normal
tag 341060 unreproducible moreinfo
thanks

Hi Henrique!

Henrique de Moraes Holschuh [2005-11-28 0:22 -0200]:
> Package: sysfsutils
> Version: 1.3.0-3
> Severity: grave
> Justification: renders package unusable
>
> if [ "$f1" ] ;... is NOT valid shell syntax. Nor is [ ... -a "$f2" ].
> You're missing a "-n" in front of all bare string tests inside [ ].

The script runs fine with bash and dash, and [ "$foo" ] is common
practice and described in test(1):

       -n STRING
              the length of STRING is nonzero

       STRING equivalent to -n STRING

Downgrading severity since this runs fine at least on the majority of
installations.

So what exactly breaks for you? According to your initial report you
have /bin/sh linked to /bin/bash, do you use another shell?

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

Thanks,

Martin
--
Martin Pitt http://www.piware.de
Ubuntu Developer http://www.ubuntu.com
Debian Developer http://www.debian.org

In a world without walls and fences, who needs Windows and Gates?

Revision history for this message
Debian Bug Importer (debzilla) wrote :

Message-ID: <email address hidden>
Date: Mon, 28 Nov 2005 12:42:46 +0100
From: Martin Pitt <email address hidden>
To: Henrique de Moraes Holschuh <email address hidden>,
 <email address hidden>
Cc: <email address hidden>
Subject: Re: Bug#341060: initscript: completely broken

--pvezYHf7grwyp3Bc
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

severity 341060 normal
tag 341060 unreproducible moreinfo
thanks

Hi Henrique!

Henrique de Moraes Holschuh [2005-11-28 0:22 -0200]:
> Package: sysfsutils
> Version: 1.3.0-3
> Severity: grave
> Justification: renders package unusable
>=20
> if [ "$f1" ] ;... is NOT valid shell syntax. Nor is [ ... -a "$f2" ].
> You're missing a "-n" in front of all bare string tests inside [ ].

The script runs fine with bash and dash, and [ "$foo" ] is common
practice and described in test(1):

       -n STRING
              the length of STRING is nonzero

       STRING equivalent to -n STRING

Downgrading severity since this runs fine at least on the majority of
installations.

So what exactly breaks for you? According to your initial report you
have /bin/sh linked to /bin/bash, do you use another shell?

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

Thanks,

Martin
--=20
Martin Pitt http://www.piware.de
Ubuntu Developer http://www.ubuntu.com
Debian Developer http://www.debian.org

In a world without walls and fences, who needs Windows and Gates?

--pvezYHf7grwyp3Bc
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: Digital signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)

iD8DBQFDiu01DecnbV4Fd/IRAiswAKCi5mZJUJT/UjpHdgPMHbLHvgrU3gCg4i+H
MUn7OiXdndrxkEcy4tIFBBA=
=w8DD
-----END PGP SIGNATURE-----

--pvezYHf7grwyp3Bc--

Revision history for this message
In , Henrique de Moraes Holschuh (hmh) wrote :

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

Revision history for this message
Debian Bug Importer (debzilla) wrote :
Download full text (17.3 KiB)

Message-ID: <email address hidden>
Date: Tue, 29 Nov 2005 10:39:00 -0200
From: Henrique de Moraes Holschuh <email address hidden>
To: Martin Pitt <email address hidden>
Cc: <email address hidden>
Subject: Re: Bug#341060: initscript: completely broken

--OXfL5xGRrasGEqWY
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

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

--OXfL5xGRrasGEqWY
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="sysfs.conf"

#
# /etc/sysfs.conf - Configuration file for setting sysfs attributes.
#
# The sysfs mount directory is automatically prepended to the attribute paths.
#
# Examples:
#
# Always use the powersave CPU frequency governor
# devices/system/cpu/cpu0/cpufreq/scaling_governor=powersave
#
# Use userspace CPU frequency governor and set initial speed
# devices/system/cpu/cpu0/cpufreq/scaling_governor = userspace
# devices/system/cpu/cpu0/cpufreq/scaling_setspeed = 600000

##
## ADM-1027 temperature monitor / fan controller
##

# Device setup (maybe overriden later by /etc/sensors.conf)
# Generated using sensors.conf, look there.
class/i2c-adapter/i2c-0/device/0-002e/vrm = 91
class/i2c-adapter/i2c-0/device/0-002e/in0_max...

Revision history for this message
In , Martin Pitt (pitti) wrote : Bug#341060: fixed in sysfsutils 1.3.0-4

Source: sysfsutils
Source-Version: 1.3.0-4

We believe that the bug you reported is fixed in the latest version of
sysfsutils, which is due to be installed in the Debian FTP archive:

libsysfs-dev_1.3.0-4_i386.deb
  to pool/main/s/sysfsutils/libsysfs-dev_1.3.0-4_i386.deb
libsysfs1-udeb_1.3.0-4_i386.udeb
  to pool/main/s/sysfsutils/libsysfs1-udeb_1.3.0-4_i386.udeb
libsysfs1_1.3.0-4_i386.deb
  to pool/main/s/sysfsutils/libsysfs1_1.3.0-4_i386.deb
sysfsutils_1.3.0-4.diff.gz
  to pool/main/s/sysfsutils/sysfsutils_1.3.0-4.diff.gz
sysfsutils_1.3.0-4.dsc
  to pool/main/s/sysfsutils/sysfsutils_1.3.0-4.dsc
sysfsutils_1.3.0-4_i386.deb
  to pool/main/s/sysfsutils/sysfsutils_1.3.0-4_i386.deb

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed. If you
have further comments please address them to <email address hidden>,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Martin Pitt <email address hidden> (supplier of updated sysfsutils package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing <email address hidden>)

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Format: 1.7
Date: Fri, 2 Dec 2005 17:13:53 +0100
Source: sysfsutils
Binary: libsysfs1-udeb sysfsutils libsysfs1 libsysfs-dev
Architecture: source i386
Version: 1.3.0-4
Distribution: unstable
Urgency: low
Maintainer: Martin Pitt <email address hidden>
Changed-By: Martin Pitt <email address hidden>
Description:
 libsysfs-dev - interface library to sysfs - development files
 libsysfs1 - interface library to sysfs
 libsysfs1-udeb - interface library to sysfs (udeb)
 sysfsutils - sysfs query tool and boot-time setup
Closes: 341060
Changes:
 sysfsutils (1.3.0-4) unstable; urgency=low
 .
   * debian/sysfsutils.init:
     - Use -n "$variable" instead of naked "$variable" in test invocations
       since the latter breaks with values that start with a dash.
     - Thanks to Henrique de Moraes Holschuh for making me aware of this issue.
     - Closes: #341060
Files:
 f43eae0157ff9f5163f50e893368f122 615 libs extra sysfsutils_1.3.0-4.dsc
 1120ecd1f1403e5212e7dfee5e4feccc 4350 libs extra sysfsutils_1.3.0-4.diff.gz
 9a91609da435f419da43b7a5a9fac353 48380 libdevel extra libsysfs-dev_1.3.0-4_i386.deb
 27a14365f1c1092faf172ae5f1a7e672 27468 libs extra libsysfs1_1.3.0-4_i386.deb
 b5e08ef03fc476fef632561e4a90db6c 21300 utils extra sysfsutils_1.3.0-4_i386.deb
 e84042d537ec95694ca359bca953dc24 17132 debian-installer optional libsysfs1-udeb_1.3.0-4_i386.udeb
Package-Type: udeb

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFDkHd+DecnbV4Fd/IRAr0tAJ9B/Ph7/VTOdxxlUIWrHxPehS4ZuACfTgaV
yWSrah42R5I3MVsBMCxbn5E=
=H0m3
-----END PGP SIGNATURE-----

Revision history for this message
Debian Bug Importer (debzilla) wrote :

Message-Id: <email address hidden>
Date: Fri, 02 Dec 2005 08:47:10 -0800
From: Martin Pitt <email address hidden>
To: <email address hidden>
Subject: Bug#341060: fixed in sysfsutils 1.3.0-4

Source: sysfsutils
Source-Version: 1.3.0-4

We believe that the bug you reported is fixed in the latest version of
sysfsutils, which is due to be installed in the Debian FTP archive:

libsysfs-dev_1.3.0-4_i386.deb
  to pool/main/s/sysfsutils/libsysfs-dev_1.3.0-4_i386.deb
libsysfs1-udeb_1.3.0-4_i386.udeb
  to pool/main/s/sysfsutils/libsysfs1-udeb_1.3.0-4_i386.udeb
libsysfs1_1.3.0-4_i386.deb
  to pool/main/s/sysfsutils/libsysfs1_1.3.0-4_i386.deb
sysfsutils_1.3.0-4.diff.gz
  to pool/main/s/sysfsutils/sysfsutils_1.3.0-4.diff.gz
sysfsutils_1.3.0-4.dsc
  to pool/main/s/sysfsutils/sysfsutils_1.3.0-4.dsc
sysfsutils_1.3.0-4_i386.deb
  to pool/main/s/sysfsutils/sysfsutils_1.3.0-4_i386.deb

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed. If you
have further comments please address them to <email address hidden>,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Martin Pitt <email address hidden> (supplier of updated sysfsutils package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing <email address hidden>)

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Format: 1.7
Date: Fri, 2 Dec 2005 17:13:53 +0100
Source: sysfsutils
Binary: libsysfs1-udeb sysfsutils libsysfs1 libsysfs-dev
Architecture: source i386
Version: 1.3.0-4
Distribution: unstable
Urgency: low
Maintainer: Martin Pitt <email address hidden>
Changed-By: Martin Pitt <email address hidden>
Description:
 libsysfs-dev - interface library to sysfs - development files
 libsysfs1 - interface library to sysfs
 libsysfs1-udeb - interface library to sysfs (udeb)
 sysfsutils - sysfs query tool and boot-time setup
Closes: 341060
Changes:
 sysfsutils (1.3.0-4) unstable; urgency=low
 .
   * debian/sysfsutils.init:
     - Use -n "$variable" instead of naked "$variable" in test invocations
       since the latter breaks with values that start with a dash.
     - Thanks to Henrique de Moraes Holschuh for making me aware of this issue.
     - Closes: #341060
Files:
 f43eae0157ff9f5163f50e893368f122 615 libs extra sysfsutils_1.3.0-4.dsc
 1120ecd1f1403e5212e7dfee5e4feccc 4350 libs extra sysfsutils_1.3.0-4.diff.gz
 9a91609da435f419da43b7a5a9fac353 48380 libdevel extra libsysfs-dev_1.3.0-4_i386.deb
 27a14365f1c1092faf172ae5f1a7e672 27468 libs extra libsysfs1_1.3.0-4_i386.deb
 b5e08ef03fc476fef632561e4a90db6c 21300 utils extra sysfsutils_1.3.0-4_i386.deb
 e84042d537ec95694ca359bca953dc24 17132 debian-installer optional libsysfs1-udeb_1.3.0-4_i386.udeb
Package-Type: udeb

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFDkHd+DecnbV4Fd/IRAr0tAJ9B/Ph7/VTOdxxlUIWrHxPehS4ZuACfTgaV
yWSrah42R5I3MVsBMCxbn5E=
=H0m3
-----END PGP SIGNATURE-----

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.