[Bash-completion-devel] [bash-completion-Bugs][314708] Array element unset needs to be quoted

bash-completion-bugs at alioth.debian.org bash-completion-bugs at alioth.debian.org
Tue Jun 3 20:12:01 UTC 2014


bash-completion-Bugs item #314708 was changed at 2014-06-03 23:12 by Ville Skyttä
You can respond by visiting: 
https://alioth.debian.org/tracker/?func=detail&atid=413095&aid=314708&group_id=100114

>Status: Closed
Priority: 3
Submitted By: Dams Nadé (anvil-guest)
Assigned to: Nobody (None)
Summary: Array element unset needs to be quoted 
Distribution: None
Originally reported in: None
Milestone: 2.0
>Status: Fix Committed
Original bug number: 


Initial Comment:
unsetting an array element needs to be quoted to prevent globbing to interfer.

See this example :
[anvil at tartine ~/git/bash-completion]# LC_ALL=en_US bash
[anvil at tartine bash-completion]$ shopt -s failglob
[anvil at tartine bash-completion]$ foo=(1 2 3)
[anvil at tartine bash-completion]$ unset foo[1]
bash: no match: foo[1]
[anvil at tartine bash-completion]$ unset 'foo[1]' ; echo $?
0

Please consider applying attached patch, which fixes a bunch of issues when using failglob.

Without attached patch :
-# of expected passes       648
-# of unexpected failures   45
-# of unresolved testcases  33
With :
+# of expected passes       673
+# of unexpected failures   23
+# of unresolved testcases  29


----------------------------------------------------------------------

>Comment By: Ville Skyttä  (scop-guest)
Date: 2014-06-03 23:12

Message:
Applied, thanks

----------------------------------------------------------------------

Comment By: Dams Nadé (anvil-guest)
Date: 2014-06-03 23:00

Message:
Here is a second patch, with the same problem, this time in completion files.

It fixes crontab, cvs, badblocks, find, info, lvm, modprobe, protoc and qdbus when used with failglob.

----------------------------------------------------------------------

Comment By: Ville Skyttä  (scop-guest)
Date: 2014-06-03 13:55

Message:
When I tested this yesterday, I found that quoting it also failed to actually unset anything. Now I can't reproduce that finding, I suppose I did something silly/faulty.

Looks like the bash man page contains a subtle hint about the necessity of quoting:

"unset name[subscript] destroys the array element at index subscript. Care must be taken to avoid unwanted side effects caused by pathname expansion."

----------------------------------------------------------------------

You can respond by visiting: 
https://alioth.debian.org/tracker/?func=detail&atid=413095&aid=314708&group_id=100114



More information about the Bash-completion-devel mailing list