Re: git-log --pretty=format:'[%x00]%w(0,0,1)' doesn't print NUL and "]"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]