Skip to content

hal: Gate the loadusr "Waiting for component" pacifier on a tty - #4290

Open
grandixximo wants to merge 1 commit into
LinuxCNC:masterfrom
grandixximo:halcmd-pacifier-tty
Open

hal: Gate the loadusr "Waiting for component" pacifier on a tty#4290
grandixximo wants to merge 1 commit into
LinuxCNC:masterfrom
grandixximo:halcmd-pacifier-tty

Conversation

@grandixximo

Copy link
Copy Markdown
Contributor

Fixes #4287.

Problem

The pyvcp test (and any test comparing captured output) flakes on slow or busy CI:

+Waiting for component 'mypanel' to become ready....
 mypanel float OUT 0 mypanel.dial-a-out
 ...

The "Waiting for component..." pacifier is printed by halcmd's loadusr -Wn to stderr after 2 s of waiting. It lands in the test's result file anyway because Ubuntu 24.04's xvfb-run executes the wrapped command with "$@" 2>&1, merging stderr into stdout (Debian's and upstream xorg's xvfb-run keep the streams separate). On a loaded ubuntu CI runner, pyvcp takes >2 s to become ready, the pacifier fires, and the merged output breaks the compare against expected. The sed '/mypanel/!d' in the test keeps the line because it contains the component name.

I reproduced this byte-identically on a Debian host by extracting Ubuntu noble's xvfb-run (xvfb_21.1.12-1ubuntu1.8_amd64.deb), delaying pyvcp startup with a sleep wrapper, and saturating the CPU.

Fix

The pacifier is a progress indication for an interactive user; in batch use it is pure noise. Only print it when stderr is a terminal, in both halcmd and halrmt. The warn_newly_loaded_comps diagnostic (wrong -Wn name hint) is unaffected and still prints.

Also fixes halcmd printing the terminating newline from count >= 100 even though the pacifier itself only starts at count == 200.

Testing

  • Ubuntu xvfb-run + delayed pyvcp + saturated CPU: was XFAIL with the exact CI diff, now passes with no output pollution.
  • Pacifier still appears when stderr is a tty.
  • Full runtests suite: 291/291 pass.

On a slow or busy machine, loadusr -W/-Wn prints "Waiting for
component '...' to become ready..." to stderr after two seconds.
That message is meant for an interactive user, but in batch use
(scripts, the test suite) it is noise. Worse: Ubuntu's xvfb-run
merges the wrapped command's stderr into its stdout, so on a
loaded ubuntu CI runner the pacifier lands in a test's captured
output and breaks the compare against the expected file.

Only print the pacifier when stderr is a terminal, in both halcmd
and halrmt. Also fix halcmd printing the terminating newline from
count >= 100 even though the pacifier itself only starts at
count == 200.

Fixes LinuxCNC#4287
@grandixximo
grandixximo requested a review from BsAtHome July 30, 2026 03:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Test pyvcp timing issue on slow CI

1 participant