From nobody Sat Nov 23 14:44:15 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1715756765118139.92049414203382; Wed, 15 May 2024 00:06:05 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 213C91B1E; Wed, 15 May 2024 03:06:04 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 076341A56; Wed, 15 May 2024 03:04:51 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 6C8E119D9; Wed, 15 May 2024 03:04:45 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 05FD419DC for ; Wed, 15 May 2024 03:04:45 -0400 (EDT) Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-657-o0b19KfQOayXBdcWO6hsYA-1; Wed, 15 May 2024 03:04:42 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id AEE8F1C53C61 for ; Wed, 15 May 2024 07:04:42 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.45.242.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2038721EE56B for ; Wed, 15 May 2024 07:04:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.5 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1715756684; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=qmgRsHID/ByTQ94AlLjzBUzq4Jvucj3NkelDxRdVKa8=; b=VqF3hyLA5r5c/ZKqs3j90BzqNesiIH2v9mdVhWgBxag/yrJC3QqX+N5ptcI6Xrqflxkmkf UO+ZCQT5MF5jYVVlkwCofhRKaKSFDDd3U0JfSXiwnvjIVUJDqU1qLRiwEiDwrU+RClE8Pq JLHXRkPENHf7rnO5JM6h6SYDT0VF4vk= X-MC-Unique: o0b19KfQOayXBdcWO6hsYA-1 From: Peter Krempa To: devel@lists.libvirt.org Subject: [PATCH 1/3] vsh: Fix '--help' option for virsh/virt-admin Date: Wed, 15 May 2024 09:04:38 +0200 Message-ID: <0191c222505f1b5a83b954375f15dd2f922b3be6.1715756627.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.6 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: L7OJWQ3DRINLLXAUV6MVYMI7F25YHUN4 X-Message-ID-Hash: L7OJWQ3DRINLLXAUV6MVYMI7F25YHUN4 X-MailFrom: pkrempa@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1715756765842100001 Content-Type: text/plain; charset="utf-8" The refactor of the libvirt tools command parser introduced a bug where the '--help' option would cause an error: $ virsh list --help error: command 'list' doesn't support option --help rather than printing the help for the command as the help option is supposed to be handled separately from the real options. Re-introduce the separate handling to the new parser code. Fixes: 5540c3d2415c194b206f8946cf74b13648163332 Reported-by: Lili Zhu Signed-off-by: Peter Krempa --- tools/vsh.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tools/vsh.c b/tools/vsh.c index e74045c24e..61a3066f49 100644 --- a/tools/vsh.c +++ b/tools/vsh.c @@ -1655,7 +1655,10 @@ vshCommandParse(vshControl *ctl, /* lookup the option. Note that vshCmdGetOption also resolves = aliases * and thus the value possibly contained in the alias */ - if (!(opt =3D vshCmdGetOption(ctl, cmd, optionname, &optionval= ue, report))) { + if (STREQ(optionname, "help")) { + cmd->helpOptionSeen =3D true; + g_clear_pointer(&optionvalue, g_free); + } else if (!(opt =3D vshCmdGetOption(ctl, cmd, optionname, &op= tionvalue, report))) { if (STRNEQ(cmd->def->name, "help")) goto out; --=20 2.45.0