mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-11 15:46:53 +00:00
fix: isolate ssh stdin in hotpath artifact collection (#5851)
Co-authored-by: heihutu <heihutu@gmail.com>
This commit is contained in:
@@ -89,7 +89,7 @@ while IFS= read -r line || [[ -n "$line" ]]; do
|
||||
|
||||
quoted_remote_dir=$(shell_quote "$remote_dir")
|
||||
remote_cmd="chmod -R a+rX $quoted_remote_dir; find $quoted_remote_dir -maxdepth 1 -type f -printf '%f %s bytes\n'"
|
||||
"$SSH_BIN" "$node" "sudo su - root -c $(shell_quote "$remote_cmd")" >"$OUT_DIR/${node}-files.txt" 2>&1
|
||||
"$SSH_BIN" "$node" "sudo su - root -c $(shell_quote "$remote_cmd")" >"$OUT_DIR/${node}-files.txt" 2>&1 </dev/null
|
||||
"$SCP_BIN" -q -r "$node:${remote_dir%/}/"* "$node_out_dir/" </dev/null 2>"$OUT_DIR/${node}-scp.err"
|
||||
processed=$((processed + 1))
|
||||
done <"$MAPPING"
|
||||
|
||||
@@ -11,6 +11,10 @@ mkdir -p "$mock_bin"
|
||||
cat >"$mock_bin/ssh" <<'EOF'
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
if read -r consumed; then
|
||||
printf 'ssh-consumed-stdin:%s\n' "$consumed" >>"$CALL_LOG"
|
||||
exit 24
|
||||
fi
|
||||
printf 'ssh:%s\n' "$*" >>"$CALL_LOG"
|
||||
echo "profile.json.gz 128 bytes"
|
||||
echo "profile.syms.json 64 bytes"
|
||||
@@ -47,7 +51,12 @@ output=$("$repo_root/scripts/collect_remote_samply_artifacts.sh" \
|
||||
[[ "$output" == "collected_nodes=2" ]]
|
||||
[[ -f "$tmp_dir/out/vm004/copied-profile.json.gz" ]]
|
||||
[[ -f "$tmp_dir/out/vm005/copied-profile.json.gz" ]]
|
||||
[[ "$(grep -c '^ssh:' "$CALL_LOG")" -eq 2 ]]
|
||||
[[ "$(grep -c '^scp:' "$CALL_LOG")" -eq 2 ]]
|
||||
if grep -q '^ssh-consumed-stdin:' "$CALL_LOG"; then
|
||||
echo "ssh consumed the mapping loop stdin" >&2
|
||||
exit 1
|
||||
fi
|
||||
if grep -q '^scp-consumed-stdin:' "$CALL_LOG"; then
|
||||
echo "scp consumed the mapping loop stdin" >&2
|
||||
exit 1
|
||||
|
||||
Reference in New Issue
Block a user