]> git.ipfire.org Git - thirdparty/dracut.git/commit
fs-lib: drop a bashism
authorLubomir Rintel <lkundrak@v3.sk>
Fri, 21 Jun 2019 16:39:48 +0000 (18:39 +0200)
committerHarald Hoyer <harald@hoyer.xyz>
Fri, 19 Jul 2019 14:13:22 +0000 (16:13 +0200)
commit43c8c4ce0471abbb8c0fc4b8be2515cebc636030
treea72f59dd5f22c21b177ab25d150f9339a73d97a4
parent7b76fa924dfd20d3fd4433baa8292f0112282aac
fs-lib: drop a bashism

Bash 5 apparently longer propagates variable assignments to local variables
in front of function calls when in POSIX mode:

  [lkundrak@demiurge ~]$ cat feh.sh
  print_VAR () {
          echo "$VAR";
  }

  testfunc () {
          local VAR="OLD"
          VAR=NEW print_VAR
  }

  testfunc
  [lkundrak@demiurge ~]$ bash4 --posix feh.sh
  NEW
  [lkundrak@demiurge ~]$ bash5 --posix feh.sh
  OLD
  [lkundrak@demiurge ~]$ bash5 feh.sh
  NEW
  [lkundrak@demiurge ~]$

It works the way it did in Bash 4 in non-POSIX mode, for external programs,
or for non-local variables. Don't ask me why -- it's probably some
compatibility thing for some sad old people.

However, this precisely happens when fsck_single() is calling into the
fsck_drv_com(), assigned to _drv by fsck_able(). That ruins the
TEST-70-BONDBRIDGETEAMVLAN test's server and probably more.

Let's pass the fsck driver binary via the function argument instead. It's
less messy anyway.
modules.d/99fs-lib/fs-lib.sh