Skip to content

Commit

Permalink
allow non-existent paths to be used for addfile remapping
Browse files Browse the repository at this point in the history
  • Loading branch information
dmoody256 committed Jul 9, 2020
1 parent 251dbb5 commit 70863bb
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions client/icecc-create-env.in
Original file line number Diff line number Diff line change
Expand Up @@ -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 ()
Expand Down Expand Up @@ -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
}
Expand Down

0 comments on commit 70863bb

Please sign in to comment.