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

[PATCH] t0050: fix printf format strings for portability

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Dec 21, 2010, 20:27 UTC
Message-ID
<20101221202755.GA27214@burratino>
In-Reply-To
<4D1105B5.5070703@ramsay1.demon.co.uk>

Unlike bash and ksh, dash passes through hexadecimal \xcc escapes. So when run with dash, these tests *pass* (since '\xcc' is a perfectly reasonable filename) but they are not testing what was intended.

Use octal escapes instead, in the spirit of v1.6.1-rc1~55^2 (2008-11-09).

Reported-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
Ramsay Jones wrote:
Show 8 quoted lines
> I noticed recently that the unicode tests, when run by the dash shell,
> have not been working as designed. (The tests *pass*, but they are
> *not* testing what was intended)
> 
> In order to demonstrate, I added an "false &&" line after the touch in
> test #8, so that (on Ubuntu):
> 
>     $ ./t0050-filesystem -i
[...]
>     $ ls trash\ directory.t0050-filesystem/unicode/
>     \x61\xcc\x88

Good point. POSIX printf is not required to support \x escape sequences.

 t/t0050-filesystem.sh |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/t/t0050-filesystem.sh b/t/t0050-filesystem.sh
index 057c97c..1542cf6 100755
--- a/t/t0050-filesystem.sh
+++ b/t/t0050-filesystem.sh
@@ -4,8 +4,8 @@ test_description='Various filesystem issues'
 
 . ./test-lib.sh
 
-auml=`printf '\xc3\xa4'`
-aumlcdiar=`printf '\x61\xcc\x88'`
+auml=$(printf '\303\244')
+aumlcdiar=$(printf '\141\314\210')
 
 case_insensitive=
 unibad=
-- 
1.7.2.3.554.gc9b5c.dirty
Previous: Ramsay JonesNext: Junio C Hamano
Message 2 of 6 in “t0050-filesystem.sh unicode tests borked on dash shell”
  1. Ramsay JonesDec 21, 2010
  2. t0050: fix printf format strings for portabilityJonathan Nieder, Dec 21, 2010
  3. Junio C HamanoDec 21, 2010
  4. Ramsay JonesDec 28, 2010
  5. Thomas RastDec 21, 2010
  6. Junio C HamanoDec 21, 2010

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.