diff --git a/scripts/meta_optimize_distributed.sh b/scripts/meta_optimize_distributed.sh index 1e149ead..00389b4e 100755 --- a/scripts/meta_optimize_distributed.sh +++ b/scripts/meta_optimize_distributed.sh @@ -52,7 +52,11 @@ if [[ -n "$REMOTE" ]]; then HOST="${REMOTE%%:*}" RPATH="${REMOTE#*:}" echo "[orch] cargo build --release on remote ($HOST:$RPATH)…" >&2 - ( ssh "$HOST" "bash -lc 'cd \"$RPATH\" && cargo build --release --bin paint_meta_opt_worker'" >&2 ) & + # Don't quote $RPATH inside the bash -lc script — leaving it bare + # lets tilde expansion work (cd ~/source/foo). With quotes, bash + # sees "~/source/foo" as a literal pathname and `cd` fails. We + # accept the no-spaces-in-path constraint that comes with this. + ( ssh "$HOST" "bash -lc 'cd $RPATH && cargo build --release --bin paint_meta_opt_worker'" >&2 ) & REMOTE_BUILD_PID=$! fi @@ -87,7 +91,7 @@ if [[ -n "$REMOTE" && "$REMOTE_N" -gt 0 ]]; then echo "[orch] dispatching $REMOTE_N samples to $HOST (serial on remote)…" >&2 ( seq "$LOCAL_N" $((N - 1)) | \ - ssh "$HOST" "bash -lc 'cd \"$RPATH\" && while read -r i; do ./target/release/paint_meta_opt_worker \$i --inner $I --passes $P; done'" + ssh "$HOST" "bash -lc 'cd $RPATH && while read -r i; do ./target/release/paint_meta_opt_worker \$i --inner $I --passes $P; done'" ) >> "$REMOTE_OUT" & REMOTE_PID=$! fi diff --git a/scripts/optimize_distributed.sh b/scripts/optimize_distributed.sh index a94592cb..861f78fd 100755 --- a/scripts/optimize_distributed.sh +++ b/scripts/optimize_distributed.sh @@ -52,7 +52,7 @@ if [[ -n "$REMOTE" ]]; then HOST="${REMOTE%%:*}" RPATH="${REMOTE#*:}" echo "[orch] cargo build --release on remote ($HOST:$RPATH)…" >&2 - ( ssh "$HOST" "bash -lc 'cd \"$RPATH\" && cargo build --release --bin paint_opt_worker'" >&2 ) & + ( ssh "$HOST" "bash -lc 'cd $RPATH && cargo build --release --bin paint_opt_worker'" >&2 ) & REMOTE_BUILD_PID=$! fi @@ -86,7 +86,7 @@ if [[ -n "$REMOTE" && "$REMOTE_N" -gt 0 ]]; then echo "[orch] launching $REMOTE_N remote workers on $HOST…" >&2 # Generate the index list local-side and stream to xargs over ssh. seq "$LOCAL_N" $((N - 1)) | \ - ssh "$HOST" "bash -lc 'cd \"$RPATH\" && xargs -n1 -P$REMOTE_N -I{} ./target/release/paint_opt_worker {}'" \ + ssh "$HOST" "bash -lc 'cd $RPATH && xargs -n1 -P$REMOTE_N -I{} ./target/release/paint_opt_worker {}'" \ >> "$REMOTE_OUT" & REMOTE_PID=$! fi