Fix a bug with a symlink dir not resolving correctly. (#7148)
Some checks failed
Build Docker Image / amd64 & arm64 (push) Has been cancelled

Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
This commit is contained in:
BruebachL 2026-08-18 21:50:12 +02:00 committed by GitHub
parent 06762ea7b4
commit 919b9d92ac
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -11,6 +11,7 @@ set -o pipefail
# go to the project root directory, this file should be located in the project root directory # go to the project root directory, this file should be located in the project root directory
olddir="$PWD" olddir="$PWD"
cd "${BASH_SOURCE%/*}/" || exit 2 # could not find path, this could happen with special links etc. cd "${BASH_SOURCE%/*}/" || exit 2 # could not find path, this could happen with special links etc.
phys_root="$(pwd -P)"
# defaults # defaults
include=("cockatrice/src" \ include=("cockatrice/src" \
@ -168,14 +169,14 @@ EOM
echo "error in parsing arguments of $0: $1 is an unrecognized option" >&2 echo "error in parsing arguments of $0: $1 is an unrecognized option" >&2
exit 2 # input error exit 2 # input error
fi fi
if [[ ! $1 ]] || next_dir=$(cd "$olddir" && cd -- "$1" && pwd); then if [[ ! $1 ]] || next_dir=$(cd "$olddir" && cd -- "$1" && pwd -P); then
if ! [[ $set_include ]]; then if ! [[ $set_include ]]; then
include=() # remove default includes include=() # remove default includes
set_include=1 set_include=1
fi fi
if [[ $1 ]]; then if [[ $1 ]]; then
if [[ $next_dir != $PWD/* ]]; then if [[ "$next_dir" != "$phys_root" && "$next_dir" != "$phys_root"/* ]]; then
echo "error in parsing arguments of $0: $next_dir is not in $PWD" >&2 echo "error in parsing arguments of $0: $next_dir is not in $phys_root" >&2
exit 2 # input error exit 2 # input error
fi fi
include+=("$next_dir") include+=("$next_dir")