action #34123
closed[kernel]wicked_basic: invalid bash syntax
0%
Description
https://openqa.opensuse.org/tests/647213#step/basic/15
# Result:
for dev in /sys/class/net/!(lo); do grep "down" $dev/operstate || (echo "device $dev is not down" && exit 1) ; done ; echo wKUv9-$?-
-bash: !: event not found
#
Updated by okurz over 6 years ago
- Subject changed from wicked_basic: invalid bash syntax to [kernel]wicked_basic: invalid bash syntax
- Category set to Bugs in existing tests
- Assignee set to asmorodskyi
Updated by asmorodskyi over 6 years ago
PR which suppose to solve problem : https://github.com/os-autoinst/os-autoinst-distri-opensuse/pull/4757.
But currently it still failing , so need further investigations :
Updated by dimstar over 6 years ago
Trying to summarize why this problem appeared all of a sudden and some specialties observed.
The command used by the test is/was:
for dev in /sys/class/net/!(lo); do ...; done
Now, '!' is the character for history expansion. History expansion is automatically disabled in some cases inside a command. According to the bash man page:
Several characters inhibit history expansion if found immediately following the history expansion cheven if it
is unquoted: space, tab, newline, carriage return, and =. If the extglob shell option is enabled, ( will also inhibit
expansion.
so, !( (from !(lo) ) is treated differently if extglob is enabled or disabled.
As for the reason why extglob status changed:
systemd had previously recommended systemd-bash-completion, which in turn required bash-completion. AS this was only one split out, and the same was not done for other shell-completions, the package was merged back into the main systemd package. As this is not explicitly bound to a shell in use, it does neither recommend not require bash-completion (which makes sense).
This, in turn," resulted in bash-completion no longer being auto-installed on a system (I submitted a pattern change to explicitly enable it on regular systems, as users of bash certainly profit from it)
bash-completion itself enables shopt extglob, which is how this all ever worked to start with. Merely a lot of luck
Updated by asmorodskyi over 6 years ago
Issue fixed by moving everything into sh script https://github.com/os-autoinst/os-autoinst-distri-opensuse/pull/4757
Updated by asmorodskyi over 6 years ago
- Status changed from In Progress to Resolved