From 1651ec9a0f65d566b7677b539e3802fdeee15496 Mon Sep 17 00:00:00 2001 From: Yonatan Zaken Date: Mon, 22 Jun 2026 20:02:39 +0300 Subject: [PATCH] ceph.in: reject -w/--watch flags when used with subcommands parse_known_args() silently consumes -w and all --watch-* flags before subcommand arguments reach the command validator. When a user ran "ceph orch ps -w", the watch handler entered cluster log streaming mode while discarding the subcommand entirely, with no error or indication that the orch ps command was ignored. Add a guard at the entry of the watch handler: if any watch flag is active and childargs is non-empty, print "Invalid command: unused arguments: [...]" and return EINVAL. This matches the behaviour already seen when -s/--status is combined with a subcommand. Assisted-by: Claude:claude-4.6-sonnet Fixes: https://tracker.ceph.com/issues/77121 Signed-off-by: Yonatan Zaken --- src/ceph.in | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/ceph.in b/src/ceph.in index 4694da29db5..3379de7488e 100755 --- a/src/ceph.in +++ b/src/ceph.in @@ -1131,6 +1131,9 @@ def main(): elif k != "watch_channel": level = k.replace('watch_', '') if level: + if childargs: + print('Invalid command: unused arguments: {0}'.format(childargs), file=sys.stderr) + return errno.EINVAL # an awfully simple callback def watch_cb(arg, line, channel, name, who, stamp_sec, stamp_nsec, seq, level, msg): # Filter on channel -- 2.47.3