From nobody Wed Oct 30 19:55:53 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.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 170.10.133.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=1693816319; cv=none; d=zohomail.com; s=zohoarc; b=S7dC4WPVWTLMdf25hk9N7r94EUIT/P++Lcgoj6GjBqxbi9iYW67RvkFKfEXTvb5q+ebgpVYmcghvL6fZrPKuiW//Y2kG2Ax4gLDTWjxs3rzQ25znKgp5fsM49xBhdRf+VW59c9isfzF3uGCP+M3LgLshNqEL+tOE8WG6CKxCP/M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693816319; 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=ZdC2vUlq+Ox98XuKmTi7Hi51XWHL6mLJPPwCL/KUMKc=; b=exg+Srzc6WJ4W/Ga/IthFMsZEkkvTriZ5U4eEKWXAuI4CRO7LNMxHXy3BRAR4SV6mI09exqIG0K3uJFO27Ww22TxG6quJR9V33N8rKazRSWDO68MstqXc8mBDzky9yEk/PmsNS8dw2EsDVv/qfWqhbdtLIFIZXY3zipwgyrKJC8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1693816319881162.84291733029613; Mon, 4 Sep 2023 01:31:59 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-202-ANKjHnZHNT2qjD22yR0sMg-1; Mon, 04 Sep 2023 04:31:56 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 742B83C0E447; Mon, 4 Sep 2023 08:31:53 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2B5B0C51922; Mon, 4 Sep 2023 08:31:53 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id AF166194729B; Mon, 4 Sep 2023 08:31:51 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id D699D1946595 for ; Mon, 4 Sep 2023 08:31:50 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id C410C40C1258; Mon, 4 Sep 2023 08:31:50 +0000 (UTC) Received: from maggie.brq.redhat.com (unknown [10.43.2.56]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6BF8E400D277 for ; Mon, 4 Sep 2023 08:31:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693816318; 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=ZdC2vUlq+Ox98XuKmTi7Hi51XWHL6mLJPPwCL/KUMKc=; b=N1iE5NnIISRO5MZ8lAXwfujBe4HbCp1M7KVlZEk58D1g6e0A0F3KPVKL4YLWrEwvsF8b9P w7WiuXYjhyFwvki6d8mEtAHQ4ViMogSj2JUrbLkTrrHA2o7IPyNA5tMup/5LG7Flm5pzVD GL/X9DGaFqtoeYslkgs+1f00sB0x8zY= X-MC-Unique: ANKjHnZHNT2qjD22yR0sMg-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 1/2] tools: Reformat --help output of virsh and virt-admin Date: Mon, 4 Sep 2023 10:31:47 +0200 Message-ID: <82dece00ed0be3abe6244b79dbd0292bf0ce52f8.1693816204.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1693816321953100003 Content-Type: text/plain; charset="utf-8"; x-default="true" The --help output of virsh and virt-admin shows supported options and commands and as such contains new lines. Both these strings are marked for translation btw. But the way they are formatted now ('\n' being at the start of new line instead at the end of the previous) makes it hard to create a syntax-check rule for 'translation message on one line' (next commit). Reformat both strings a bit (no user visible change though). Signed-off-by: Michal Privoznik Reviewed-by: Peter Krempa --- tools/virsh.c | 6 ++++-- tools/virt-admin.c | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/tools/virsh.c b/tools/virsh.c index d9922a35fc..7b71131db3 100644 --- a/tools/virsh.c +++ b/tools/virsh.c @@ -436,8 +436,10 @@ virshUsage(void) const vshCmdGrp *grp; const vshCmdDef *cmd; =20 - fprintf(stdout, _("\n%1$s [options]... []" - "\n%2$s [options]... [args...]\n\n" + fprintf(stdout, _("\n" + "%1$s [options]... []\n" + "%2$s [options]... [args...]\n" + "\n" " options:\n" " -c | --connect=3DURI hypervisor connection= URI\n" " -d | --debug=3DNUM debug level [0-4]\n" diff --git a/tools/virt-admin.c b/tools/virt-admin.c index 15a639f1ea..1e22a3c8a9 100644 --- a/tools/virt-admin.c +++ b/tools/virt-admin.c @@ -1242,8 +1242,10 @@ vshAdmUsage(void) const vshCmdGrp *grp; const vshCmdDef *cmd; =20 - fprintf(stdout, _("\n%1$s [options]... []" - "\n%2$s [options]... [args...]\n\n" + fprintf(stdout, _("\n" + "%1$s [options]... []\n" + "%2$s [options]... [args...]\n" + "\n" " options:\n" " -c | --connect=3DURI daemon admin connecti= on URI\n" " -d | --debug=3DNUM debug level [0-4]\n" --=20 2.41.0 From nobody Wed Oct 30 19:55:53 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.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 170.10.133.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=1693816323; cv=none; d=zohomail.com; s=zohoarc; b=QhfoN06B2iDOFzShtrLYwclxZdIWMGXD1SmdDMkFnZ7ncJ74ruMa7kP3BOd+gzf46YhXgu3evr4mFvhdltK/Q/6tcCBZM6CL//wbC2dqXl9SUNk2Gd7U1kgICbio5C5gvM1WniEDOgZnavbh8w8iz8/rmBKjv2/OT1IiSpf2toU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693816323; 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=hBX9zIZfUkEwosRD+AeFDhquzvjP4NAOjvw5OqZWE7Q=; b=ZecTHSPrVRElp2DGvere6oPM3sUTMZX9b4A2hZNPGtNp/3CIY14DRyvqdDihC0unNNXpPaaUG0kGk6awqt+zchQTTKOpN7/264K+YNmHIXDOzGoOqTyhmRAwE704fCQAqK6Vgse1M/C0D0N46a0oY7JQFMRmIAdTC0JbAvHw2VY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1693816323888927.880676987306; Mon, 4 Sep 2023 01:32:03 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-270-OoJ60GR-MIOXMw9ondpxtA-1; Mon, 04 Sep 2023 04:31:56 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id AAB0038008C3; Mon, 4 Sep 2023 08:31:53 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 84C0840CF8F0; Mon, 4 Sep 2023 08:31:53 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id E522C19465B7; Mon, 4 Sep 2023 08:31:52 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 8D3101946A5E for ; Mon, 4 Sep 2023 08:31:51 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 608D8400D277; Mon, 4 Sep 2023 08:31:51 +0000 (UTC) Received: from maggie.brq.redhat.com (unknown [10.43.2.56]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0829B40C6CCC for ; Mon, 4 Sep 2023 08:31:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693816322; 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=hBX9zIZfUkEwosRD+AeFDhquzvjP4NAOjvw5OqZWE7Q=; b=OLj6pk+c1edAvGetbaTgKCrEPw2Nzrv3wH9/AmQqOCYDMDPGOm4OMLY26rN7c9KqdFnrDg ZMxT+VTnNlbVZXjb5QDaaJnnsPbW28wcx65NX0sKu4ruef5JwGTJHNaGHdwsSehuZUVGro eyBwWw2OwtoP7/VQFrDkZJGF1TXFWVA= X-MC-Unique: OoJ60GR-MIOXMw9ondpxtA-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 2/2] syntax-check: Introduce a rule for one line error messages Date: Mon, 4 Sep 2023 10:31:48 +0200 Message-ID: <5ccbf7332b65c824c859a29b61364603492434e7.1693816204.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1693816326449100001 Content-Type: text/plain; charset="utf-8"; x-default="true" Okay, this is a shortcut. Our coding style says that error messages are exempt from '80 chars long lines' rule. But in the very same paragraph it is said that all error messages need to be marked for translation (as they might be presented to user). Therefore, the syntax-check rule can check if _("...") is formatted on one line. With exception of _("...\n" ...) (e.g. various outputs from helper binaries like leaseshelper, sshhelper, or daemons like lockd, logd). I believe nobody would chose a substring that contains '\n' for git grep-ping the error message. Signed-off-by: Michal Privoznik Reviewed-by: Peter Krempa --- build-aux/syntax-check.mk | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/build-aux/syntax-check.mk b/build-aux/syntax-check.mk index 64c1e2773e..618c0546aa 100644 --- a/build-aux/syntax-check.mk +++ b/build-aux/syntax-check.mk @@ -440,6 +440,11 @@ sc_prohibit_newline_at_end_of_diagnostic: && { echo 'newline at end of message(s)' 1>&2; \ exit 1; } || : =20 +sc_prohibit_error_message_on_multiple_lines: + @prohibit=3D'[^N]_\(".*[^\\n]"$$' \ + halt=3D'found error message on multiple lines' \ + $(_sc_search_regexp) + # Look for diagnostics that lack a % in the format string, except that we # allow VIR_ERROR to do this, and ignore functions that take a single # string rather than a format argument. @@ -1386,6 +1391,9 @@ exclude_file_name_regexp--sc_prohibit_raw_virclassnew= =3D \ exclude_file_name_regexp--sc_prohibit_newline_at_end_of_diagnostic =3D \ ^src/rpc/gendispatch\.pl$$ =20 +exclude_file_name_regexp--sc_prohibit_error_message_on_multiple_lines =3D \ + ^(build-aux/syntax-check\.mk|docs/coding-style.rst) + exclude_file_name_regexp--sc_prohibit_nonreentrant =3D \ ^((po|tests|examples)/|docs/.*(py|js|html\.in|.rst)|run.in$$|tools/wires= hark/util/genxdrstub\.pl|tools/virt-login-shell\.c$$) =20 --=20 2.41.0