[PATCH] birdc: Do not execute cmd on non interactive help request
Hi! A pal of mine noticed that `echo <cmd> ? | birdc` executes the command <cmd> after showing it's help text is shown. I later confirmed that `birdcl` in comparison to `birdc` does not show this behaviour. Since this is a non intuitive side effect on birdc's side, here a proposed patch to align birdc and birdcl's behaviour. Please advise if fixing it on another part might be preferred. I chose birdc.c, to minimize the changes needed. Below a full report: -------------------------------------------- # Scenario ## Setup ./bird -l ## birdcl no side effect bird (v2.14)> echo 'restrict ?' | ./birdcl -l BIRD v2.14 ready. bird> restrict ? restrict Restrict current CLI session to safe commands bird> bird (v2.14)> ## birdc side effect bird (v2.14)> echo 'restrict ?' | ./birdc -l BIRD v2.14 ready. bird> restrict ? restrict Restrict current CLI session to safe commands bird> restrict Access restricted bird (v2.14)> # Expected behaviour Like birdcl, just show help and exit # Actual behaviour Executes the <cmd> after showing the help # Tested version BIRD v2.14 (birdc.c last edited on 2017, so I guess this is on all versions the same) --------------------------------------------
On Thu, Dec 28, 2023 at 12:37:26PM +0100, Inrin via Bird-users wrote:
Hi!
A pal of mine noticed that `echo <cmd> ? | birdc` executes the command <cmd> after showing it's help text is shown. I later confirmed that `birdcl` in comparison to `birdc` does not show this behaviour.
Since this is a non intuitive side effect on birdc's side, here a proposed patch to align birdc and birdcl's behaviour.
Please advise if fixing it on another part might be preferred. I chose birdc.c, to minimize the changes needed.
Thanks, merged. Sorry for the delay, i missed / forgot about the patch. -- Elen sila lumenn' omentielvo Ondrej 'Santiago' Zajicek (email: santiago@crfreenet.org) "To err is human -- to blame it on a computer is even more so."
participants (2)
-
Inrin -
Ondrej Zajicek