diff --git a/client/icecc-create-env.in b/client/icecc-create-env.in index 86c2261b0..a5c372afb 100755 --- a/client/icecc-create-env.in +++ b/client/icecc-create-env.in @@ -81,10 +81,14 @@ resolve_path() # This could use realpath, but that's reportedly not that widely available. convert_path_cdup () { - local filename="$1" - local directory=$(dirname $filename) - local fixed_directory=$(cd "$directory" >/dev/null && pwd) - echo ${fixed_directory}/$(basename $filename) + # Remove all /./ sequences. + local path=${1//\/.\//\/} + + # Remove dir/.. sequences. + while [[ $path =~ ([^/][^/]*/\.\./) ]]; do + path=${path/${BASH_REMATCH[0]}/} + done + echo $path } add_file () @@ -584,7 +588,7 @@ md5=$(for i in $target_files; do $md5sum $tempdir/$i; done | sed -e "s# $tempdir echo "creating $md5.tar$compress_ext" mydir=$(pwd) cd $tempdir -tar -ch --numeric-owner -f - $target_files | "$compress_program" $compress_args > "$md5".tar"$compress_ext" || { +tar -ch --numeric-owner -P -f - $target_files | "$compress_program" $compress_args > "$md5".tar"$compress_ext" || { echo "Couldn't create archive" exit 3 }