Debian Bug report logs - #784911
None borne shell compatible script /bin/fsck.btrfs breaks initrd

version graph

Package: btrfs-tools; Maintainer for btrfs-tools is Dimitri John Ledkov <xnox@debian.org>; Source for btrfs-tools is src:btrfs-progs (PTS, buildd, popcon).

Reported by: Klaus Ethgen <Klaus@Ethgen.de>

Date: Sun, 10 May 2015 14:21:02 UTC

Severity: normal

Tags: patch

Found in version btrfs-tools/4.0-2

Fixed in version 4.1.2-1

Done: Nicholas Steeves <nsteeves@gmail.com>

Bug is archived. No further changes may be made.

Toggle useless messages

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to debian-bugs-dist@lists.debian.org, Dimitri John Ledkov <xnox@debian.org>:
Bug#784911; Package btrfs-tools. (Sun, 10 May 2015 14:21:07 GMT) (full text, mbox, link).


Acknowledgement sent to Klaus Ethgen <Klaus@Ethgen.de>:
New Bug report received and forwarded. Copy sent to Dimitri John Ledkov <xnox@debian.org>. (Sun, 10 May 2015 14:21:07 GMT) (full text, mbox, link).


Message #5 received at submit@bugs.debian.org (full text, mbox, reply):

From: Klaus Ethgen <Klaus@Ethgen.de>
To: Debian Bug Tracking System <submit@bugs.debian.org>
Subject: None borne shell compatible script /bin/fsck.btrfs breaks initrd
Date: Sun, 10 May 2015 15:18:34 +0100
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Package: btrfs-tools
Version: 4.0-2
Severity: normal
Tags: patch

/bin/fsck.btrfs uses syntax that is not compatible to POSIX borne shell
syntax. As it is included in initram, breaks it somewhat.

Here is a patch to fix that:
   --- fsck.btrfs.distrib  2015-05-10 15:10:10.315185998 +0100
   +++ fsck.btrfs  2015-05-10 15:10:44.117891197 +0100
   @@ -31,7 +31,7 @@
	   echo "$0: $DEV does not exist"
	   exit 8
    fi
   -if [ "$AUTO" == "false" ]; then
   +if [ "x$AUTO" = "xfalse" ]; then
	   echo "If you wish to check the consistency of a BTRFS filesystem or"
	   echo "repair a damaged filesystem, see btrfs(8) subcommand 'check'."
    fi

Note that this fixes two problems in one:
1. There is no such operator like "==" in borne shell. When will people
   accept that finally!?
2. Some shells evaluate the parameters to "=" so it is best to prefix it
   with some fixed string.

- -- System Information:
Debian Release: stretch/sid
  APT prefers unstable
  APT policy: (800, 'unstable'), (110, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.19.5 (SMP w/8 CPU cores)
Locale: LANG=de_DE, LC_CTYPE=de_DE (charmap=ISO-8859-1) (ignored: LC_ALL set to de_DE)
Shell: /bin/sh linked to /bin/dash
Init: sysvinit (via /sbin/init)

Versions of packages btrfs-tools depends on:
ii  e2fslibs    1.42.12-1.1
ii  libblkid1   2.26.2-2
ii  libc6       2.19-18
ii  libcomerr2  1.42.12-1.1
ii  liblzo2-2   2.08-1.2
ii  libuuid1    2.25.2-6
ii  zlib1g      1:1.2.8.dfsg-2+b1

btrfs-tools recommends no packages.

btrfs-tools suggests no packages.

- -- no debconf information

- -- 
Klaus Ethgen                              http://www.ethgen.ch/
pub  4096R/4E20AF1C 2011-05-16   Klaus Ethgen <Klaus@Ethgen.de>
Fingerprint: 85D4 CA42 952C 949B 1753  62B3 79D0 B06F 4E20 AF1C
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQGcBAEBCgAGBQJVT2iwAAoJEKZ8CrGAGfasPsUMAMZNFJmgEQCCejzeSsD61Bce
+lD2sPtJMIZn44qy3ujo8qXi6gHAPo2L3nKb2f/uVrAb3EB2fdyLQhUQD4Bo1Rzc
KKpHRGOJPSUS3TIbDIIRxaRHahRB5SZFoEWxiyEp4SNaM8faBNwlay0Gk2CMnekX
FagBwEUHGNF0dpkir/U0DTdyVdlAg179X3X7hVlrgFqpnLsH9xFr7dXSEDFo1o5X
qZtLDNlVnRSLxc+XApnew4A4EHit6b0gLu/JkLf012iatReUXX612nteGC8TLj78
QJMB60ebMQivgVMAP8KYpRYMV9P8OGo8gB7POZeF2cz9AnzYAV1WRtbUXnLT8SkJ
uCHbIbP0E+v742FELJdu2+Z/GcFqRqhnSBCm1T+/HPZJPaxUIwrpUtXZSPkmSFRc
1KfHm7xWlALdZZUkJPP1ycjCKbLnYUgKCPkCqjVWYiulw8thJZ0IwIxSqMfRTLjs
7fQ4ClUxX/+ma9eio+tPVec0bT4AbtMqh2q6rRtBsA==
=14th
-----END PGP SIGNATURE-----



Information forwarded to debian-bugs-dist@lists.debian.org, Dimitri John Ledkov <xnox@debian.org>:
Bug#784911; Package btrfs-tools. (Mon, 11 May 2015 19:39:07 GMT) (full text, mbox, link).


Acknowledgement sent to Tareeq Ali <terror.eek@gmail.com>:
Extra info received and forwarded to list. Copy sent to Dimitri John Ledkov <xnox@debian.org>. (Mon, 11 May 2015 19:39:07 GMT) (full text, mbox, link).


Message #10 received at 784911@bugs.debian.org (full text, mbox, reply):

From: Tareeq Ali <terror.eek@gmail.com>
To: 784911@bugs.debian.org
Subject: None borne shell compatible script /bin/fsck.btrfs breaks initrd
Date: Mon, 11 May 2015 15:36:27 -0400
[Message part 1 (text/plain, inline)]
Hi

i'd like to confirm this bug as well as the patch does in fact resolve the
issue.  At boot up I would get the following error;

systemd-fsck[703]: /bin/fsck.btrfs: 34: [: true: unexpected operator

after applying the patch I no longer get this error.

-Tareeq
[Message part 2 (text/html, inline)]

Information forwarded to debian-bugs-dist@lists.debian.org, sskraep@gmail.com, Dimitri John Ledkov <xnox@debian.org>:
Bug#784911; Package btrfs-tools. (Thu, 18 Jun 2015 16:45:04 GMT) (full text, mbox, link).


Acknowledgement sent to Daniel Andersson <sskraep@gmail.com>:
Extra info received and forwarded to list. Copy sent to sskraep@gmail.com, Dimitri John Ledkov <xnox@debian.org>. (Thu, 18 Jun 2015 16:45:04 GMT) (full text, mbox, link).


Message #15 received at 784911@bugs.debian.org (full text, mbox, reply):

From: Daniel Andersson <sskraep@gmail.com>
To: Debian Bug Tracking System <784911@bugs.debian.org>
Subject: Re: None borne shell compatible script /bin/fsck.btrfs breaks initrd
Date: Thu, 18 Jun 2015 18:43:24 +0200
Package: btrfs-tools
Version: 4.0-2
Followup-For: Bug #784911

Noticed this Bashism as well. Comparing with booleans (or "boolean-like
variables" as in this case) is generally not necessary; before I found this bug
report I had personally solved it as below using the POSIX built-in behaviour
for `true` and `false`, but details do not really matter.

--- /bin/fsck.btrfs.dist        2015-06-18 18:31:38.233523691 +0200
+++ /bin/fsck.btrfs.fixed       2015-06-18 18:32:00.883858768 +0200
@@ -31,7 +31,7 @@
        echo "$0: $DEV does not exist"
        exit 8
 fi
-if [ "$AUTO" == "false" ]; then
+if ! $AUTO; then
        echo "If you wish to check the consistency of a BTRFS filesystem or"
        echo "repair a damaged filesystem, see btrfs(8) subcommand 'check'."
 fi



-- System Information:
Debian Release: stretch/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i686)

Kernel: Linux 4.0.0-2-686-pae (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=sv_SE.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages btrfs-tools depends on:
ii  e2fslibs    1.42.13-1
ii  libblkid1   2.26.2-6
ii  libc6       2.19-18
ii  libcomerr2  1.42.13-1
ii  liblzo2-2   2.08-1.2
ii  libuuid1    2.26.2-6
ii  zlib1g      1:1.2.8.dfsg-2+b1

btrfs-tools recommends no packages.

btrfs-tools suggests no packages.

-- no debconf information



Reply sent to Nicholas Steeves <nsteeves@gmail.com>:
You have taken responsibility. (Tue, 08 Dec 2015 21:18:07 GMT) (full text, mbox, link).


Notification sent to Klaus Ethgen <Klaus@Ethgen.de>:
Bug acknowledged by developer. (Tue, 08 Dec 2015 21:18:07 GMT) (full text, mbox, link).


Message #20 received at 784911-done@bugs.debian.org (full text, mbox, reply):

From: Nicholas Steeves <nsteeves@gmail.com>
To: 784911-done@bugs.debian.org, Klaus Ethgen <Klaus@Ethgen.de>, Daniel Andersson <sskraep@gmail.com>
Subject: Re: [fixed] None borne shell compatible script /bin/fsck.btrfs breaks initrd
Date: Tue, 8 Dec 2015 16:15:08 -0500
Version: 4.1.2-1

Fixed upstream in an identical way to Daniel Andersson's patch since version 4.1
  - Fixed: fsck.btrfs: no bash-isms
    https://btrfs.wiki.kernel.org/index.php/Changelog



Bug archived. Request was from Debbugs Internal Request <owner@bugs.debian.org> to internal_control@bugs.debian.org. (Wed, 06 Jan 2016 07:25:27 GMT) (full text, mbox, link).


Send a report that this bug log contains spam.


Debian bug tracking system administrator <owner@bugs.debian.org>. Last modified: Fri Jul 24 03:54:26 2020; Machine Name: bembo

Debian Bug tracking system

Debbugs is free software and licensed under the terms of the GNU Public License version 2. The current version can be obtained from https://bugs.debian.org/debbugs-source/.

Copyright © 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson, 2005-2017 Don Armstrong, and many other contributors.