From bafc82e7320f17c73874d838a9d2d1fe1c8cd060 Mon Sep 17 00:00:00 2001 From: David Disseldorp Date: Mon, 10 Oct 2016 16:27:47 +0200 Subject: [PATCH] dracut.sh: support --tmpdir as a relative path Dracut changes working directory before attempting to output files under $DRACUT_TMPDIR , resulting in an IO failure if $DRACUT_TMPDIR is a path relative to the working directory when dracut was started. Fixes: https://github.com/dracutdevs/dracut/issues/156 Signed-off-by: David Disseldorp --- dracut.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/dracut.sh b/dracut.sh index 40ca08f65..a30e8d9de 100755 --- a/dracut.sh +++ b/dracut.sh @@ -820,7 +820,11 @@ esac [[ $reproducible == yes ]] && DRACUT_REPRODUCIBLE=1 -readonly TMPDIR="$tmpdir" +readonly TMPDIR="$(realpath -e "$tmpdir")" +[ -d "$TMPDIR" ] || { + printf "%s\n" "dracut: Invalid tmpdir '$tmpdir'." >&2 + exit 1 +} readonly DRACUT_TMPDIR="$(mktemp -p "$TMPDIR/" -d -t dracut.XXXXXX)" [ -d "$DRACUT_TMPDIR" ] || { printf "%s\n" "dracut: mktemp -p '$TMPDIR/' -d -t dracut.XXXXXX failed." >&2 -- 2.47.2