[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bash different behaviour in jessie versus stretch (maybe a regression?)



I'm no bash expert, but I did take a quick look at bash release notes.  One of
the differences is called out under the heading "New Features In Bash" between
4.4-beta2 and 4.4-rc2:

a.  Using ${a[@]} or ${a[*]} with an array without any assigned elements when
    the nounset option is enabled no longer throws an unbound variable error.

http://git.savannah.gnu.org/cgit/bash.git/tree/CHANGES?id=a0c0a00fc419b7bc08202a79134fcd5bc0427071#n62

I think this change explains the difference in "Version 3".


With version 2, the difference is in how here-strings are handled.

$ echo $BASH_VERSION; od -ta <<<$(echo -e "a\nb\nc")
4.3.30(1)-release
0000000   a  sp   b  sp   c  nl
0000006

$ echo $BASH_VERSION; od -ta <<<$(echo -e "a\nb\nc")
4.4.5(1)-release
0000000   a  nl   b  nl   c  nl
0000006


With this knowledge in hand, I returned to the change notes and found between
4.4-alpha and 4.4-beta:

z.  Bash no longer splits the expansion of here-strings, as the documentation
    has always said.
http://git.savannah.gnu.org/cgit/bash.git/tree/CHANGES?id=a0c0a00fc419b7bc08202a79134fcd5bc0427071#n437

So for better or for worse, I think these changes are both deliberate and
documented in the release notes.

Jeff


Reply to: