From 1b5b03b3ce4187ce99bad580fd0ee36c6337313f Mon Sep 17 00:00:00 2001 From: Roger Pau Monne Date: Wed, 13 Dec 2023 14:51:47 +0100 Subject: [PATCH] livepatch-build-tools: fix misuse of script directory as work directory MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit It's incorrect to assume that the script directory will always match the directory the script is executed from. Instead cache the directory at the start of script execution in order to be able to get back to it if needed. Fixes: 629ab8ddb775 ('livepatch-build-tools: do not use readlink -m option') Signed-off-by: Roger Pau Monné Reviewed-by: Ross Lagerwall Signed-off-by: Ross Lagerwall --- livepatch-build | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/livepatch-build b/livepatch-build index e2ccce4..cdb852c 100755 --- a/livepatch-build +++ b/livepatch-build @@ -25,6 +25,7 @@ # script. SCRIPTDIR="$(readlink -f $(dirname $(type -p $0)))" +WORKDIR="$(readlink -f -- .)" CPUS="$(getconf _NPROCESSORS_ONLN)" DEBUG=n XEN_DEBUG=n @@ -455,7 +456,7 @@ if [ "${SKIP}" != "build" ]; then fi if [ "${SKIP}" != "diff" ]; then - cd "${SCRIPTDIR}" || die + cd "${WORKDIR}" || die [ -d "$outputarg" ] || die "Output directory does not exist" OUTPUT="$(readlink -f -- "$outputarg")" -- 2.39.5