Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bash in POSIX mode #2522

Open
aafeijoo-suse opened this issue Sep 21, 2023 · 1 comment · May be fixed by #2524
Open

Bash in POSIX mode #2522

aafeijoo-suse opened this issue Sep 21, 2023 · 1 comment · May be fixed by #2524
Labels
bug Our bugs

Comments

@aafeijoo-suse
Copy link
Member

localhost:~ # bash --version
GNU bash, version 4.4.23(1)-release (x86_64-suse-linux-gnu)
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
localhost:~ # export POSIXLY_CORRECT=y
localhost:~ # dracut -f
dracut: Executing: /usr/bin/dracut -f
/usr/lib/dracut/modules.d/00systemd/module-setup.sh: line 162: syntax error near unexpected token `<'
/usr/lib/dracut/modules.d/00systemd/module-setup.sh: line 162: `    mapfile -t _mods < <(modules_load_get /usr/lib/modules-load.d)'

Apparently some bashisms silently work with recent versions of Bash (tested ok > 5.1), but maybe we should workaround this issue for consistency. I see 2 options:

  1. unset POSIXLY_CORRECT at the beginning of dracut.sh.
  2. Also check [[ -n $POSIXLY_CORRECT ]] along with the Bash version, and exit in that case.

But if we decide to fix this, IMO the 2nd option is the best, because some scripts added by modules running at boot require bashisms.

@aafeijoo-suse aafeijoo-suse added the bug Our bugs label Sep 21, 2023
aafeijoo-suse added a commit to aafeijoo-suse/dracut that referenced this issue Sep 22, 2023
@aafeijoo-suse aafeijoo-suse linked a pull request Sep 22, 2023 that will close this issue
3 tasks
aafeijoo-suse added a commit to aafeijoo-suse/dracut that referenced this issue Oct 27, 2023
@bdrung
Copy link
Contributor

bdrung commented Apr 7, 2024

IMO better try to address the bashisms so that the generated initramfs can be used with dash or busybox.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Our bugs
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants