This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH MIPS] Work around Bash 4.2 bug


"Maciej W. Rozycki" <macro@imgtec.com> skribis:

> On Fri, 30 Sep 2016, Hans-Peter Nilsson wrote:
>
>> > The patch below works around the Bash 4.2 bug described at
>> > <http://ftp.gnu.org/gnu/bash/bash-4.2-patches/bash42-007>.
>> 
>> > 	* emulparams/elf32bmipn32-defs.sh: Shift quote of
>> > 	"x$EMULATION_NAME" to the left to work around
>> > 	<http://ftp.gnu.org/gnu/bash/bash-4.2-patches/bash42-007>.
>> >
>> 
>> >
>> > -case x"$EMULATION_NAME" in
>> > +case "x$EMULATION_NAME" in
>> >  xelf32*n32*) ELFSIZE=32 ;;

[...]

>  Also for the purpose of such a check what does x"$EMULATION_NAME" expand 
> to in the buggy case given a specific value of $EMULATION_NAME?

Here’s a sample:

--8<---------------cut here---------------start------------->8---
$ echo $BASH_VERSION
4.2.0(1)-release
$ unset EMULATION_NAME
$ echo x$EMULATION_NAME
x
$ echo x"$EMULATION_NAME"
x
$ case x"$EMULATION_NAME" in x) echo good;; *) echo bad;; esac
bad
$ case "x$EMULATION_NAME" in x) echo good;; *) echo bad;; esac
good
$ echo x"$EMULATION_NAME"y
xy
$ echo "x$EMULATION_NAME"y
xy
--8<---------------cut here---------------end--------------->8---

IOW, the problem manifests in ‘case’ statements, but not in ‘echo’.

I agree that rejecting such buggy shells at configure time would be
safer.

There’s been 1 year between Bash 4.2 and Bash 4.3, and 3 weeks between
Bash 4.2 and the ‘bash42-007’ fix; not sure how widespread the buggy
shell is.

HTH,
Ludo’.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]