From: Jeff King <peff@peff.net>
To: Tanaka Akira <akr@fsij.org>
Cc: git@vger.kernel.org
Subject: Re: git-log --pretty=format:'[%x00]%w(0,0,1)' doesn't print NUL and "]"
Date: Thu, 29 Dec 2011 14:23:29 -0500 [thread overview]
Message-ID: <20111229192328.GA18723@sigill.intra.peff.net> (raw)
In-Reply-To: <CANjopZFqiy+Ai4u6QYYnza5J7A3NAt-f17yR9AsYok-g3Hbb3w@mail.gmail.com>
On Fri, Dec 30, 2011 at 03:41:20AM +0900, Tanaka Akira wrote:
> I found that git-log doesn't print characters in --pretty option as follows.
>
> % git log --pretty=format:'[%x00]%w(0,0,1)' |od -c
> 0000000 [ \n [ \n [ \n [ \n [ \n [ \n [ \n [ \n
> *
> 0022320 [ \n [ \n [ \n [
> 0022327
>
> I think NUL and "]" should be printed.
I think there is a bug in strbuf_add_indented_text, which uses
strchrnul, even though a strbuf may contain literal NULs. Although one
could argue that trying to wrap a NUL is questionable (after all, what
is its character width?), the current behavior seems pretty wrong.
I think the whole wrapping callchain needs to be adjusted to handle
arbitrary bytes (there are also several checks in
strbuf_add_wrapped_text for NUL terminators).
-Peff
prev parent reply other threads:[~2011-12-29 19:23 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-29 18:41 git-log --pretty=format:'[%x00]%w(0,0,1)' doesn't print NUL and "]" Tanaka Akira
2011-12-29 19:23 ` Jeff King [this message]
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=20111229192328.GA18723@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=akr@fsij.org \
--cc=git@vger.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 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).