From: Kacper Kornet <draenog@pld-linux.org>
To: git@vger.kernel.org
Cc: Jeff King <peff@peff.net>, Junio C Hamano <gitster@pobox.com>
Subject: [PATCH] Fix '\%o' for printf from coreutils
Date: Thu, 31 Oct 2013 12:51:32 +0100 [thread overview]
Message-ID: <20131031115131.GA28379@camk.edu.pl> (raw)
The printf utility provided by coreutils when interpreting '\%o' format
does not recognize %o as formatting directive. For example
printf '\%o 0 returns \%o and warning: ignoring excess arguments,
starting with ‘0’, which results in failed tests in
t5309-pack-delta-cycles.sh. In most shells the test ends with success as
the printf is a builtin utility.
Fix it by using '\\%o' which is interpreted consistently in all versions
of printf.
Signed-off-by: Kacper Kornet <draenog@pld-linux.org>
---
I've found it while testing v1.8.5-rc0 with mksh which does not
provide a builtin printf.
Kacper
t/lib-pack.sh | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/t/lib-pack.sh b/t/lib-pack.sh
index 7e8685b..b96e125 100644
--- a/t/lib-pack.sh
+++ b/t/lib-pack.sh
@@ -12,10 +12,10 @@
# Print the big-endian 4-byte octal representation of $1
uint32_octal () {
n=$1
- printf '\%o' $(($n / 16777216)); n=$((n % 16777216))
- printf '\%o' $(($n / 65536)); n=$((n % 65536))
- printf '\%o' $(($n / 256)); n=$((n % 256))
- printf '\%o' $(($n ));
+ printf '\\%o' $(($n / 16777216)); n=$((n % 16777216))
+ printf '\\%o' $(($n / 65536)); n=$((n % 65536))
+ printf '\\%o' $(($n / 256)); n=$((n % 256))
+ printf '\\%o' $(($n ));
}
# Print the big-endian 4-byte binary representation of $1
--
1.8.4.2
--
Kacper Kornet
next reply other threads:[~2013-10-31 12:10 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-31 11:51 Kacper Kornet [this message]
2013-10-31 16:49 ` [PATCH] Fix '\%o' for printf from coreutils Jeff King
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=20131031115131.GA28379@camk.edu.pl \
--to=draenog@pld-linux.org \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=peff@peff.net \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).