Skip to content

Bash in POSIX mode #2522

Open
Open
@aafeijoo-suse

Description

@aafeijoo-suse
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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugOur bugs

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions