Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(dracut): be more robust when using 'set -u'
From bash manpage, FUNCNAME exists only inside functions. When in debug mode, make sure to use an empty default value as FUNCNAME[0] when outside of functions. With bash4 this wasn't an issue, but is with bash5 with hardening option 'set -u' used, as shown in the example below: Incorrect: $ bash -u -c 'echo -n ${FUNCNAME[0]}' bash: line 1: FUNCNAME[0]: unbound variable $ Correct: $ bash -u -c 'echo -n ${FUNCNAME[0]-}' $ This hardening enables sourcing dracut-lib.sh from external utilities executing in the initramfs such as clevis-luks-askpass, which uses hardening option 'set -u' internally. (see Clevis PR latchset/clevis#340) Signed-off-by: Renaud Métrich <rmetrich@redhat.com>
- Loading branch information