From nobody Sat Nov 23 11:52:51 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 Reviewed-by: Martin Kletzander --- 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 From nobody Sat Nov 23 11:52:51 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 171575685449029.949868437187547; Wed, 15 May 2024 00:07:34 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 60A0019C1; Wed, 15 May 2024 03:07:33 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 3DDA91B57; Wed, 15 May 2024 03:05:23 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 5685F19F7; Wed, 15 May 2024 03:05:16 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.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 CBA6D1B13 for ; Wed, 15 May 2024 03:04:55 -0400 (EDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-106-zGAe_HBpPxGo2RzFW_2oPg-1; Wed, 15 May 2024 03:04:43 -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 A3EAF800206 for ; Wed, 15 May 2024 07:04:43 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.45.242.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id 159BE200B4DB for ; Wed, 15 May 2024 07:04:42 +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=1715756695; 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=JsIk9KvQHerCgCUgE+19EIcLt77cbAhuSwbX6nSS5R4=; b=hOfZZ0ORKKhLOY00BSPvQ+Jh0vE1o0gqLKf8xPaFqxr7VIHEHsOuz/gXS3PBkGdRkee4WX uC3W7rXCLuVxYBH3y9WKNqXqTkeCLgV2O+iadIxIn1+xKyvGPjSsnH2CIT4CXLYgDmP16x iDem0zlquxUcIdZI50o0M7559jNIqRM= X-MC-Unique: zGAe_HBpPxGo2RzFW_2oPg-1 From: Peter Krempa To: devel@lists.libvirt.org Subject: [PATCH 2/3] virshtest: Add tests for '--help' Date: Wed, 15 May 2024 09:04:39 +0200 Message-ID: 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: G5AAQHXYLYCORQV44CRMKB4I2FQ5NBLZ X-Message-ID-Hash: G5AAQHXYLYCORQV44CRMKB4I2FQ5NBLZ 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: 1715756856262100001 Content-Type: text/plain; charset="utf-8" Add test cases for help handling. Signed-off-by: Peter Krempa Reviewed-by: Martin Kletzander --- tests/virshtest.c | 3 ++ tests/virshtestdata/help-option.in | 4 ++ tests/virshtestdata/help-option.out | 64 +++++++++++++++++++++++++++++ 3 files changed, 71 insertions(+) create mode 100644 tests/virshtestdata/help-option.in create mode 100644 tests/virshtestdata/help-option.out diff --git a/tests/virshtest.c b/tests/virshtest.c index 03d499b759..b86c39285a 100644 --- a/tests/virshtest.c +++ b/tests/virshtest.c @@ -309,6 +309,9 @@ mymain(void) DO_TEST("#unbalanced; 'quotes\"\necho a # b"); DO_TEST("\\# ignored;echo a\n'#also' ignored"); + /* test of the --help option handling */ + DO_TEST_SCRIPT("help-option", NULL, VIRSH_DEFAULT, "-q"); + /* test of splitting in vshStringToArray */ DO_TEST_SCRIPT("echo-split", NULL, VIRSH_DEFAULT, "-q"); diff --git a/tests/virshtestdata/help-option.in b/tests/virshtestdata/help-= option.in new file mode 100644 index 0000000000..655952eefb --- /dev/null +++ b/tests/virshtestdata/help-option.in @@ -0,0 +1,4 @@ +help echo +echo --help +echo --help=3Ddata +echo --help data diff --git a/tests/virshtestdata/help-option.out b/tests/virshtestdata/help= -option.out new file mode 100644 index 0000000000..5b7510b612 --- /dev/null +++ b/tests/virshtestdata/help-option.out @@ -0,0 +1,64 @@ + NAME + echo - echo arguments. Used for internal testing. + + SYNOPSIS + echo [--shell] [--xml] [--split] [--err] [--prefix ] [= ]... + + DESCRIPTION + Echo back arguments, possibly with quoting. Used for internal testing. + + OPTIONS + --shell escape for shell use + --xml escape for XML use + --split split each argument on ','; ',,' is an escape sequence + --err output to stderr + --prefix prefix the message + [--string] ... arguments to echo + NAME + echo - echo arguments. Used for internal testing. + + SYNOPSIS + echo [--shell] [--xml] [--split] [--err] [--prefix ] [= ]... + + DESCRIPTION + Echo back arguments, possibly with quoting. Used for internal testing. + + OPTIONS + --shell escape for shell use + --xml escape for XML use + --split split each argument on ','; ',,' is an escape sequence + --err output to stderr + --prefix prefix the message + [--string] ... arguments to echo + NAME + echo - echo arguments. Used for internal testing. + + SYNOPSIS + echo [--shell] [--xml] [--split] [--err] [--prefix ] [= ]... + + DESCRIPTION + Echo back arguments, possibly with quoting. Used for internal testing. + + OPTIONS + --shell escape for shell use + --xml escape for XML use + --split split each argument on ','; ',,' is an escape sequence + --err output to stderr + --prefix prefix the message + [--string] ... arguments to echo + NAME + echo - echo arguments. Used for internal testing. + + SYNOPSIS + echo [--shell] [--xml] [--split] [--err] [--prefix ] [= ]... + + DESCRIPTION + Echo back arguments, possibly with quoting. Used for internal testing. + + OPTIONS + --shell escape for shell use + --xml escape for XML use + --split split each argument on ','; ',,' is an escape sequence + --err output to stderr + --prefix prefix the message + [--string] ... arguments to echo --=20 2.45.0 From nobody Sat Nov 23 11:52:51 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 1715756799367486.05342566151; Wed, 15 May 2024 00:06:39 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 454A31A5E; Wed, 15 May 2024 03:06:38 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 8E0F11A19; Wed, 15 May 2024 03:04:55 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 714E419D9; Wed, 15 May 2024 03:04:47 -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 07C1519C6 for ; Wed, 15 May 2024 03:04:47 -0400 (EDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-623-dxjH9i2nP_aIateNG8vTQw-1; Wed, 15 May 2024 03:04:44 -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 9A093800074 for ; Wed, 15 May 2024 07:04:44 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.45.242.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0AD26200A08E for ; Wed, 15 May 2024 07:04:43 +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=1715756686; 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=IcpW1C7xkpfCwu8lfHfaSHTtJanqNEDnxoFkJFHZ2MI=; b=JxLBR/YL1UuVydG5nN6XbArry+tNcyNdlm9OrkxifXm+Xv4k+hJCZ211qvFQJnW3mXuVI1 AmgAQX5s7Z92nlxAkW5wPkR4rvdxwpmzLYbGzj+xvHRYnVQdsRMlKlPVw9BUjhXhnDwAD8 s0SJ/aL6bDOHoM9XRGBcMn82cww3qTI= X-MC-Unique: dxjH9i2nP_aIateNG8vTQw-1 From: Peter Krempa To: devel@lists.libvirt.org Subject: [PATCH 3/3] NEWS: Mention '--help' bug in virsh and virt-admin Date: Wed, 15 May 2024 09:04:40 +0200 Message-ID: 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: 57SPJ5AOVPVI7XFA2G4NWXZV3YOFSAZP X-Message-ID-Hash: 57SPJ5AOVPVI7XFA2G4NWXZV3YOFSAZP 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: 1715756799976100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Peter Krempa Reviewed-by: Martin Kletzander --- NEWS.rst | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/NEWS.rst b/NEWS.rst index bca18e8c43..b6985980ba 100644 --- a/NEWS.rst +++ b/NEWS.rst @@ -37,6 +37,21 @@ v10.4.0 (unreleased) * **Bug fixes** + * virsh/virt-admin: Fix ``--help`` option for all commands + + A bug introduced in `v10.3.0 (2024-05-02)`_ caused that the attempt to= print + help for any command by using the ``--help`` option in ``virsh`` and + ``virt-admin`` would print:: + + $ virsh list --help + error: command 'list' doesn't support option --help + + instead of the help output. A workaround for the affected version is t= o use + the help command:: + + $ virsh help list + + v10.3.0 (2024-05-02) =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --=20 2.45.0