bash4 breaks firmware update scripts (buildVer.sh: file not found)

Stephen Dowdy sdowdy at ucar.edu
Wed Mar 3 10:17:36 CST 2010


Dominik,

Good catch.
Looks like BASH is rectifying POSIX non-compliance.
The spsetup.sh scripts i looked at, properly (and
i'm pleasantly surprised) attempt to do a little
bit of security sanitizing at the start.  They
use 'getconf PATH' to reset the PATH, blowing away
your external changes, and they don't put "." back
into it.  So, BASH4 is not breaking the script, the
script is broken. (so if PATH had . in it, it'd
still work in bash's "POSIX compliance" mode (#!/bin/sh)

It's not clear to me that "source" is POSIX compliant.
(maybe it is, but i thought dot-scripts needed to be
sourced only with ".")  (so, i'm thinking it's a bash-ism)

# checkbashisms spsetup.sh 2>&1 | grep 'source'
possible bashism in /d1/src/Dell_BIOS/PER710/spsetup.sh line 1474 (should be '.', not 'source'):
Yep.

There's plenty of other bashisms in those scripts (typset, let, ..)

details on 'dot' showing it DOES source from "." if in PATH.
http://www.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#dot

Looks like Dell's got some script cleanup work to do.

--stephen

Dominik L. Borkowski wrote, On 03/03/2010 08:18 AM:

> It seems that bash4 breaks most of the scripts used by SUU, and I was 
> wondering if anybody has suggestions on how to fix permanently.
> 
> Behavior:
> 
> * extract any firmware bin, for example NETW_FRMW_LX_R246418.BIN
> * run spsetup.sh:
> ./spsetup.sh 
> ./spsetup.sh: line 124: source: buildVer.sh: file not found
> ./spsetup.sh: line 1471: source: PIEConfig.sh: file not found
> 
> another example:
> 
> ./spsetup.sh
> Collecting inventory...
> ./PV2XX: line 4: source: loadpath.sh: file not found
> ./PV2XX: line 5: source: MAKEDEV.sh: file not found
> 
> 
> It seems that with bash 4, 'source' no longer searches current directory. 
> There are a couple of dirty hacks that seem to work:
> 
> 1) change !/bin/sh to !/bin/bash in spsetup.sh
> 2) provide './' path for all the sourced scripts in spsetup.sh
> typeset -r _BUILDVER="./buildVer.sh"
> 
> I'm not sure whether there is a better way, other than trying to downgrade to 
> bash3. Considering that eventually other distributions will move to bash4, I 
> was wondering if this ought to be fixed upstream.
> 
> 
> Here's a relevant post regarding bash4 on their mailing list:
> 
> http://www.mail-archive.com/bug-bash@gnu.org/msg05840.html
> 
> Unfortunately, setting $PATH to include '.' doesn't seem to work.
> 
> Cheers!



More information about the Linux-PowerEdge mailing list