[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bash-snapshot: 'unset IFS' ignored under very specific circumstances
From: |
Martijn Dekker |
Subject: |
bash-snapshot: 'unset IFS' ignored under very specific circumstances |
Date: |
Sun, 10 Sep 2017 02:10:20 +0200 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:52.0) Gecko/20100101 Thunderbird/52.1.1 |
The bug test suite in my modernish shell library exposed a bug in the
current bash development snapshot. As far as I've been able to trace,
the following bug was introduced by bash-snap-20170620 (commit
d7d836dfc55b937f463f601ba5117d6442053089).
I've been able to distil the following test case:
set -o posix
fn() {
IFS= read junk </dev/null
unset -v IFS
[[ -v IFS ]] && echo BUG || echo ok
}
fn
Output: BUG (i.e.: IFS is still set)
Expected output: ok (i.e.: IFS was successfully unset)
"unset -v IFS" (or "unset IFS") is ignored under specific circumstances.
All the four circumstances of the test script seem to need to be present
to trigger the bug:
- the variable needs to be IFS and no other;
- POSIX mode needs to be active;
- it needs to be in a function;
- the 'read' command needs to be executed with an IFS assignment (and no
other command; even "IFS= builtin read junk </dev/null" does not trigger
the bug)
Repeating the "unset -v IFS" command is an effective workaround; it only
seems to fail the once.
- M.
- bash-snapshot: 'unset IFS' ignored under very specific circumstances,
Martijn Dekker <=