Summary: | app-shells/bash-5.0: posix-mode problem with variable scoping | ||
---|---|---|---|
Product: | Gentoo Linux | Reporter: | Alexander Tsoy <alexander> |
Component: | Current packages | Assignee: | Gentoo's Team for Core System packages <base-system> |
Status: | RESOLVED FIXED | ||
Severity: | normal | ||
Priority: | Normal | ||
Version: | unspecified | ||
Hardware: | All | ||
OS: | Linux | ||
URL: | https://lists.gnu.org/archive/html/bug-bash/2019-01/msg00260.html | ||
Whiteboard: | |||
Package list: | Runtime testing required: | --- | |
Bug Depends on: | |||
Bug Blocks: | 676268 | ||
Attachments: | test.sh |
Could you report this to the bash bugs list? https://lists.gnu.org/mailman/listinfo/bug-bash Upstream said that this behaviour will not change until next version of bash (bash-5.1?) https://lists.gnu.org/archive/html/bug-bash/2019-01/msg00262.html Sounds like dracut will need to work around this then. (In reply to Alexander Tsoy from comment #2) > Upstream said that this behaviour will not change until next version of bash > (bash-5.1?) > https://lists.gnu.org/archive/html/bug-bash/2019-01/msg00262.html His answer terrorfied me: Clearly you shouldn't use bash --posix mode in a nuclear power grid. By the way: Why does't it error out early, when seeing an undefined posix "local" ? Or is it a common commenting feature to ignore it, when there is something unidentified, like for example: --- #!/bin/sh Holy_Shit_just_saying myvar=something No, it is not a commenting feature: --- test: line 8: Holy_Shit_just_saying: command not found foo: hello world bar: hello world The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=94f68f9a36e6771e06bc39ad0286121e8956121c commit 94f68f9a36e6771e06bc39ad0286121e8956121c Author: Lars Wendler <polynomial-c@gentoo.org> AuthorDate: 2019-03-20 18:24:48 +0000 Commit: Lars Wendler <polynomial-c@gentoo.org> CommitDate: 2019-03-20 18:25:08 +0000 app-shells/bash: Attempt to fix variable scoping in POSIX mode. Bug: https://bugs.gentoo.org/676344 Package-Manager: Portage-2.3.62, Repoman-2.3.12 Signed-off-by: Lars Wendler <polynomial-c@gentoo.org> app-shells/bash/bash-5.0_p3-r1.ebuild | 267 +++++++++++++++++++++ .../bash-5.0-assignment-preceding-builtin.patch | 83 +++++++ 2 files changed, 350 insertions(+) No more input. Assuming it being fixed with current bash-5.0 patch releases. |
Created attachment 562926 [details] test.sh There is some weird problem in posix-mode with variable scoping when creating variables from assignment statements preceding function calls. See attached test case. $ bash --posix test.sh foo: bye bye bar: hello world $ bash test2.sh foo: hello world bar: hello world This bug currently breaks dracut.