Page MenuHomeVyOS Platform

commit-confirm hangs forever when stdin is not a terminal
Closed, ResolvedPublic

Description

ask_yes_no() in python/vyos/utils/io.py retries on EOFError. When stdin is closed or not a terminal, input() raises EOFError on every retry, so the loop never terminates. The caller appears to hang while the message "Please respond with yes/y or no/n" repeats forever.

The most painful caller is commit-confirm: run from a script over ssh (ssh vyos@router "vbash /tmp/change.sh"), the session hangs at the Proceed prompt. This defeats commit-confirm in exactly the situation where an unattended revert matters most, remote automation against a device you can lose contact with.

Steps to reproduce:

echo -e 'source /opt/vyatta/etc/functions/script-template\nconfigure\nset interfaces dummy dum99\ncommit-confirm\nexit' > /tmp/t.sh
ssh vyos@<router> "vbash /tmp/t.sh"
Session never returns.

Expected: EOF resolves to the prompt's default answer, the same as an interactive user pressing Enter. All call sites with destructive consequences declare default=False, so EOF aborts them; default=True sites are commit-confirm/rollback and installer conveniences behind a False-gated disk confirmation.

Details

Version
2026.03 (Stream); bug present in current rolling
Is it a breaking change?
Perfectly compatible
Issue type
Bug (incorrect behavior)

Event Timeline

Companion PR for the CLI side: https://github.com/vyos/vyatta-cfg/pull/153

config-mgmt commit_confirm already has a -y (no_prompt) flag, but the configure-mode wrapper never forwards it, so the prompt cannot be avoided from the CLI at all. The vyos-1x PR makes EOF resolve to the prompt's default; the vyatta-cfg PR adds -y passthrough so scripts can skip the prompt explicitly. Either fix alone unblocks non-interactive commit-confirm, together they match the documented behavior of the underlying tool.

Viacheslav changed the task status from Open to In progress.Aug 3 2026, 2:03 PM
Viacheslav assigned this task to dniminenn.
Viacheslav moved this task from Need Triage to Completed on the VyOS Rolling board.