Commit a7aabbc
fix: Properly handle environments with unset IFS
Prior to this commit, the current state of `IFS` was stored into a local
variable `ifs`. Later, IFS is restored by setting `IFS=$ifs`. If the
user starts with either a set `IFS` or an empty `IFS`, then this
behavior is correct. If the user starts with an unset `IFS`, then
`IFS=$ifs` results in an empty `IFS`, which is not the original state.
Most of the time an empty `IFS` is not desired, and indeed it breaks
some things inside bash-completions. eg
```
unset IFS
local ifs=$IFS IFS=$' \t\n'
restore=$(shopt -po noglob)
IFS=$ifs
$restore
...
-bash: set -o noglob: command not found
```
With this commit, all instances of `local ifs=$IFS` have been removed.
Instead, the `local IFS` is dynamically unset.1 parent a66ae99 commit a7aabbc
File tree
5 files changed
+55
-24
lines changed- completions
- test/t/unit
5 files changed
+55
-24
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
149 | 149 | | |
150 | 150 | | |
151 | 151 | | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
152 | 169 | | |
153 | 170 | | |
154 | 171 | | |
| |||
721 | 738 | | |
722 | 739 | | |
723 | 740 | | |
724 | | - | |
| 741 | + | |
725 | 742 | | |
726 | 743 | | |
727 | 744 | | |
728 | 745 | | |
729 | | - | |
| 746 | + | |
730 | 747 | | |
731 | 748 | | |
732 | 749 | | |
| |||
1253 | 1270 | | |
1254 | 1271 | | |
1255 | 1272 | | |
1256 | | - | |
1257 | | - | |
| 1273 | + | |
1258 | 1274 | | |
1259 | 1275 | | |
1260 | 1276 | | |
1261 | 1277 | | |
1262 | 1278 | | |
1263 | | - | |
| 1279 | + | |
1264 | 1280 | | |
1265 | 1281 | | |
1266 | 1282 | | |
| |||
1751 | 1767 | | |
1752 | 1768 | | |
1753 | 1769 | | |
1754 | | - | |
| 1770 | + | |
1755 | 1771 | | |
1756 | 1772 | | |
1757 | 1773 | | |
| |||
1817 | 1833 | | |
1818 | 1834 | | |
1819 | 1835 | | |
1820 | | - | |
| 1836 | + | |
1821 | 1837 | | |
1822 | 1838 | | |
1823 | 1839 | | |
| |||
1873 | 1889 | | |
1874 | 1890 | | |
1875 | 1891 | | |
1876 | | - | |
| 1892 | + | |
1877 | 1893 | | |
1878 | 1894 | | |
1879 | 1895 | | |
| |||
1935 | 1951 | | |
1936 | 1952 | | |
1937 | 1953 | | |
1938 | | - | |
1939 | 1954 | | |
1940 | 1955 | | |
1941 | 1956 | | |
| |||
2349 | 2364 | | |
2350 | 2365 | | |
2351 | 2366 | | |
2352 | | - | |
| 2367 | + | |
2353 | 2368 | | |
2354 | 2369 | | |
2355 | 2370 | | |
2356 | 2371 | | |
2357 | | - | |
| 2372 | + | |
2358 | 2373 | | |
2359 | 2374 | | |
2360 | 2375 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
52 | | - | |
| 52 | + | |
53 | 53 | | |
54 | | - | |
| 54 | + | |
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
29 | | - | |
30 | | - | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| |||
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
52 | | - | |
53 | 52 | | |
54 | 53 | | |
55 | 54 | | |
56 | 55 | | |
57 | 56 | | |
58 | 57 | | |
59 | | - | |
| 58 | + | |
60 | 59 | | |
61 | | - | |
| 60 | + | |
62 | 61 | | |
63 | 62 | | |
64 | 63 | | |
65 | 64 | | |
66 | | - | |
| 65 | + | |
67 | 66 | | |
68 | 67 | | |
69 | | - | |
| 68 | + | |
70 | 69 | | |
71 | 70 | | |
72 | 71 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
47 | | - | |
48 | | - | |
| 47 | + | |
49 | 48 | | |
50 | | - | |
| 49 | + | |
51 | 50 | | |
52 | 51 | | |
53 | 52 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
0 commit comments