Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.kernel > #64381

Bug#931499: initramfs hook scripts which use log_* functions die

From Guenther Brunthaler <gb_about_gnu@gmx.net>
Newsgroups linux.debian.bugs.dist, linux.debian.kernel
Subject Bug#931499: initramfs hook scripts which use log_* functions die
Date 2019-07-06 20:40 +0200
Message-ID <ygXLj-89L-1@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Cross-posted to 2 groups.

Show all headers | View raw


Package: initramfs-tools-core
Version: 0.133

initramfs hook scripts which source

. /usr/share/initramfs-tools/scripts/functions

and then later use one of the log_*() functions such as

log_begin_msg "Installing terminfo entries: $tinfos"

will make the hook script fail with the message "quiet: parameter not
set", which will make the invoking "update-initramfs" also fail as a
consequence.

The reason is simple: The script contains a parameter expansion

$ grep -F 'quiet?' /usr/share/initramfs-tools/scripts/functions
         if [ "${quiet?}" = "y" ]; then return; fi

which will fail if "$quiet" is not defined at all at this place. This
can easily be tested as follows:

$ (set +e; unset quiet; echo "${quiet?}"; echo "RC: $?")
-bash: quiet: parameter not set

Note that this failure was so severe that the whole subshell terminated
even though "set -e" has been disabled!

The easiest way to make to problem go away would be to set the variable
if it is not defined, because this works:

$ (set +e; : ${quiet:=}; echo "${quiet?}"; echo "RC: $?")
RC: 0

It would suffice to add a line

: ${quiet:=}

or maybe better

: ${quiet:=n}

somewhere outside of any function to the file
/usr/share/initramfs-tools/scripts/functions.

I am using Debian 10 on branch "buster"
on branch ascii
with kernel
Linux 4.9.0-9-amd64 #1 SMP Debian 4.9.168-1+deb9u3 (2019-06-16) x86_64
GNU/Linux

Back to linux.debian.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Bug#931499: initramfs hook scripts which use log_* functions die Guenther Brunthaler <gb_about_gnu@gmx.net> - 2019-07-06 20:40 +0200
  Bug#931499: Is sourcing /usr/share/initramfs-tools/scripts/functions forbidden in hook scripts? Guenther Brunthaler <gb_about_gnu@gmx.net> - 2019-07-06 21:00 +0200
  Processed: Re: initramfs hook scripts which use log_* functions die "Debian Bug Tracking System" <owner@bugs.debian.org> - 2019-07-07 16:40 +0200
  Bug#931499: initramfs hook scripts which use log_* functions die Ben Hutchings <ben@decadent.org.uk> - 2019-07-07 16:40 +0200
  Bug#931499: [Fwd: Re: initramfs hook scripts which use log_* functions die] Ben Hutchings <ben@decadent.org.uk> - 2019-07-09 02:00 +0200
  Bug#931499: initramfs hook scripts which use log_* functions die Ben Hutchings <ben@decadent.org.uk> - 2019-07-09 02:00 +0200

csiph-web