This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH MIPS] Work around Bash 4.2 bug
- From: ludo at gnu dot org (Ludovic Courtès)
- To: "Maciej W. Rozycki" <macro at imgtec dot com>
- Cc: Hans-Peter Nilsson <hp at bitrange dot com>, Nick Clifton <nickc at redhat dot com>, <binutils at sourceware dot org>, <gcc at gcc dot gnu dot org>
- Date: Mon, 03 Oct 2016 16:09:02 +0200
- Subject: Re: [PATCH MIPS] Work around Bash 4.2 bug
- Authentication-results: sourceware.org; auth=none
- References: <87d1jlrar1.fsf@gnu.org> <alpine.BSF.2.02.1609300615410.31642@arjuna.pair.com> <alpine.DEB.2.00.1610022006430.11928@tp.orcam.me.uk>
"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’.