* t0050-filesystem.sh unicode tests borked on dash shell
@ 2010-12-21 19:53 Ramsay Jones
2010-12-21 20:27 ` [PATCH] t0050: fix printf format strings for portability Jonathan Nieder
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Ramsay Jones @ 2010-12-21 19:53 UTC (permalink / raw)
To: prohaska; +Cc: Junio C Hamano, GIT Mailing-list
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
ok 1 - see what we expect
ok 2 - detection of case insensitive filesystem during repo init
ok 3 - detection of filesystem w/o symlink support during repo init
ok 4 - setup case tests
ok 5 - rename (case change)
ok 6 - merge (case change)
not ok 7 - add (with different case) # TODO known breakage
not ok - 8 setup unicode normalization tests
#
#
# test_create_repo unicode &&
# cd unicode &&
# touch "$aumlcdiar" &&
# false &&
# git add "$aumlcdiar" &&
# git commit -m initial &&
# git tag initial &&
# git checkout -b topic &&
# git mv $aumlcdiar tmp &&
# git mv tmp "$auml" &&
# git commit -m rename &&
# git checkout -f master
#
#
$ ls trash\ directory.t0050-filesystem/unicode/
\x61\xcc\x88
$ bash t0050-filesystem -i
ok 1 - see what we expect
ok 2 - detection of case insensitive filesystem during repo init
ok 3 - detection of filesystem w/o symlink support during repo init
ok 4 - setup case tests
ok 5 - rename (case change)
ok 6 - merge (case change)
not ok 7 - add (with different case) # TODO known breakage
not ok - 8 setup unicode normalization tests
#
#
# test_create_repo unicode &&
# cd unicode &&
# touch "$aumlcdiar" &&
# false &&
# git add "$aumlcdiar" &&
# git commit -m initial &&
# git tag initial &&
# git checkout -b topic &&
# git mv $aumlcdiar tmp &&
# git mv tmp "$auml" &&
# git commit -m rename &&
# git checkout -f master
#
#
$ ls trash\ directory.t0050-filesystem/unicode/ | od -x
0000000 cc61 0a88
0000004
So bash works fine and I can avoid the problem by running the tests, thus:
$ SHELL_PATH=/bin/bash make NO_SVN_TESTS=1 test
Since I have an older dash, I compiled dash from source (my dash git repo
claims:
$ git describe --tags
v0.5.6-24-gb61ab0b
), but the result was exactly the same.
I afraid I don't have time to investigate this further at the moment ...
ATB,
Ramsay Jones
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] t0050: fix printf format strings for portability
2010-12-21 19:53 t0050-filesystem.sh unicode tests borked on dash shell Ramsay Jones
@ 2010-12-21 20:27 ` Jonathan Nieder
2010-12-21 21:26 ` Junio C Hamano
2010-12-28 18:05 ` Ramsay Jones
2010-12-21 20:29 ` t0050-filesystem.sh unicode tests borked on dash shell Thomas Rast
2010-12-21 20:43 ` Junio C Hamano
2 siblings, 2 replies; 6+ messages in thread
From: Jonathan Nieder @ 2010-12-21 20:27 UTC (permalink / raw)
To: Ramsay Jones; +Cc: prohaska, Junio C Hamano, GIT Mailing-list
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:
> 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
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] t0050: fix printf format strings for portability
2010-12-21 20:27 ` [PATCH] t0050: fix printf format strings for portability Jonathan Nieder
@ 2010-12-21 21:26 ` Junio C Hamano
2010-12-28 18:05 ` Ramsay Jones
1 sibling, 0 replies; 6+ messages in thread
From: Junio C Hamano @ 2010-12-21 21:26 UTC (permalink / raw)
To: Jonathan Nieder; +Cc: Ramsay Jones, prohaska, GIT Mailing-list
Jonathan Nieder <jrnieder@gmail.com> writes:
> 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).
Thanks.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] t0050: fix printf format strings for portability
2010-12-21 20:27 ` [PATCH] t0050: fix printf format strings for portability Jonathan Nieder
2010-12-21 21:26 ` Junio C Hamano
@ 2010-12-28 18:05 ` Ramsay Jones
1 sibling, 0 replies; 6+ messages in thread
From: Ramsay Jones @ 2010-12-28 18:05 UTC (permalink / raw)
To: Jonathan Nieder; +Cc: prohaska, Junio C Hamano, GIT Mailing-list, trast
Jonathan Nieder wrote:
> 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=
Thanks everyone (Jonathan, Junio and Thomas) for the quick reply and fix!
[I should have figured it out myself, but I just couldn't imagine printf
not supporting hex escapes! :-P ]
ATB,
Ramsay Jones
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: t0050-filesystem.sh unicode tests borked on dash shell
2010-12-21 19:53 t0050-filesystem.sh unicode tests borked on dash shell Ramsay Jones
2010-12-21 20:27 ` [PATCH] t0050: fix printf format strings for portability Jonathan Nieder
@ 2010-12-21 20:29 ` Thomas Rast
2010-12-21 20:43 ` Junio C Hamano
2 siblings, 0 replies; 6+ messages in thread
From: Thomas Rast @ 2010-12-21 20:29 UTC (permalink / raw)
To: Ramsay Jones; +Cc: prohaska, Junio C Hamano, GIT Mailing-list
Ramsay Jones wrote:
> $ ls trash\ directory.t0050-filesystem/unicode/
> \x61\xcc\x88
The printf at the top evidently does not interpolate \xAA sequences.
Since my 'man 1p printf' POSIX manpage only mandates \AAA octal
sequences, maybe we should use that instead. Can you verify that the
patch below works for you?
Judging from
git grep '\\x[0-9a-f][0-9a-f]' t
this is the only instance of this problem, the rest are in Perl code.
--- 8< ---
Subject: t0050: replace \xAA by \AAA in printf
POSIX does not mandate the hex escape sequences, and thus dash's
built-in printf does not expand them. Use octal escapes instead.
diff --git c/t/t0050-filesystem.sh i/t/t0050-filesystem.sh
index 057c97c..87bf1ff 100755
--- c/t/t0050-filesystem.sh
+++ i/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=
--
Thomas Rast
trast@{inf,student}.ethz.ch
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: t0050-filesystem.sh unicode tests borked on dash shell
2010-12-21 19:53 t0050-filesystem.sh unicode tests borked on dash shell Ramsay Jones
2010-12-21 20:27 ` [PATCH] t0050: fix printf format strings for portability Jonathan Nieder
2010-12-21 20:29 ` t0050-filesystem.sh unicode tests borked on dash shell Thomas Rast
@ 2010-12-21 20:43 ` Junio C Hamano
2 siblings, 0 replies; 6+ messages in thread
From: Junio C Hamano @ 2010-12-21 20:43 UTC (permalink / raw)
To: Ramsay Jones; +Cc: prohaska, GIT Mailing-list
Ramsay Jones <ramsay@ramsay1.demon.co.uk> writes:
> $ ls trash\ directory.t0050-filesystem/unicode/
> \x61\xcc\x88
The built-in printf in dash seems to lack understanding of '\xXX'.
It is tempting to patch it by using /usr/bin/printf but it is unclear how
portable it would be.
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 41df6bc..8ad102b 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=$(/usr/bin/printf '\xc3\xa4')
+aumlcdiar=$(/usr/bin/printf '\x61\xcc\x88')
case_insensitive=
unibad=
^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2010-12-28 18:13 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-21 19:53 t0050-filesystem.sh unicode tests borked on dash shell Ramsay Jones
2010-12-21 20:27 ` [PATCH] t0050: fix printf format strings for portability Jonathan Nieder
2010-12-21 21:26 ` Junio C Hamano
2010-12-28 18:05 ` Ramsay Jones
2010-12-21 20:29 ` t0050-filesystem.sh unicode tests borked on dash shell Thomas Rast
2010-12-21 20:43 ` Junio C Hamano
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).