Re: [PATCH v3 0/9] icase match on non-ascii

2015-07-15 Thread Duy Nguyen
On Tue, Jul 14, 2015 at 11:42 PM, Torsten Bögershausen tbo...@web.de wrote:
 (I haven't been able to do more debugging yet,
 but this doesn't fully work on my Mac OS X box:)

 Initialized empty Git repository in
 /Users/tb/NoBackup/projects/git/tb.150714_Duy_grep_utf8/t/trash
 directory.t7812-grep-icase-non-ascii/.git/
 # 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
 expecting success:
 printf TILRAUN: Halló Heimur! file 
 git add file 
 LC_ALL=$is_IS_locale 
 export LC_ALL

 ok 1 - setup

 expecting success:
 git grep -i TILRAUN: Halló Heimur! 
 git grep -i TILRAUN: HALLÓ HEIMUR!

 file:TILRAUN: Halló Heimur!
 not ok 2 - grep literal string, no -F
 #
 #git grep -i TILRAUN: Halló Heimur! 
 #git grep -i TILRAUN: HALLÓ HEIMUR!
 #

I don't know if there's an easy way to test if regexec() on your
system supports locale (at least for is_IS). I can reproduce the same
by using compat regex. So it's not a good news because compat regex is
used in a few platforms, so this test will fail on those.

I don't see any way around it, except dropping all the tests. I don't
think there is a way for us to test regex locale support at runtime.
-- 
Duy
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v3 0/9] icase match on non-ascii

2015-07-15 Thread Torsten Bögershausen
 I don't see any way around it, except dropping all the tests. I don't
 think there is a way for us to test regex locale support at runtime.
 
(I don't think dropping all tests is a good way forward)
Either there is runtime code similar to test-regex.c,
or how about something like this:

commit a1cdac0fc0df1dad20f4dc196688a73c11b00480
Author: Torsten Bögershausen tbo...@web.de
Date:   Wed Jul 15 21:43:47 2015 +0200

t7812: More LIBPCRE preconditions

Some (e.g. BSD based) regex libraries are not able to handle
UTF-8 strings case-insensitive (if asked so)

Exclude some test cases by using the LIBPCRE precondition

diff --git a/t/t7812-grep-icase-non-ascii.sh b/t/t7812-grep-icase-non-ascii.sh
index d07fa20..30d3d68 100755
--- a/t/t7812-grep-icase-non-ascii.sh
+++ b/t/t7812-grep-icase-non-ascii.sh
@@ -11,9 +11,12 @@ test_expect_success GETTEXT_LOCALE 'setup' '
export LC_ALL
 '

-test_expect_success GETTEXT_LOCALE 'grep literal string, no -F' '
-   git grep -i TILRAUN: Halló Heimur! 
-   git grep -i TILRAUN: HALLÓ HEIMUR!
+test_expect_success GETTEXT_LOCALE 'grep literal low string, no -F' '
+   git grep -i TILRAUN: Halló Heimur!
+'
+
+test_expect_success GETTEXT_LOCALE,LIBPCRE 'grep literal up string, no -F' '
+   git grep -i TILRAUN: HALLÓ. HEIMUR!
 '

 test_expect_success GETTEXT_LOCALE,LIBPCRE 'grep pcre utf-8 icase' '
@@ -31,33 +34,37 @@ test_expect_success GETTEXT_LOCALE,LIBPCRE 'grep pcre utf-8
string with +' '
test_cmp expected actual
 '

-test_expect_success GETTEXT_LOCALE 'grep literal string, with -F' '
+test_expect_success GETTEXT_LOCALE 'grep literal low string, with -F' '
git grep --debug -i -F TILRAUN: Halló Heimur!  21 /dev/null |
 grep fixed debug1 
echo fixedTILRAUN: Halló Heimur! expect1 
-   test_cmp expect1 debug1 
+   test_cmp expect1 debug1
+'

+test_expect_success GETTEXT_LOCALE 'grep literal up string, with -F' '
git grep --debug -i -F TILRAUN: HALLÓ HEIMUR!  21 /dev/null |
 grep fixed debug2 
echo fixedTILRAUN: HALLÓ HEIMUR! expect2 
test_cmp expect2 debug2
 '

-test_expect_success GETTEXT_LOCALE 'grep string with regex, with -F' '
+test_expect_success GETTEXT_LOCALE,LIBPCRE 'grep string with regex, with -F' '
printf ^*TILR^AUN:.* \\Halló \$He[]imur!\$ file 

git grep --debug -i -F ^*TILR^AUN:.* \\Halló \$He[]imur!\$ 21 
/dev/null |
 grep fixed debug1 
echo fixed\\^*TILR^AUN:\\.\\* Halló \$He\\[]imur!\\\$ expect1 
-   test_cmp expect1 debug1 
+   test_cmp expect1 debug1
+'

+test_expect_success GETTEXT_LOCALE,LIBPCRE 'grep up string with regex, with 
-F' '
git grep --debug -i -F ^*TILR^AUN:.* \\HALLÓ \$HE[]IMUR!\$  21 
/dev/null |
 grep fixed debug2 
echo fixed\\^*TILR^AUN:\\.\\* HALLÓ \$HE\\[]IMUR!\\\$ expect2 
test_cmp expect2 debug2
 '

-test_expect_success GETTEXT_LOCALE 'pickaxe -i on non-ascii' '
+test_expect_success GETTEXT_LOCALE,LIBPCRE 'pickaxe -i on non-ascii' '
git commit -m first 
git log --format=%f -i -STILRAUN: HALLÓ HEIMUR! actual 
echo first expected 

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v3 0/9] icase match on non-ascii

2015-07-14 Thread Torsten Bögershausen
(I haven't been able to do more debugging yet,
but this doesn't fully work on my Mac OS X box:)

Initialized empty Git repository in
/Users/tb/NoBackup/projects/git/tb.150714_Duy_grep_utf8/t/trash
directory.t7812-grep-icase-non-ascii/.git/
# 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
expecting success:
printf TILRAUN: Halló Heimur! file 
git add file 
LC_ALL=$is_IS_locale 
export LC_ALL

ok 1 - setup

expecting success:
git grep -i TILRAUN: Halló Heimur! 
git grep -i TILRAUN: HALLÓ HEIMUR!

file:TILRAUN: Halló Heimur!
not ok 2 - grep literal string, no -F
#   
#git grep -i TILRAUN: Halló Heimur! 
#git grep -i TILRAUN: HALLÓ HEIMUR!
#   

skipping test: grep pcre utf-8 icase
git grep --perl-regexpTILRAUN: H.lló Heimur! 
git grep --perl-regexp -i TILRAUN: H.lló Heimur! 
git grep --perl-regexp -i TILRAUN: H.LLÓ HEIMUR!

ok 3 # skip grep pcre utf-8 icase (missing LIBPCRE of GETTEXT_LOCALE,LIBPCRE)

skipping test: grep pcre utf-8 string with +
printf TILRAUN: Hallóó Heimur! file2 
git add file2 
git grep -l --perl-regexp TILRAUN: H.lló+ Heimur! actual 
echo file expected 
echo file2 expected 
test_cmp expected actual

ok 4 # skip grep pcre utf-8 string with + (missing LIBPCRE of
GETTEXT_LOCALE,LIBPCRE)

expecting success:
git grep --debug -i -F TILRAUN: Halló Heimur!  21 /dev/null |
 grep fixed debug1 
echo fixedTILRAUN: Halló Heimur! expect1 
test_cmp expect1 debug1 

git grep --debug -i -F TILRAUN: HALLÓ HEIMUR!  21 /dev/null |
 grep fixed debug2 
echo fixedTILRAUN: HALLÓ HEIMUR! expect2 
test_cmp expect2 debug2

ok 5 - grep literal string, with -F

expecting success:
printf ^*TILR^AUN:.* \\Halló \$He[]imur!\$ file 

git grep --debug -i -F ^*TILR^AUN:.* \\Halló \$He[]imur!\$ 21 
/dev/null |
 grep fixed debug1 
echo fixed\\^*TILR^AUN:\\.\\* Halló \$He\\[]imur!\\\$ expect1 
test_cmp expect1 debug1 

git grep --debug -i -F ^*TILR^AUN:.* \\HALLÓ \$HE[]IMUR!\$  21 
/dev/null |
 grep fixed debug2 
echo fixed\\^*TILR^AUN:\\.\\* HALLÓ \$HE\\[]IMUR!\\\$ expect2 
test_cmp expect2 debug2

--- expect12015-07-14 16:38:22.0 +
+++ debug12015-07-14 16:38:22.0 +
@@ -1 +1 @@
-fixed\^*TILR^AUN:\.\* \Halló $He\[]imur!\$
+fixed\^*TILR^AUN:\.\* \\Halló $He\[]imur!\$
not ok 6 - grep string with regex, with -F
#   
#printf ^*TILR^AUN:.* \\Halló \$He[]imur!\$ file 
#   
#git grep --debug -i -F ^*TILR^AUN:.* \\Halló \$He[]imur!\$ 21
/dev/null |
# grep fixed debug1 
#echo fixed\\^*TILR^AUN:\\.\\* Halló \$He\\[]imur!\\\$ expect1 
#test_cmp expect1 debug1 
#   
#git grep --debug -i -F ^*TILR^AUN:.* \\HALLÓ \$HE[]IMUR!\$  21
/dev/null |
# grep fixed debug2 
#echo fixed\\^*TILR^AUN:\\.\\* HALLÓ \$HE\\[]IMUR!\\\$ expect2 
#test_cmp expect2 debug2
#   

expecting success:
git commit -m first 
git log --format=%f -i -STILRAUN: HALLÓ HEIMUR! actual 
echo first expected 
test_cmp expected actual

[master (root-commit) e6052d5] first
 Author: A U Thor aut...@example.com
 1 file changed, 1 insertion(+)
 create mode 100644 file
--- expected2015-07-14 16:38:22.0 +
+++ actual2015-07-14 16:38:22.0 +
@@ -1 +0,0 @@
-first
not ok 7 - pickaxe -i on non-ascii
#   
#git commit -m first 
#git log --format=%f -i -STILRAUN: HALLÓ HEIMUR! actual 
#echo first expected 
#test_cmp expected actual
#   

# failed 3 among 7 test(s)
1..7


--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html