From nobody Tue Feb 10 04:15:48 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1605188626; cv=none; d=zohomail.com; s=zohoarc; b=T0bKzcMgkNhYzD1sulsyuphxaTCsyKL2rX5hEfHvkGyzSmSXQIYzc2Zj5u+uFpTce0BrwtReDJPU5ES1f819w+rCKPTHyYXV7lSOIbTWn4YiKUSmfIQYiCf1Wll+L/NcLPfvFWf3FcNUbuY3TDYgxHJt8nIgWy4mcBZGfJ8Tc20= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1605188626; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=lCAAXe4CTnIYT1znRUET+gLl2SFzTrPXGIJh5Hb1l3I=; b=mFXs5HHjs5wYCXy/d+mVs6ltomScxytC6nwF7eNaN+kOXL7oElMFF7udj+eZWWcCt+F1LdqQ10oujW0ajaqQW4vBjQ7IrsBAqKylZ4Z4yyzTFJbqZ4D6Dm9Ph8NnE142VKar1kE0zokk19N37zd/AMHl/F3y2eVIeVsx9mcw4TU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1605188626250925.4409215624374; Thu, 12 Nov 2020 05:43:46 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-177-FJ64H_uIPgKuUOna6UuJ8g-1; Thu, 12 Nov 2020 08:43:42 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id BAD538018A4; Thu, 12 Nov 2020 13:43:36 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9921975135; Thu, 12 Nov 2020 13:43:36 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 60712181A06E; Thu, 12 Nov 2020 13:43:36 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0ACDhHeL012324 for ; Thu, 12 Nov 2020 08:43:17 -0500 Received: by smtp.corp.redhat.com (Postfix) id A96607513C; Thu, 12 Nov 2020 13:43:17 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id DD85275138 for ; Thu, 12 Nov 2020 13:43:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1605188625; h=from:from:sender:sender: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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=lCAAXe4CTnIYT1znRUET+gLl2SFzTrPXGIJh5Hb1l3I=; b=Xn8BcwiiFIUVu0ZRnW4tRu2lgAGK4EDSbdCFwNgZNhqWftfkcfwyKHuECnTYiz33l9fCa/ hAxUin+wCkUGiLdc4JLuXm0/1jTkvIo4w3h1VOp6Ma8mRfS75mtwJa/yh0/23Tx9cOK2fN 34qey7F9F7OCvn0P9qAkE2bb3a98lXA= X-MC-Unique: FJ64H_uIPgKuUOna6UuJ8g-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 2/8] tools: vshCmddefCheckInternals: Add parameter name to error message Date: Thu, 12 Nov 2020 14:42:59 +0100 Message-Id: <2b8e14f9089bc7d77257cea9d6d1f5f51e2cb6a8.1605188395.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" If a parameter definition is invalid we can include the name of the parameter for simpler debugging. Signed-off-by: Peter Krempa --- tools/vsh.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/tools/vsh.c b/tools/vsh.c index e5ecc38f73..d1e795bbc1 100644 --- a/tools/vsh.c +++ b/tools/vsh.c @@ -307,8 +307,8 @@ vshCmddefCheckInternals(vshControl *ctl, case VSH_OT_STRING: case VSH_OT_BOOL: if (opt->flags & VSH_OFLAG_REQ) { - vshError(ctl, _("command '%s' misused VSH_OFLAG_REQ"), - cmd->name); + vshError(ctl, _("parameter '%s' of command '%s' misused VS= H_OFLAG_REQ"), + opt->name, cmd->name); return -1; /* neither bool nor string options can be manda= tory */ } break; @@ -319,8 +319,8 @@ vshCmddefCheckInternals(vshControl *ctl, char *p; if (opt->flags || !opt->help) { - vshError(ctl, _("command '%s' has incorrect alias option"), - cmd->name); + vshError(ctl, _("parameter '%s' of command '%s' has incorr= ect alias option"), + opt->name, cmd->name); return -1; /* alias options are tracked by the original na= me */ } if ((p =3D strchr(name, '=3D'))) @@ -334,30 +334,30 @@ vshCmddefCheckInternals(vshControl *ctl, VIR_FREE(name); /* If alias comes with value, replacement must not be bool= */ if (cmd->opts[j].type =3D=3D VSH_OT_BOOL) { - vshError(ctl, _("command '%s' has mismatched alias typ= e"), - cmd->name); + vshError(ctl, _("alias '%s' of command '%s' has mismat= ched alias type"), + opt->name, cmd->name); return -1; } } if (!cmd->opts[j].name) { - vshError(ctl, _("command '%s' has missing alias option"), - cmd->name); + vshError(ctl, _("alias '%s' of command '%s' has missing al= ias option"), + opt->name, cmd->name); return -1; /* alias option must map to a later option name= */ } } break; case VSH_OT_ARGV: if (cmd->opts[i + 1].name) { - vshError(ctl, _("command '%s' does not list argv option la= st"), - cmd->name); + vshError(ctl, _("parameter '%s' of command '%s' must be li= sted last"), + opt->name, cmd->name); return -1; /* argv option must be listed last */ } break; case VSH_OT_DATA: if (!(opt->flags & VSH_OFLAG_REQ)) { - vshError(ctl, _("command '%s' has non-required VSH_OT_DATA= "), - cmd->name); + vshError(ctl, _("parameter '%s' of command '%s' must use V= SH_OFLAG_REQ flag"), + opt->name, cmd->name); return -1; /* OT_DATA should always be required. */ } break; --=20 2.28.0