Skip to content

Commit 7762eb2

Browse files
committed
scripts: fix put command in gceworker.sh
In #125154 we added a put command to send files to a gceworker via scp. The scp command allows for multiple source files, but it was using a scalar bash variable to hold the sourcepaths. This variable was not handling paths with spaces properly. For example: ``` % touch my\ file.txt % scripts/gceworker.sh put 'my file.txt' /usr/bin/scp: stat local "my": No such file or directory ERROR: (gcloud.compute.scp) [/usr/bin/scp] exited with return code [255]. ``` The fix is to use a bash array to hold the source paths, and to add quoting. With this fix it works correctly: ``` % touch my\ file.txt % scripts/gceworker.sh put 'my file.txt' my file.txt 100% 0 0.0KB/s 00:00 ``` Epic: None Release note: None
1 parent ac39c2e commit 7762eb2

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

scripts/gceworker.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -243,14 +243,14 @@ put)
243243
echo "or: $0 put sourcepath"
244244
exit 1
245245
elif (($# == 1)); then
246-
lpath="${1}"
246+
lpaths=("${1}")
247247
rpath="~"
248248
else
249-
lpath="${@:1:$#-1}"
249+
lpaths=("${@:1:$#-1}")
250250
rpath="${@: -1}"
251251
fi
252252
to="${NAME}:${rpath}"
253-
gcloud compute scp --recurse ${lpath} "${to}"
253+
gcloud compute scp --recurse "${lpaths[@]}" "${to}"
254254
;;
255255
ip)
256256
echo "$(get_ip)"

0 commit comments

Comments
 (0)