From f2f16c8920b81a74e554cf1e108b769e51c24b53 Mon Sep 17 00:00:00 2001 From: Pablo Alessandro Santos Hugen Date: Tue, 28 Oct 2025 15:55:38 -0300 Subject: [PATCH] test/integration: Use realpath for paths and validate env vars in `rebase_patches` A trailing slash in $SRCDIR breaks the backup `cp` command by placing the ".orig" copy inside $SRCDIR instead of alongside it. This causes the subsequent diff to fail. Fix this by using `realpath` to canonicalize $SRCDIR. Additionally, add checks for required $SRCDIR, $ID, and $VERSION_ID env vars. Signed-off-by: Pablo Alessandro Santos Hugen --- test/integration/rebase-patches | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/test/integration/rebase-patches b/test/integration/rebase-patches index 64faed6ca..edcecd17f 100755 --- a/test/integration/rebase-patches +++ b/test/integration/rebase-patches @@ -18,9 +18,15 @@ # ID=rhel VERSION_ID=7.8 ./rebase-patches rhel-7.7/*{.patch,.disabled} # % cp rhel-7.7/*.test rhel-7.8/ -OUTDIR=$(pwd)/${ID}-${VERSION_ID} -mkdir -p "$OUTDIR" +if [ -z "$SRCDIR" ] || [ -z "$ID" ] || [ -z "$VERSION_ID" ]; then + echo "ERROR: SRCDIR, ID, and VERSION_ID environment variables must be set" + exit 1 +fi + +SRCDIR="$(realpath "$SRCDIR")" +OUTDIR="$(realpath "${ID}"-"${VERSION_ID}")" +mkdir -p "$OUTDIR" echo "* Making backup copy of kernel sources" rm -rf "${SRCDIR}.orig" cp -r "$SRCDIR" "${SRCDIR}.orig"