Re: Broken interactive rebase text after some UTF-8 characters

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

 



Hi Alban

On 31/01/2019 17:43, Alban Gruin wrote:
Hi Phillip and Michal,

I think I found the bug.

Good find! Which os are you on?

If you look at .git/rebase-merge/git-rebase-todo.backup, which is
created before the editor is opened, you can see that it does not have
this problem.  In between, transform_todos() is called and causes the
problem reported by Michal.

This seems to be caused by a single line, sequencer:4661 (on b5101f9297,
"Fourth batch after 2.20", 2019-01-29)[1].  If you add just before a
something like this:

     fwrite(item->arg, item->arg_len, sizeof(char), stdout);

You will see that the argument is properly written to stdout.  But if
you write this:

     printf("%.*s\n", item->arg_len, item->arg);

You will have the same broken output as in the todo file.

Are we misusing C formats?

The C standard and POSIX both say that the * refers to the maximum number of bytes to print but it looks like it is being treated as the maximum number of characters on OpenIndiana.

Johannes - Perhaps we should change it to use fwrite() unless printf() gets fixed and we're sure no other operating systems are affected?

[1] http://pubs.opengroup.org/onlinepubs/9699919799/functions/fprintf.html
[2] http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1548.pdf page 309

Best Wishes

Phillip

[1] https://github.com/git/git/blob/master/sequencer.c#L4661

Cheers,
Alban






[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]

  Powered by Linux