fix: isolate CHRNX local integration state
This commit is contained in:
16 files changed
+536
-65
No files matched your search
@@ -16,20 +16,31 @@ if [ "$chrnx_image_output" = "/" ] || [ "$chrnx_image_output" = "$chrnx_image_ro
|
||||
echo "Refusing broad image output path: $chrnx_image_output" >&2
|
||||
exit 2
|
||||
fi
|
||||
if [ -L "$chrnx_image_output" ]; then
|
||||
echo "Refusing symbolic-link image output: $chrnx_image_output" >&2
|
||||
exit 2
|
||||
fi
|
||||
if [ "$chrnx_image_output" != "$chrnx_image_default_output" ]; then
|
||||
chrnx_image_safe_tmp=${TMPDIR:-/tmp}
|
||||
chrnx_image_safe_tmp=${chrnx_image_safe_tmp%/}
|
||||
case "$chrnx_image_output" in
|
||||
"$chrnx_image_safe_tmp"/chrnx-*) ;;
|
||||
*)
|
||||
echo "Temporary image output must be an existing chrnx-* directory under $chrnx_image_safe_tmp." >&2
|
||||
exit 2
|
||||
;;
|
||||
esac
|
||||
if [ ! -d "$chrnx_image_output" ]; then
|
||||
echo "Temporary image output does not exist: $chrnx_image_output" >&2
|
||||
exit 2
|
||||
fi
|
||||
chrnx_image_safe_tmp=$(CDPATH= cd -P -- "${TMPDIR:-/tmp}" && pwd)
|
||||
chrnx_image_output_parent=$(dirname -- "$chrnx_image_output")
|
||||
chrnx_image_output_name=$(basename -- "$chrnx_image_output")
|
||||
chrnx_image_output_parent=$(CDPATH= cd -P -- "$chrnx_image_output_parent" && pwd)
|
||||
case "$chrnx_image_output_name" in
|
||||
chrnx-*) ;;
|
||||
*)
|
||||
echo "Temporary image output basename must start with chrnx-." >&2
|
||||
exit 2
|
||||
;;
|
||||
esac
|
||||
if [ "$chrnx_image_output_parent" != "$chrnx_image_safe_tmp" ]; then
|
||||
echo "Temporary image output must be a direct child of $chrnx_image_safe_tmp." >&2
|
||||
exit 2
|
||||
fi
|
||||
chrnx_image_output=$(CDPATH= cd -P -- "$chrnx_image_output" && pwd)
|
||||
fi
|
||||
chrnx_image_tmp=$(mktemp -d "${TMPDIR:-/tmp}/chrnx-images.XXXXXX")
|
||||
trap 'rm -rf -- "$chrnx_image_tmp"' EXIT HUP INT TERM
|
||||
|
||||
Reference in new issue
Block a user