Re: [PATCH/RFC] Change t0204-gettext-reencode-sanity.sh to pass under Mac OSX

Subsystems: the rest

5 messages, 3 authors, 2016-06-15 · open the first message on its own page

Re: [PATCH/RFC] Change t0204-gettext-reencode-sanity.sh to pass under Mac OSX

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:53:14

Ævar Arnfjörð Bjarmason [off-list ref] writes:
Having that information doesn't cost us a lot, in this case we can
just amend the test to assert that on OSX the output should be the
same as under the UTF-8 output.
Known modes of error behaviour are to show:

 - runs of "?", saying "I dunno";

 - the key used to query the message catalog ("TEST: Old English
   Runes"), saying "I don't do i18n"; or

 - the raw value stored in the message catalog (runes in UTF-8).

and each makes sort-of sense in its own way.

I would be OK if the patch read like the attached, but I do not
think treating the "show key" and "stuff with ?" case differently
like the original code did makes any sense.

It may be better to clarify in the "say" comment that this test is
not about finding if the user's system is *broken* but about seeing
if the "undefined" behaviour upon user error is one that we
recognize, though.

 t/t0204-gettext-reencode-sanity.sh |   21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)
diff --git a/t/t0204-gettext-reencode-sanity.sh b/t/t0204-gettext-reencode-sanity.sh
index 189af90..8911e93 100755
--- a/t/t0204-gettext-reencode-sanity.sh
+++ b/t/t0204-gettext-reencode-sanity.sh
@@ -7,6 +7,7 @@ test_description="Gettext reencoding of our *.po/*.mo files works"
 
 . ./lib-gettext.sh
 
+RUNES="TILRAUN: ᚻᛖ ᚳᚹᚫᚦ ᚦᚫᛏ ᚻᛖ ᛒᚢᛞᛖ ᚩᚾ ᚦᚫᛗ ᛚᚪᚾᛞᛖ ᚾᚩᚱᚦᚹᛖᚪᚱᛞᚢᛗ ᚹᛁᚦ ᚦᚪ ᚹᛖᛥᚫ"
 
 test_expect_success GETTEXT_LOCALE 'gettext: Emitting UTF-8 from our UTF-8 *.mo files / Icelandic' '
     printf "TILRAUN: Halló Heimur!" >expect &&
@@ -15,7 +16,7 @@ test_expect_success GETTEXT_LOCALE 'gettext: Emitting UTF-8 from our UTF-8 *.mo
 '
 
 test_expect_success GETTEXT_LOCALE 'gettext: Emitting UTF-8 from our UTF-8 *.mo files / Runes' '
-    printf "TILRAUN: ᚻᛖ ᚳᚹᚫᚦ ᚦᚫᛏ ᚻᛖ ᛒᚢᛞᛖ ᚩᚾ ᚦᚫᛗ ᛚᚪᚾᛞᛖ ᚾᚩᚱᚦᚹᛖᚪᚱᛞᚢᛗ ᚹᛁᚦ ᚦᚪ ᚹᛖᛥᚫ" >expect &&
+    printf "%s" "$RUNES" >expect &&
     LANGUAGE=is LC_ALL="$is_IS_locale" gettext "TEST: Old English Runes" >actual &&
     test_cmp expect actual
 '
@@ -28,15 +29,19 @@ test_expect_success GETTEXT_ISO_LOCALE 'gettext: Emitting ISO-8859-1 from our UT
 
 test_expect_success GETTEXT_ISO_LOCALE 'gettext: Emitting ISO-8859-1 from our UTF-8 *.mo files / Runes' '
     LANGUAGE=is LC_ALL="$is_IS_iso_locale" gettext "TEST: Old English Runes" >runes &&
-
-	if grep "^TEST: Old English Runes$" runes
+	runes=$(cat runes) &&
+	if test "z$runes" = "zTEST: Old English Runes"
+	then
+		say "Your system gives back the key to message catalog for an impossible request"
+	elif test "z$runes" = "zTILRAUN: ?? ???? ??? ?? ???? ?? ??? ????? ??????????? ??? ?? ????"
+	then
+		say "Your system replaces an impossible character with ?"
+ 	elif test "z$runes" = "z$RUNES"
 	then
-		say "Your system can not handle this complexity and returns the string as-is"
+		say "Your system gives back the raw message for an impossible request"
 	else
-		# Both Solaris and GNU libintl will return this stream of
-		# question marks, so it is s probably portable enough
-		printf "TILRAUN: ?? ???? ??? ?? ???? ?? ??? ????? ??????????? ??? ?? ????" >runes-expect &&
-		test_cmp runes-expect runes
+		say "We error behaviour your system shows"
+		false
 	fi
 '
 

Re: [PATCH/RFC] Change t0204-gettext-reencode-sanity.sh to pass under Mac OSX

From: Torsten Bögershausen <hidden>
Date: 2016-06-15 22:53:14

On 08.03.12 00:36, Junio C Hamano wrote:
quoted hunk
Ævar Arnfjörð Bjarmason [off-list ref] writes:
quoted
Having that information doesn't cost us a lot, in this case we can
just amend the test to assert that on OSX the output should be the
same as under the UTF-8 output.
Known modes of error behaviour are to show:

 - runs of "?", saying "I dunno";

 - the key used to query the message catalog ("TEST: Old English
   Runes"), saying "I don't do i18n"; or

 - the raw value stored in the message catalog (runes in UTF-8).

and each makes sort-of sense in its own way.

I would be OK if the patch read like the attached, but I do not
think treating the "show key" and "stuff with ?" case differently
like the original code did makes any sense.

It may be better to clarify in the "say" comment that this test is
not about finding if the user's system is *broken* but about seeing
if the "undefined" behaviour upon user error is one that we
recognize, though.

 t/t0204-gettext-reencode-sanity.sh |   21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)
diff --git a/t/t0204-gettext-reencode-sanity.sh b/t/t0204-gettext-reencode-sanity.sh
index 189af90..8911e93 100755
--- a/t/t0204-gettext-reencode-sanity.sh
+++ b/t/t0204-gettext-reencode-sanity.sh
@@ -7,6 +7,7 @@ test_description="Gettext reencoding of our *.po/*.mo files works"
 
 . ./lib-gettext.sh
 
+RUNES="TILRAUN: ᚻᛖ ᚳᚹᚫᚦ ᚦᚫᛏ ᚻᛖ ᛒᚢᛞᛖ ᚩᚾ ᚦᚫᛗ ᛚᚪᚾᛞᛖ ᚾᚩᚱᚦᚹᛖᚪᚱᛞᚢᛗ ᚹᛁᚦ ᚦᚪ ᚹᛖᛥᚫ"
 
 test_expect_success GETTEXT_LOCALE 'gettext: Emitting UTF-8 from our UTF-8 *.mo files / Icelandic' '
     printf "TILRAUN: Halló Heimur!" >expect &&
@@ -15,7 +16,7 @@ test_expect_success GETTEXT_LOCALE 'gettext: Emitting UTF-8 from our UTF-8 *.mo
 '
 
 test_expect_success GETTEXT_LOCALE 'gettext: Emitting UTF-8 from our UTF-8 *.mo files / Runes' '
-    printf "TILRAUN: ᚻᛖ ᚳᚹᚫᚦ ᚦᚫᛏ ᚻᛖ ᛒᚢᛞᛖ ᚩᚾ ᚦᚫᛗ ᛚᚪᚾᛞᛖ ᚾᚩᚱᚦᚹᛖᚪᚱᛞᚢᛗ ᚹᛁᚦ ᚦᚪ ᚹᛖᛥᚫ" >expect &&
+    printf "%s" "$RUNES" >expect &&
     LANGUAGE=is LC_ALL="$is_IS_locale" gettext "TEST: Old English Runes" >actual &&
     test_cmp expect actual
 '
@@ -28,15 +29,19 @@ test_expect_success GETTEXT_ISO_LOCALE 'gettext: Emitting ISO-8859-1 from our UT
 
 test_expect_success GETTEXT_ISO_LOCALE 'gettext: Emitting ISO-8859-1 from our UTF-8 *.mo files / Runes' '
     LANGUAGE=is LC_ALL="$is_IS_iso_locale" gettext "TEST: Old English Runes" >runes &&
-
-	if grep "^TEST: Old English Runes$" runes
+	runes=$(cat runes) &&
+	if test "z$runes" = "zTEST: Old English Runes"
+	then
+		say "Your system gives back the key to message catalog for an impossible request"
+	elif test "z$runes" = "zTILRAUN: ?? ???? ??? ?? ???? ?? ??? ????? ??????????? ??? ?? ????"
+	then
+		say "Your system replaces an impossible character with ?"
+ 	elif test "z$runes" = "z$RUNES"
 	then
-		say "Your system can not handle this complexity and returns the string as-is"
+		say "Your system gives back the raw message for an impossible request"
 	else
-		# Both Solaris and GNU libintl will return this stream of
-		# question marks, so it is s probably portable enough
-		printf "TILRAUN: ?? ???? ??? ?? ???? ?? ??? ????? ??????????? ??? ?? ????" >runes-expect &&
-		test_cmp runes-expect runes
+		say "We error behaviour your system shows"
+		false
 	fi
 '
 



--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
With that patch the t0204 test is passed.

(based on 1.7.10-rc0).

 And all the other tests passed as well.

/Torsten



Applying: Change t0204-gettext-reencode-sanity.sh to pass under Mac OSX
/Users/tb/projects/git/git_git/.git/rebase-apply/patch:35: space before tab in indent.
        elif test "z$runes" = "z$RUNES"
warning: 1 line adds whitespace errors.
~/projects/git/git_git> cd t
~/projects/git/git_git/t> ./t0204-gettext-reencode-sanity.sh
# lib-gettext: No is_IS UTF-8 locale available
# lib-gettext: No is_IS ISO-8859-1 locale available
ok 1 # skip gettext: Emitting UTF-8 from our UTF-8 *.mo files / Icelandic (missing GETTEXT_LOCALE)
ok 2 # skip gettext: Emitting UTF-8 from our UTF-8 *.mo files / Runes (missing GETTEXT_LOCALE)
ok 3 # skip gettext: Emitting ISO-8859-1 from our UTF-8 *.mo files / Icelandic (missing GETTEXT_ISO_LOCALE)
ok 4 # skip gettext: Emitting ISO-8859-1 from our UTF-8 *.mo files / Runes (missing GETTEXT_ISO_LOCALE)
ok 5 # skip gettext: Fetching a UTF-8 msgid -> UTF-8 (missing GETTEXT_LOCALE)
ok 6 # skip gettext: Fetching a UTF-8 msgid -> ISO-8859-1 (missing GETTEXT_ISO_LOCALE)
ok 7 # skip gettext.c: git init UTF-8 -> UTF-8 (missing GETTEXT_LOCALE)
ok 8 # skip gettext.c: git init UTF-8 -> ISO-8859-1 (missing GETTEXT_ISO_LOCALE)
# passed all 8 test(s)
1..8

Re: [PATCH/RFC] Change t0204-gettext-reencode-sanity.sh to pass under Mac OSX

From: Johannes Sixt <hidden>
Date: 2016-06-15 22:53:14

Am 3/8/2012 6:54, schrieb Torsten Bögershausen:
On 08.03.12 00:36, Junio C Hamano wrote:
quoted
 test_expect_success GETTEXT_ISO_LOCALE 'gettext: Emitting ISO-8859-1 from our UTF-8 *.mo files / Runes' '
ok 4 # skip gettext: Emitting ISO-8859-1 from our UTF-8 *.mo files / Runes (missing GETTEXT_ISO_LOCALE)
         ^^^^
Huh? How can you have tripped over this test in the first place? The
prerequisite did not change in Junio's patch. Why was the test not skipped
before you started this thread with your own patch?

-- Hannes

Re: [PATCH/RFC] Change t0204-gettext-reencode-sanity.sh to pass under Mac OSX

From: Torsten Bögershausen <hidden>
Date: 2016-06-15 22:53:15

Am 08.03.2012 um 08:23 schrieb Johannes Sixt:
Am 3/8/2012 6:54, schrieb Torsten Bögershausen:
quoted
On 08.03.12 00:36, Junio C Hamano wrote:
quoted
test_expect_success GETTEXT_ISO_LOCALE 'gettext: Emitting ISO-8859-1 from our UTF-8 *.mo files / Runes' '
quoted
ok 4 # skip gettext: Emitting ISO-8859-1 from our UTF-8 *.mo files / Runes (missing GETTEXT_ISO_LOCALE)
        ^^^^
Huh? How can you have tripped over this test in the first place? The
prerequisite did not change in Junio's patch. Why was the test not skipped
before you started this thread with your own patch?

-- Hannes
Hm, 
things are getting confusing.

After re-booting the machine, cloning git ... I get the following on a clean 1.7.10-rc0 (without Junios patch):

tb@birne:~/projects/git/git_clean/t> ./t0204-gettext-reencode-sanity.sh 
# lib-gettext: No is_IS UTF-8 locale available
# lib-gettext: No is_IS ISO-8859-1 locale available
ok 1 # skip gettext: Emitting UTF-8 from our UTF-8 *.mo files / Icelandic (missing GETTEXT_LOCALE)
ok 2 # skip gettext: Emitting UTF-8 from our UTF-8 *.mo files / Runes (missing GETTEXT_LOCALE)
ok 3 # skip gettext: Emitting ISO-8859-1 from our UTF-8 *.mo files / Icelandic (missing GETTEXT_ISO_LOCALE)
ok 4 # skip gettext: Emitting ISO-8859-1 from our UTF-8 *.mo files / Runes (missing GETTEXT_ISO_LOCALE)
ok 5 # skip gettext: Fetching a UTF-8 msgid -> UTF-8 (missing GETTEXT_LOCALE)
ok 6 # skip gettext: Fetching a UTF-8 msgid -> ISO-8859-1 (missing GETTEXT_ISO_LOCALE)
ok 7 # skip gettext.c: git init UTF-8 -> UTF-8 (missing GETTEXT_LOCALE)
ok 8 # skip gettext.c: git init UTF-8 -> ISO-8859-1 (missing GETTEXT_ISO_LOCALE)
# passed all 8 test(s)
1..8

on 5e9637c629702e3d41ad01d95956d1835  the log looks like this:


tb@birne:~/projects/git/git_clean/t> ./t0204-gettext-reencode-sanity.sh 
# lib-gettext: Found 'is_IS.UTF-8' as an is_IS UTF-8 locale
# lib-gettext: Found 'is_IS.ISO8859-1' as an is_IS ISO-8859-1 locale
ok 1 - gettext: Emitting UTF-8 from our UTF-8 *.mo files / Icelandic
ok 2 - gettext: Emitting UTF-8 from our UTF-8 *.mo files / Runes
ok 3 - gettext: Emitting ISO-8859-1 from our UTF-8 *.mo files / Icelandic
ok 4 - gettext: Emitting ISO-8859-1 from our UTF-8 *.mo files / Runes
ok 5 - gettext: Fetching a UTF-8 msgid -> UTF-8
ok 6 - gettext: Fetching a UTF-8 msgid -> ISO-8859-1
ok 7 - gettext.c: git init UTF-8 -> UTF-8
ok 8 - gettext.c: git init UTF-8 -> ISO-8859-1
# passed all 8 test(s)
1..8
tb@birne:~/projects/git/git_clean/t> 


At the moment I would like to say sorry for the noise.
If somebody is interested. I can dig into details later this evening (european time) 
/Torsten

Re: [PATCH/RFC] Change t0204-gettext-reencode-sanity.sh to pass under Mac OSX

From: Torsten Bögershausen <hidden>
Date: 2016-06-15 22:53:15

On 08.03.12 10:21, Torsten Bögershausen wrote:
Am 08.03.2012 um 08:23 schrieb Johannes Sixt:
quoted
Am 3/8/2012 6:54, schrieb Torsten Bögershausen:
quoted
On 08.03.12 00:36, Junio C Hamano wrote:
quoted
test_expect_success GETTEXT_ISO_LOCALE 'gettext: Emitting ISO-8859-1 from our UTF-8 *.mo files / Runes' '
quoted
ok 4 # skip gettext: Emitting ISO-8859-1 from our UTF-8 *.mo files / Runes (missing GETTEXT_ISO_LOCALE)
        ^^^^
Huh? How can you have tripped over this test in the first place? The
prerequisite did not change in Junio's patch. Why was the test not skipped
before you started this thread with your own patch?

-- Hannes
Hm, 
things are getting confusing.

After re-booting the machine, cloning git ... I get the following on a clean 1.7.10-rc0 (without Junios patch):

tb@birne:~/projects/git/git_clean/t> ./t0204-gettext-reencode-sanity.sh 
# lib-gettext: No is_IS UTF-8 locale available
# lib-gettext: No is_IS ISO-8859-1 locale available
ok 1 # skip gettext: Emitting UTF-8 from our UTF-8 *.mo files / Icelandic (missing GETTEXT_LOCALE)
ok 2 # skip gettext: Emitting UTF-8 from our UTF-8 *.mo files / Runes (missing GETTEXT_LOCALE)
ok 3 # skip gettext: Emitting ISO-8859-1 from our UTF-8 *.mo files / Icelandic (missing GETTEXT_ISO_LOCALE)
ok 4 # skip gettext: Emitting ISO-8859-1 from our UTF-8 *.mo files / Runes (missing GETTEXT_ISO_LOCALE)
ok 5 # skip gettext: Fetching a UTF-8 msgid -> UTF-8 (missing GETTEXT_LOCALE)
ok 6 # skip gettext: Fetching a UTF-8 msgid -> ISO-8859-1 (missing GETTEXT_ISO_LOCALE)
ok 7 # skip gettext.c: git init UTF-8 -> UTF-8 (missing GETTEXT_LOCALE)
ok 8 # skip gettext.c: git init UTF-8 -> ISO-8859-1 (missing GETTEXT_ISO_LOCALE)
# passed all 8 test(s)
1..8

on 5e9637c629702e3d41ad01d95956d1835  the log looks like this:


tb@birne:~/projects/git/git_clean/t> ./t0204-gettext-reencode-sanity.sh 
# lib-gettext: Found 'is_IS.UTF-8' as an is_IS UTF-8 locale
# lib-gettext: Found 'is_IS.ISO8859-1' as an is_IS ISO-8859-1 locale
ok 1 - gettext: Emitting UTF-8 from our UTF-8 *.mo files / Icelandic
ok 2 - gettext: Emitting UTF-8 from our UTF-8 *.mo files / Runes
ok 3 - gettext: Emitting ISO-8859-1 from our UTF-8 *.mo files / Icelandic
ok 4 - gettext: Emitting ISO-8859-1 from our UTF-8 *.mo files / Runes
ok 5 - gettext: Fetching a UTF-8 msgid -> UTF-8
ok 6 - gettext: Fetching a UTF-8 msgid -> ISO-8859-1
ok 7 - gettext.c: git init UTF-8 -> UTF-8
ok 8 - gettext.c: git init UTF-8 -> ISO-8859-1
# passed all 8 test(s)
1..8
tb@birne:~/projects/git/git_clean/t> 


At the moment I would like to say sorry for the noise.
If somebody is interested. I can dig into details later this evening (european time) 
/Torsten
Here we have the change from t0204-gettext-reencode-sanity.sh beeing passed 
into all tests being skipped under Mac OS X:

42f16113ee87ff667fef3a821e:
# lib-gettext: Found 'is_IS.UTF-8' as an is_IS UTF-8 locale
# lib-gettext: Found 'is_IS.ISO8859-1' as an is_IS ISO-8859-1 locale
ok 1 - gettext: Emitting UTF-8 from our UTF-8 *.mo files / Icelandic
ok 2 - gettext: Emitting UTF-8 from our UTF-8 *.mo files / Runes
ok 3 - gettext: Emitting ISO-8859-1 from our UTF-8 *.mo files / Icelandic
ok 4 - gettext: Emitting ISO-8859-1 from our UTF-8 *.mo files / Runes
ok 5 - gettext: Fetching a UTF-8 msgid -> UTF-8
ok 6 - gettext: Fetching a UTF-8 msgid -> ISO-8859-1
ok 7 - gettext.c: git init UTF-8 -> UTF-8
ok 8 - gettext.c: git init UTF-8 -> ISO-8859-1
# passed all 8 test(s)
1..8

ad17ea73477012bfe1027a8a999e9e2d9f62145:
# lib-gettext: No is_IS UTF-8 locale available
# lib-gettext: No is_IS ISO-8859-1 locale available
ok 1 # skip gettext: Emitting UTF-8 from our UTF-8 *.mo files / Icelandic (missing GETTEXT_LOCALE)
ok 2 # skip gettext: Emitting UTF-8 from our UTF-8 *.mo files / Runes (missing GETTEXT_LOCALE)
ok 3 # skip gettext: Emitting ISO-8859-1 from our UTF-8 *.mo files / Icelandic (missing GETTEXT_ISO_LOCALE)
ok 4 # skip gettext: Emitting ISO-8859-1 from our UTF-8 *.mo files / Runes (missing GETTEXT_ISO_LOCALE)
ok 5 # skip gettext: Fetching a UTF-8 msgid -> UTF-8 (missing GETTEXT_LOCALE)
ok 6 # skip gettext: Fetching a UTF-8 msgid -> ISO-8859-1 (missing GETTEXT_ISO_LOCALE)
ok 7 # skip gettext.c: git init UTF-8 -> UTF-8 (missing GETTEXT_LOCALE)
ok 8 # skip gettext.c: git init UTF-8 -> ISO-8859-1 (missing GETTEXT_ISO_LOCALE)
# passed all 8 test(s)


commit ad17ea734770126bfe1027a8a999e9e2d9f62145
Author: Alex Riesen [off-list ref]
Date:   Mon Jan 23 14:04:29 2012 -0800

    add a Makefile switch to avoid gettext translation in shell scripts
    
    Some systems have gettext.sh (GNU gettext) installed, but it is either
    broken or misconfigured in such a way so its output is not usable.  In
    case the users of these systems are unable or not interested in fixing
    them, setting the new Makefile switch should help:
    
        make USE_GETTEXT_SCHEME=fallthrough
    
    This will replace the translation routines with fallthrough versions,
    that does not use gettext from the platform.
    
    Signed-off-by: Alex Riesen [off-list ref]
    Signed-off-by: Junio C Hamano [off-list ref]

:100644 100644 9470a1034396a5f3ee36c5d0e6ffc54e21bb3820 a0f2464a9b647fcd6b817e9bb86b7f79190acb01 M      Makefile
:100644 100644 6648bd3726f18c95de5737663fae652cadac0003 d5fae993b0c093bdd07079101df303c2c74deae3 M      git-sh-i18n.sh
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help