[Bash-completion-devel] [bash-completion-Bugs][314720] "set -o posix" in test/config/bashrc breaks bash-valid code.

bash-completion-bugs at alioth.debian.org bash-completion-bugs at alioth.debian.org
Sat Jun 14 15:47:04 UTC 2014


bash-completion-Bugs item #314720 was changed at 14/06/2014 17:47 by Dams Nadé
You can respond by visiting: 
https://alioth.debian.org/tracker/?func=detail&atid=413095&aid=314720&group_id=100114

Status: Open
Priority: 3
Submitted By: Dams Nadé (anvil-guest)
Assigned to: Nobody (None)
Summary: "set -o posix" in test/config/bashrc breaks bash-valid code. 
Distribution: None
Originally reported in: None
Milestone: None
Status: None
Original bug number: 


Initial Comment:
#314716, I've submitted a function with a <() construction. While this is valid bash syntax, it cannot be parsed by bash if posix mode is enabled.

I would say "set -o posix" plays against the "Use the full power of bash >= 4.1" statement from the README file, CONTRIBUTING section.

Since a lot of bash completion code is not POSIX compliant ([[, arrays, extglob, etc....), I would suggest *disabling* posix mode in the test suite bashrc configuration file.

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

Comment By: Dams Nadé (anvil-guest)
Date: 14/06/2014 17:47

Message:
So here are 2 trivial patches. One to disable posix in test/config/bashr, the other to make the  _save_env function result posix-independant. 

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

Comment By: Dams Nadé (anvil-guest)
Date: 14/06/2014 00:02

Message:
Disabling posix in test/config/bashrc actually breaks the test suite, but I think I've found the issue.

When posix is enabled, the "set" command (without any parameter) only shows variables, but when posix is disabled the same "set" command will also print functions definitions (with full functions body).

So depending of the posix option setting, the _save_env function in test/lib/library.exp will not dump the same things. So the function should be instead :

proc _save_env {{file ""}} {
    assert_bash_exec "{ (set -o posix ; set); declare -F; shopt -p; } > \"$file\""
}

I think it's okay to do this, because it's not about posix itself, it's more about the content we want to compare. 

( And maybe the _save_env should also dump "set -o" output, so that we know bash_completion does not change bash behaviour )

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

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



More information about the Bash-completion-devel mailing list