All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Sandeen <sandeen@redhat.com>
To: fstests@vger.kernel.org
Cc: linux-xfs@vger.kernel.org, zlang@kernel.org
Subject: [PATCH] xfs/122: escape %zu in printf with %% not \\%
Date: Mon, 20 Jun 2022 16:43:31 -0500	[thread overview]
Message-ID: <1655761411-11698-1-git-send-email-sandeen@redhat.com> (raw)

The standard way to escape % in a printf is with %%; although \\%zu
seems to have worked in awk until recently, an upgrade on Fedora 36
has started failing:

awk: cmd. line:1: (FILENAME=- FNR=1) fatal: not enough arguments to satisfy format string
        'printf("sizeof(%s) = \%zu\n", sizeof(%s));
    '
                                              ^ ran out for this one
Switching the escape to "%%" fixes this for me, and also works
on my very old RHEL7 mcahine.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---
 tests/xfs/122 | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/xfs/122 b/tests/xfs/122
index 5200615..18748e6 100755
--- a/tests/xfs/122
+++ b/tests/xfs/122
@@ -186,7 +186,7 @@ egrep '(} *xfs_.*_t|^struct xfs_[a-z0-9_]*$)' |\
 egrep -v -f $tmp.ignore |\
 sed -e 's/^.*}[[:space:]]*//g' -e 's/;.*$//g' -e 's/_t, /_t\n/g' |\
 sort | uniq |\
-awk '{printf("printf(\"sizeof(%s) = \\%zu\\n\", sizeof(%s));\n", $0, $0);}' |\
+awk '{printf("printf(\"sizeof(%s) = %%zu\\n\", sizeof(%s));\n", $0, $0);}' |\
 cat >> $cprog
 
 #
@@ -199,7 +199,7 @@ awk '
    /typedef struct xfs_sb/ { structon = 1; next }
    structon && $2 ~ /^sb_/ { sub(/[;,]/,"",$2)
                              sub(/XFSLABEL_MAX/,"12",$2)
-                             printf("printf(\"offsetof(xfs_sb_t, %s) = \\%zu\\n\", offsetof(xfs_sb_t, %s));", $2, $2); next}
+                             printf("printf(\"offsetof(xfs_sb_t, %s) = %%zu\\n\", offsetof(xfs_sb_t, %s));", $2, $2); next}
    structon && /}/ { structon = 0; next}
 '>>$cprog
 
-- 
1.8.3.1


             reply	other threads:[~2022-06-20 21:44 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-20 21:43 Eric Sandeen [this message]
2022-06-21  4:27 ` [PATCH] xfs/122: escape %zu in printf with %% not \\% Zorro Lang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1655761411-11698-1-git-send-email-sandeen@redhat.com \
    --to=sandeen@redhat.com \
    --cc=fstests@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=zlang@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.