On 2/16/26 15:48, Lucas Amaral wrote: > The domuuid, net-uuid, and pool-uuid commands call vshError() when > GetUUIDString() fails, but unconditionally return true, which > vshCommandRun() maps to EXIT_SUCCESS. This means scripts checking > $? see success despite the error. > > Return false on failure so the exit code correctly reflects the > error, consistent with other virsh commands. > > Signed-off-by: Lucas Amaral <[email protected]> > --- > Found by code audit. The bug dates back to the original cmdDomuuid > implementation in d47ddf5b67 (May 2006) and was replicated in > cmdNetworkUuid and cmdPoolUuid when those were added later. > > In practice GetUUIDString() is unlikely to fail from virsh (the > UUID is populated during the preceding lookup), so this is a > defensive correctness fix rather than a user-visible regression. > The restructuring uses the early-return-on-error pattern already > used by the adjacent object lookup (e.g., virshCommandOptDomainBy > a few lines above). > > Tested on CentOS Stream 9 — full test suite passes (307 OK, > 1 Expected Fail, 0 Fail). > > tools/virsh-domain.c | 7 ++++--- > tools/virsh-network.c | 7 ++++--- > tools/virsh-pool.c | 7 ++++--- > 3 files changed, 12 insertions(+), 9 deletions(-)
Reviewed-by: Michal Privoznik <[email protected]> and merged. Congratulations on your first libvirt contribution! Michal
