Bug 1109736
Summary: | Undocumented behaviour change in bash 4.3 | ||
---|---|---|---|
Product: | [Fedora] Fedora | Reporter: | Simone Caronni <negativo17> |
Component: | bash | Assignee: | Ondrej Oprala <ooprala> |
Status: | CLOSED NOTABUG | QA Contact: | Fedora Extras Quality Assurance <extras-qa> |
Severity: | unspecified | Docs Contact: | |
Priority: | unspecified | ||
Version: | rawhide | CC: | admiller, ooprala, ovasik, raselmsh, robatino |
Target Milestone: | --- | ||
Target Release: | --- | ||
Hardware: | Unspecified | ||
OS: | Unspecified | ||
Whiteboard: | |||
Fixed In Version: | Doc Type: | Bug Fix | |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2014-06-17 13:26:04 UTC | Type: | Bug |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: | |||
Bug Depends On: | |||
Bug Blocks: | 1104253 |
Description
Simone Caronni
2014-06-16 09:36:00 UTC
This is introduced here: http://git.savannah.gnu.org/cgit/bash.git/commit/?id=3b34f6e68ce94b15608a49feb62702a71bc18665 Michael is right, this was buggy behaviour fixed by patchlevel 14. To explain: According to man pages, ${arr[@]} expands the array into separate words (analogous to the expansion of $@). Quoting the man page: 'That is, "$@" is equivalent to "$1" "$2" ...' So what it basically becomes in your example is <value-of-arr0><separator><value-of-arr1>. Substituting the relevant piece of code with [[ \"${arr[@]}\\" ]] demonstrates this well. There are minor distinctions in expanding using * and @. The man page states: "If the word is double-quoted, ${name[*]} expands to a single word with the value of each array member separated by the first character of the IFS special variable". Meaning, the correct way to write your example line and get the behaviour you want is: bash -x -c 'IFS=; arr[0]=; arr[1]=; [[ "${arr[*]}" ]] || echo false' Correction: Substituting the relevant piece of code with [[ \"${arr[@]}\" ]] demonstrates this well. Thanks for the explanation. This is really big, we probably need to audit all the code as this has been built on foundations like this since 2000'. No problem. And yes, it's actually the most common use, that's always been the undocumented one :/ . |