From 129f233e0a6af3aa7fb84fb9d6377f431477ce41 Mon Sep 17 00:00:00 2001 From: Brandon Walter <51866976+echoparkbaby@users.noreply.github.com> Date: Wed, 13 May 2026 10:29:03 -0700 Subject: [PATCH] fix: stdbuf -oL on the tr pipe (1.0.0-58) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1.0.0-57's tr-pipe fix delivered \n-terminated progress lines but tr's stdout is block-buffered (4 KB chunks) when its destination is a pipe — and the SSH channel is a pipe. At ~50 bytes per badblocks progress line, that means ~80 lines accumulate (~6 minutes at our throughput) before tr flushes anything. stdbuf -oL forces tr's stdout to line-buffered mode. Each \n now triggers a flush. Progress lines reach asyncssh as they happen. --- app/burnin/stages.py | 10 +++++----- app/config.py | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/burnin/stages.py b/app/burnin/stages.py index 15ad3ca..c657368 100644 --- a/app/burnin/stages.py +++ b/app/burnin/stages.py @@ -124,11 +124,11 @@ def _build_badblocks_cmd(devname: str) -> str: f"-p {settings.surface_validate_passes} " f"/dev/{devname} 2>&1" ) - # The outer pipeline lets tr translate \\b → \\n. Single quotes - # around the inner script prevent the host shell from interpreting - # $$. The tr argument uses $'\\b' / $'\\n' escapes — POSIX shells - # interpret these as the literal backspace and newline bytes. - return f"sh -c '{inner}' | tr '\\b' '\\n'" + # The outer pipeline lets tr translate \\b → \\n. stdbuf -oL forces + # tr's stdout to line-buffered mode; without it tr's stdout is + # block-buffered (4 KB chunks) when its destination is a pipe, + # which delays each progress line by ~6 minutes at our throughput. + return f"sh -c '{inner}' | stdbuf -oL tr '\\b' '\\n'" from . import kill from ._common import ( diff --git a/app/config.py b/app/config.py index df93830..351ee4a 100644 --- a/app/config.py +++ b/app/config.py @@ -86,7 +86,7 @@ class Settings(BaseSettings): ssh_key: str = "" # PEM private key content (paste full key including headers) # Application version — used by the /api/v1/updates/check endpoint - app_version: str = "1.0.0-57" + app_version: str = "1.0.0-58" # ---- Authentication (1.0.0-22) ---- # session_secret: HMAC key for signing session cookies. Empty = generate