[PATCH] birdc: Do not execute cmd on non interactive help request
Inrin
inrin at caesia.net
Thu Dec 28 12:37:26 CET 2023
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)
--------------------------------------------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: non-interactive-rl-help.patch
Type: text/x-diff
Size: 425 bytes
Desc: not available
URL: <http://trubka.network.cz/pipermail/bird-users/attachments/20231228/50f81aa5/attachment.bin>
More information about the Bird-users
mailing list