From 3a3f0aa76ebf33873fc0230a60390189b7b39e62 Mon Sep 17 00:00:00 2001 From: John Safranek Date: Tue, 15 Sep 2026 10:42:58 -0700 Subject: [PATCH] scripts: widen the ready-file wait to ten seconds The sftp, scp and get-put scripts wait for the echoserver to publish its port before connecting. Two seconds is not enough for a libtool re-exec, the dynamic linker and the sample-key parse with a dozen sibling test jobs on the machine, so a parallel make check failed them at their first scenario. Ten seconds matches what sshclient.test already allows. - raise the three wait loops from 20 to 100 iterations of 0.1 seconds - test -s, not -e, after the loop in scp.test and get-put.test: the ready file is created empty and the port written afterward, so -e can take a file caught mid-write and yield an empty port --- scripts/get-put.test | 6 ++++-- scripts/scp.test | 6 ++++-- scripts/sftp.test | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/scripts/get-put.test b/scripts/get-put.test index 10a30561..1c29fc79 100755 --- a/scripts/get-put.test +++ b/scripts/get-put.test @@ -45,12 +45,14 @@ READY_COUNTER=0 wait_for_server() { - while [ ! -s "$READY_FILE" ] && [ "$READY_COUNTER" -lt 20 ]; do + while [ ! -s "$READY_FILE" ] && [ "$READY_COUNTER" -lt 100 ]; do sleep 0.1 READY_COUNTER=$((READY_COUNTER+ 1)) done - if test -e "$READY_FILE" + # -s, not -e: the echoserver creates the file empty and writes the + # port afterward, so -e can catch it mid-write and yield no port + if [ -s "$READY_FILE" ] then # get created port 0 ephemeral port PORT=$(cat "$READY_FILE") diff --git a/scripts/scp.test b/scripts/scp.test index 20f9737e..b13751e3 100755 --- a/scripts/scp.test +++ b/scripts/scp.test @@ -25,13 +25,15 @@ fi create_port() { # each server gets its own wait budget, the count must not carry over counter=0 - while [ ! -s "$ready_file" ] && [ "$counter" -lt 20 ]; do + while [ ! -s "$ready_file" ] && [ "$counter" -lt 100 ]; do echo -e "waiting for ready file..." sleep 0.1 counter=$((counter+ 1)) done - if test -e $ready_file; then + # -s, not -e: the echoserver creates the file empty and writes the + # port afterward, so -e can catch it mid-write and yield no port + if [ -s "$ready_file" ]; then echo -e "found ready file, starting client..." # get created port 0 ephemeral port diff --git a/scripts/sftp.test b/scripts/sftp.test index 3d5304cf..ac1a0000 100755 --- a/scripts/sftp.test +++ b/scripts/sftp.test @@ -35,7 +35,7 @@ create_port() { # counted per server start, so a slow first start cannot eat the wait # the later ones need counter=0 - while [ ! -s "$ready_file" ] && [ "$counter" -lt 20 ]; do + while [ ! -s "$ready_file" ] && [ "$counter" -lt 100 ]; do echo "waiting for ready file..." sleep 0.1 counter=$((counter+ 1))