git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] t0028: fix wrong octal values for BOM in setup

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 11, 2019, 22:42 UTC
Message-ID
<xmqq36ougd5i.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<20190211213818.4941-1-me@ikke.info>
Kevin Daudt <me@ikke.info> writes:
Show 13 quoted lines
> The setup code uses octal values with printf to generate a BOM for
> UTF-16/32 BE/LE. It specifically uses '\777' to emit a 0xff byte. This
> relies on the fact that most shells truncate the value above 0o377.
>
> Ash however interprets '\777' as '\77' + a literal '7', resulting in an
> invalid BOM.
>
> Fix this by using the proper value of 0xff: '\377'.
>
> Signed-off-by: Kevin Daudt <me@ikke.info>
> ---
> I do wonder why this code is using octal values in the first place,
> rather than using hex values.
Most likely for portability to non GNU and less widely used systems.
Thanks for spotting these \777s.
Will apply.
Previous: Kevin Daudt
Message 2 of 2 in “t0028: fix wrong octal values for BOM in setup”
  1. t0028: fix wrong octal values for BOM in setupKevin Daudt, Feb 11, 2019
  2. Junio C HamanoFeb 11, 2019

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.