* Test failures when Git is built with libpcre and grep is built without it
@ 2017-01-01 4:59 A. Wilcox
2017-01-01 10:19 ` Torsten Bögershausen
2017-01-02 6:53 ` Jeff King
0 siblings, 2 replies; 12+ messages in thread
From: A. Wilcox @ 2017-01-01 4:59 UTC (permalink / raw)
To: git
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
Hello!
I'm attempting to package Git for our new Linux distribution and I
have run in to a failure on our PowerPC builder while running the test
suite.
The PowerPC builder runs a tiny version of grep(1) that was not built
with PCRE. As such, grep -P returns 2 and prints:
grep: support for the -P option is not compiled into this
- --disable-perl-regexp binary
However, our Git build *does* link against libpcre. This causes a
tests numbered 142 and 143 to fail in t7810-grep.sh.
I am not sure the best way to handle this but I felt it would be
prudent to inform you of this issue. I will be happy to provide any
other information you may require.
Best,
arw
- --
A. Wilcox (awilfox)
Project Lead, Adélie Linux
http://adelielinux.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2
iQIcBAEBCAAGBQJYaIycAAoJEMspy1GSK50U/g4P/AtPRfeOv8pENfI/PnlhXqSD
C28CR0Hzv4qBv/Ay8vpBfmkM177bBnra5GTcfnAZ0wvxJUiqnkluu+EJ2UWfPNse
r5ZbDkXCp42oek+vIi7jYi7UsyNqwyT1DziYLR5PDopT3L8YK7i9pZCQZ+mDSmVT
Iu3gYmLvyyEL7r104o6ACRw11P5CDL9bKFmSVacD9UvPL3EjOM9LrSdRDzvJmk0u
nqAOH6yw4wknxCWGPA3JT4DM9GD5DB/Y+UmVQrrpA+Txl8gbPjgzb1PX4qogHjNq
dNDk1jeKJd/CmwJdAU6eKQ3bgfnIXzLbTDVmaMTMlUUsHzlqE/7QYnrae76ECmmn
drmezgKRwTtVgQjQ8l/F/c+EQhux9c0zM9Lz+0Hrd7v1WwohLQDA0xYOE8cCaLw1
8WmXQWjNG1Ih2GpAZH7CRreWyiDAiaAZI2d/zOhsgG9edNEmNn+LkesajVdMywUJ
jKlxmKk6qK2uPDPVrD261ODtMxVdptG6/+m24iz56WRERWkkFBpZz15OtrtlLa2E
0LcFiu2f5lki12XDZsSJwkLeGfb6KyxfCPKtGP7TAVAYO43ORQHKhks8pheOMwJa
dpL4+72CzkI57LyCtl0NiSMZH2zKUvxp8OqKgE/gpDwbhwh8spAHdUaiaS6emiPj
MM6jb7ru9eo4gD6seRCp
=R9eQ
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Test failures when Git is built with libpcre and grep is built without it
2017-01-01 4:59 Test failures when Git is built with libpcre and grep is built without it A. Wilcox
@ 2017-01-01 10:19 ` Torsten Bögershausen
2017-01-02 6:53 ` Jeff King
1 sibling, 0 replies; 12+ messages in thread
From: Torsten Bögershausen @ 2017-01-01 10:19 UTC (permalink / raw)
To: A. Wilcox, git
On 01.01.17 05:59, A. Wilcox wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
>
> Hello!
>
> I'm attempting to package Git for our new Linux distribution and I
> have run in to a failure on our PowerPC builder while running the test
> suite.
>
> The PowerPC builder runs a tiny version of grep(1) that was not built
> with PCRE. As such, grep -P returns 2 and prints:
>
> grep: support for the -P option is not compiled into this
> - --disable-perl-regexp binary
>
> However, our Git build *does* link against libpcre. This causes a
> tests numbered 142 and 143 to fail in t7810-grep.sh.
>
> I am not sure the best way to handle this but I felt it would be
> prudent to inform you of this issue. I will be happy to provide any
> other information you may require.
The first thing you can do is to run the test with debug and verbose:
debug=t verbose=t ./t7810-grep.sh
and post the output of these 2 test cases here:
(mine looks like this)
expecting success:
echo "ab:a+bc" >expected &&
git \
-c grep.patterntype=extended \
-c grep.patterntype=fixed \
-c grep.patterntype=basic \
grep "a+b*c" ab >actual &&
test_cmp expected actual
ok 142 - grep pattern with grep.patternType=extended, =fixed, =basic
expecting success:
echo "ab:abc" >expected &&
git grep -F -G -E "a+b*c" ab >actual &&
test_cmp expected actual
ok 143 - grep -F -G -E pattern
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Test failures when Git is built with libpcre and grep is built without it
2017-01-01 4:59 Test failures when Git is built with libpcre and grep is built without it A. Wilcox
2017-01-01 10:19 ` Torsten Bögershausen
@ 2017-01-02 6:53 ` Jeff King
2017-01-09 10:51 ` A. Wilcox
1 sibling, 1 reply; 12+ messages in thread
From: Jeff King @ 2017-01-02 6:53 UTC (permalink / raw)
To: A. Wilcox; +Cc: git
On Sat, Dec 31, 2016 at 10:59:11PM -0600, A. Wilcox wrote:
> I'm attempting to package Git for our new Linux distribution and I
> have run in to a failure on our PowerPC builder while running the test
> suite.
>
> The PowerPC builder runs a tiny version of grep(1) that was not built
> with PCRE. As such, grep -P returns 2 and prints:
>
> grep: support for the -P option is not compiled into this
> - --disable-perl-regexp binary
>
> However, our Git build *does* link against libpcre. This causes a
> tests numbered 142 and 143 to fail in t7810-grep.sh.
If we are using "grep -P" in our test suite, it should definitely be
marked with a prerequisite that is independent of the LIBPCRE one.
But I can't find any such place in our test suite. Grepping for
"grep.*-P" doesn't turn up any hits, and dropping this into my PATH as
"grep":
#!/bin/sh
case "$*" in
*-P*|*perl-regex*)
echo >&2 "Pretending not to understand -P"
exit 1
esac
exec /bin/grep "$@"
doesn't break anything. We do call "git grep -P", of course, but that
should be using the internal libpcre (once upon a time we would invoke
an external grep, but that feature has been gone for years).
Can you show us the output of "./t7810-grep.sh -v -i"?
-Peff
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Test failures when Git is built with libpcre and grep is built without it
2017-01-02 6:53 ` Jeff King
@ 2017-01-09 10:51 ` A. Wilcox
2017-01-09 11:27 ` Jeff King
2017-01-09 13:05 ` Andreas Schwab
0 siblings, 2 replies; 12+ messages in thread
From: A. Wilcox @ 2017-01-09 10:51 UTC (permalink / raw)
To: Jeff King; +Cc: git
[-- Attachment #1.1: Type: text/plain, Size: 2146 bytes --]
On 02/01/17 00:53, Jeff King wrote:
> On Sat, Dec 31, 2016 at 10:59:11PM -0600, A. Wilcox wrote:
>
>> I'm attempting to package Git for our new Linux distribution and
>> I have run in to a failure on our PowerPC builder while running
>> the test suite.
>>
>> The PowerPC builder runs a tiny version of grep(1) that was not
>> built with PCRE. As such, grep -P returns 2 and prints:
>>
>> grep: support for the -P option is not compiled into this -
>> --disable-perl-regexp binary
>>
>> However, our Git build *does* link against libpcre. This causes
>> a tests numbered 142 and 143 to fail in t7810-grep.sh.
>
> If we are using "grep -P" in our test suite, it should definitely
> be marked with a prerequisite that is independent of the LIBPCRE
> one.
>
> But I can't find any such place in our test suite. [snip] Can you
> show us the output of "./t7810-grep.sh -v -i"?
>
> -Peff
>
The output of this command was almost 1400 lines, so I attached the log.
Interestingly enough, you seem to be right. The failure is very
bizarre and has nothing to do with system /bin/grep:
test_must_fail: command succeeded: git grep -G -F -P -E a\x{2b}b\x{2a}c ab
not ok 142 - grep -G -F -P -E pattern
#
# >empty &&
# test_must_fail git grep -G -F -P -E "a\x{2b}b\x{2a}c"
ab >actual &&
# test_cmp empty actual
#
However:
elaine trash directory.t7810-grep # git grep -G -F -P -E
a\x{2b}b\x{2a}c ab >actual
fatal: command line, 'ax{2b}bx{2a}c': Invalid contents of {}
elaine trash directory.t7810-grep # echo $?
128
elaine trash directory.t7810-grep # cat actual
elaine trash directory.t7810-grep #
I can reliably reproduce this on our x86_64 builder as well. Note
that our distro is based on the musl libc, not glibc. The shell is:
GNU bash, version 4.3.48(1)-release (powerpc-foxkit-linux-musl)
lrwxrwxrwx 1 root root 4 Dec 29 10:43 /bin/sh -> /bin/bash
Any further assistance would be greatly appreciated; this one really
has me stumped.
Best,
-arw
--
A. Wilcox (awilfox)
Project Lead, Adélie Linux
http://adelielinux.org
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: test-failure.log --]
[-- Type: text/x-log; name="test-failure.log", Size: 42056 bytes --]
elaine t # ./t7810-grep.sh -v -i
Initialized empty Git repository in /usr/src/dev-vcs/git-2.7.3-r1/work/git-2.7.3/t/trash directory.t7810-grep/.git/
expecting success:
{
echo foo mmap bar
echo foo_mmap bar
echo foo_mmap bar mmap
echo foo mmap bar_mmap
echo foo_mmap bar mmap baz
} >file &&
{
echo Hello world
echo HeLLo world
echo Hello_world
echo HeLLo_world
} >hello_world &&
{
echo "a+b*c"
echo "a+bc"
echo "abc"
} >ab &&
echo vvv >v &&
echo ww w >w &&
echo x x xx x >x &&
echo y yy >y &&
echo zzz > z &&
mkdir t &&
echo test >t/t &&
echo vvv >t/v &&
mkdir t/a &&
echo vvv >t/a/v &&
{
echo "line without leading space1"
echo " line with leading space1"
echo " line with leading space2"
echo " line with leading space3"
echo "line without leading space2"
} >space &&
git add . &&
test_tick &&
git commit -m initial
[master (root-commit) cfd9fd5] initial
Author: A U Thor <author@example.com>
13 files changed, 32 insertions(+)
create mode 100644 ab
create mode 100644 file
create mode 100644 hello.c
create mode 100644 hello_world
create mode 100644 space
create mode 100644 t/a/v
create mode 100644 t/t
create mode 100644 t/v
create mode 100644 v
create mode 100644 w
create mode 100644 x
create mode 100644 y
create mode 100644 z
ok 1 - setup
expecting success:
test_must_fail git grep "("
fatal: unmatched parenthesis
ok 2 - grep should not segfault with a bad input
expecting success:
{
echo ${HC}file:1:foo mmap bar
echo ${HC}file:3:foo_mmap bar mmap
echo ${HC}file:4:foo mmap bar_mmap
echo ${HC}file:5:foo_mmap bar mmap baz
} >expected &&
git -c grep.linenumber=false grep -n -w -e mmap $H >actual &&
test_cmp expected actual
ok 3 - grep -w HEAD
expecting success:
{
echo ${HC}file:1:foo mmap bar
echo ${HC}file:3:foo_mmap bar mmap
echo ${HC}file:4:foo mmap bar_mmap
echo ${HC}file:5:foo_mmap bar mmap baz
} >expected &&
git -c grep.linenumber=true grep -w -e mmap $H >actual &&
test_cmp expected actual
ok 4 - grep -w HEAD
expecting success:
{
echo ${HC}file:foo mmap bar
echo ${HC}file:foo_mmap bar mmap
echo ${HC}file:foo mmap bar_mmap
echo ${HC}file:foo_mmap bar mmap baz
} >expected &&
git -c grep.linenumber=true grep --no-line-number -w -e mmap $H >actual &&
test_cmp expected actual
ok 5 - grep -w HEAD
expecting success:
: >expected &&
test_must_fail git grep -n -w -e "^w" $H >actual &&
test_cmp expected actual
ok 6 - grep -w HEAD (w)
expecting success:
{
echo ${HC}x:1:x x xx x
} >expected &&
git grep -n -w -e "x xx* x" $H >actual &&
test_cmp expected actual
ok 7 - grep -w HEAD (x)
expecting success:
{
echo ${HC}y:1:y yy
} >expected &&
git grep -n -w -e "^y" $H >actual &&
test_cmp expected actual
ok 8 - grep -w HEAD (y-1)
expecting success:
: >expected &&
if git grep -n -w -e "^y y" $H >actual
then
echo should not have matched
cat actual
false
else
test_cmp expected actual
fi
ok 9 - grep -w HEAD (y-2)
expecting success:
: >expected &&
if git grep -n -w -e "^z" $H >actual
then
echo should not have matched
cat actual
false
else
test_cmp expected actual
fi
ok 10 - grep -w HEAD (z)
expecting success:
echo "${HC}t/t:1:test" >expected &&
git grep -n -e test $H >actual &&
test_cmp expected actual
ok 11 - grep HEAD (t-1)
expecting success:
echo "${HC}t:1:test" >expected &&
(
cd t &&
git grep -n -e test $H
) >actual &&
test_cmp expected actual
ok 12 - grep HEAD (t-2)
expecting success:
echo "${HC}t/t:1:test" >expected &&
(
cd t &&
git grep --full-name -n -e test $H
) >actual &&
test_cmp expected actual
ok 13 - grep HEAD (t-3)
expecting success:
! git grep -c test $H | grep /dev/null
ok 14 - grep -c HEAD (no /dev/null)
expecting success:
{
echo ${HC}t/a/v:1:vvv
echo ${HC}t/v:1:vvv
echo ${HC}v:1:vvv
} >expected &&
git grep --max-depth -1 -n -e vvv $H >actual &&
test_cmp expected actual
ok 15 - grep --max-depth -1 HEAD
expecting success:
{
echo ${HC}v:1:vvv
} >expected &&
git grep --max-depth 0 -n -e vvv $H >actual &&
test_cmp expected actual
ok 16 - grep --max-depth 0 HEAD
expecting success:
{
echo ${HC}t/a/v:1:vvv
echo ${HC}t/v:1:vvv
echo ${HC}v:1:vvv
} >expected &&
git grep --max-depth 0 -n -e vvv $H -- "*" >actual &&
test_cmp expected actual
ok 17 - grep --max-depth 0 -- '*' HEAD
expecting success:
{
echo ${HC}t/v:1:vvv
echo ${HC}v:1:vvv
} >expected &&
git grep --max-depth 1 -n -e vvv $H >actual &&
test_cmp expected actual
ok 18 - grep --max-depth 1 HEAD
expecting success:
{
echo ${HC}t/v:1:vvv
} >expected &&
git grep --max-depth 0 -n -e vvv $H -- t >actual &&
test_cmp expected actual
ok 19 - grep --max-depth 0 -- t HEAD
expecting success:
{
echo ${HC}t/v:1:vvv
echo ${HC}v:1:vvv
} >expected &&
git grep --max-depth 0 -n -e vvv $H -- . t >actual &&
test_cmp expected actual
ok 20 - grep --max-depth 0 -- . t HEAD
expecting success:
{
echo ${HC}t/v:1:vvv
echo ${HC}v:1:vvv
} >expected &&
git grep --max-depth 0 -n -e vvv $H -- t . >actual &&
test_cmp expected actual
ok 21 - grep --max-depth 0 -- t . HEAD
expecting success:
echo "${HC}ab:a+bc" >expected &&
git -c grep.extendedRegexp=false grep "a+b*c" $H ab >actual &&
test_cmp expected actual
ok 22 - grep HEAD with grep.extendedRegexp=false
expecting success:
echo "${HC}ab:abc" >expected &&
git -c grep.extendedRegexp=true grep "a+b*c" $H ab >actual &&
test_cmp expected actual
ok 23 - grep HEAD with grep.extendedRegexp=true
expecting success:
echo "${HC}ab:a+bc" >expected &&
git -c grep.patterntype=basic grep "a+b*c" $H ab >actual &&
test_cmp expected actual
ok 24 - grep HEAD with grep.patterntype=basic
expecting success:
echo "${HC}ab:abc" >expected &&
git -c grep.patterntype=extended grep "a+b*c" $H ab >actual &&
test_cmp expected actual
ok 25 - grep HEAD with grep.patterntype=extended
expecting success:
echo "${HC}ab:a+b*c" >expected &&
git -c grep.patterntype=fixed grep "a+b*c" $H ab >actual &&
test_cmp expected actual
ok 26 - grep HEAD with grep.patterntype=fixed
expecting success:
echo "${HC}ab:a+b*c" >expected &&
git -c grep.patterntype=perl grep "a\x{2b}b\x{2a}c" $H ab >actual &&
test_cmp expected actual
ok 27 - grep HEAD with grep.patterntype=perl
expecting success:
echo "${HC}ab:abc" >expected &&
git \
-c grep.patternType=default \
-c grep.extendedRegexp=true \
grep "a+b*c" $H ab >actual &&
test_cmp expected actual
ok 28 - grep HEAD with grep.patternType=default and grep.extendedRegexp=true
expecting success:
echo "${HC}ab:abc" >expected &&
git \
-c grep.extendedRegexp=true \
-c grep.patternType=default \
grep "a+b*c" $H ab >actual &&
test_cmp expected actual
ok 29 - grep HEAD with grep.extendedRegexp=true and grep.patternType=default
expecting success:
echo "${HC}ab:abc" >expected &&
git \
-c grep.patternType=extended \
-c grep.extendedRegexp=false \
grep "a+b*c" $H ab >actual &&
test_cmp expected actual
ok 30 - grep HEAD with grep.patternType=extended and grep.extendedRegexp=false
expecting success:
echo "${HC}ab:a+bc" >expected &&
git \
-c grep.patternType=basic \
-c grep.extendedRegexp=true \
grep "a+b*c" $H ab >actual &&
test_cmp expected actual
ok 31 - grep HEAD with grep.patternType=basic and grep.extendedRegexp=true
expecting success:
echo "${HC}ab:abc" >expected &&
git \
-c grep.extendedRegexp=false \
-c grep.patternType=extended \
grep "a+b*c" $H ab >actual &&
test_cmp expected actual
ok 32 - grep HEAD with grep.extendedRegexp=false and grep.patternType=extended
expecting success:
echo "${HC}ab:a+bc" >expected &&
git \
-c grep.extendedRegexp=true \
-c grep.patternType=basic \
grep "a+b*c" $H ab >actual &&
test_cmp expected actual
ok 33 - grep HEAD with grep.extendedRegexp=true and grep.patternType=basic
expecting success:
echo ${HC}ab:3 >expected &&
git grep --count -e b $H -- ab >actual &&
test_cmp expected actual
ok 34 - grep --count HEAD
expecting success:
echo 3 >expected &&
git grep --count -h -e b $H -- ab >actual &&
test_cmp expected actual
ok 35 - grep --count -h HEAD
expecting success:
{
echo ${HC}file:1:foo mmap bar
echo ${HC}file:3:foo_mmap bar mmap
echo ${HC}file:4:foo mmap bar_mmap
echo ${HC}file:5:foo_mmap bar mmap baz
} >expected &&
git -c grep.linenumber=false grep -n -w -e mmap $H >actual &&
test_cmp expected actual
ok 36 - grep -w in working tree
expecting success:
{
echo ${HC}file:1:foo mmap bar
echo ${HC}file:3:foo_mmap bar mmap
echo ${HC}file:4:foo mmap bar_mmap
echo ${HC}file:5:foo_mmap bar mmap baz
} >expected &&
git -c grep.linenumber=true grep -w -e mmap $H >actual &&
test_cmp expected actual
ok 37 - grep -w in working tree
expecting success:
{
echo ${HC}file:foo mmap bar
echo ${HC}file:foo_mmap bar mmap
echo ${HC}file:foo mmap bar_mmap
echo ${HC}file:foo_mmap bar mmap baz
} >expected &&
git -c grep.linenumber=true grep --no-line-number -w -e mmap $H >actual &&
test_cmp expected actual
ok 38 - grep -w in working tree
expecting success:
: >expected &&
test_must_fail git grep -n -w -e "^w" $H >actual &&
test_cmp expected actual
ok 39 - grep -w in working tree (w)
expecting success:
{
echo ${HC}x:1:x x xx x
} >expected &&
git grep -n -w -e "x xx* x" $H >actual &&
test_cmp expected actual
ok 40 - grep -w in working tree (x)
expecting success:
{
echo ${HC}y:1:y yy
} >expected &&
git grep -n -w -e "^y" $H >actual &&
test_cmp expected actual
ok 41 - grep -w in working tree (y-1)
expecting success:
: >expected &&
if git grep -n -w -e "^y y" $H >actual
then
echo should not have matched
cat actual
false
else
test_cmp expected actual
fi
ok 42 - grep -w in working tree (y-2)
expecting success:
: >expected &&
if git grep -n -w -e "^z" $H >actual
then
echo should not have matched
cat actual
false
else
test_cmp expected actual
fi
ok 43 - grep -w in working tree (z)
expecting success:
echo "${HC}t/t:1:test" >expected &&
git grep -n -e test $H >actual &&
test_cmp expected actual
ok 44 - grep in working tree (t-1)
expecting success:
echo "${HC}t:1:test" >expected &&
(
cd t &&
git grep -n -e test $H
) >actual &&
test_cmp expected actual
ok 45 - grep in working tree (t-2)
expecting success:
echo "${HC}t/t:1:test" >expected &&
(
cd t &&
git grep --full-name -n -e test $H
) >actual &&
test_cmp expected actual
ok 46 - grep in working tree (t-3)
expecting success:
! git grep -c test $H | grep /dev/null
ok 47 - grep -c in working tree (no /dev/null)
expecting success:
{
echo ${HC}t/a/v:1:vvv
echo ${HC}t/v:1:vvv
echo ${HC}v:1:vvv
} >expected &&
git grep --max-depth -1 -n -e vvv $H >actual &&
test_cmp expected actual
ok 48 - grep --max-depth -1 in working tree
expecting success:
{
echo ${HC}v:1:vvv
} >expected &&
git grep --max-depth 0 -n -e vvv $H >actual &&
test_cmp expected actual
ok 49 - grep --max-depth 0 in working tree
expecting success:
{
echo ${HC}t/a/v:1:vvv
echo ${HC}t/v:1:vvv
echo ${HC}v:1:vvv
} >expected &&
git grep --max-depth 0 -n -e vvv $H -- "*" >actual &&
test_cmp expected actual
ok 50 - grep --max-depth 0 -- '*' in working tree
expecting success:
{
echo ${HC}t/v:1:vvv
echo ${HC}v:1:vvv
} >expected &&
git grep --max-depth 1 -n -e vvv $H >actual &&
test_cmp expected actual
ok 51 - grep --max-depth 1 in working tree
expecting success:
{
echo ${HC}t/v:1:vvv
} >expected &&
git grep --max-depth 0 -n -e vvv $H -- t >actual &&
test_cmp expected actual
ok 52 - grep --max-depth 0 -- t in working tree
expecting success:
{
echo ${HC}t/v:1:vvv
echo ${HC}v:1:vvv
} >expected &&
git grep --max-depth 0 -n -e vvv $H -- . t >actual &&
test_cmp expected actual
ok 53 - grep --max-depth 0 -- . t in working tree
expecting success:
{
echo ${HC}t/v:1:vvv
echo ${HC}v:1:vvv
} >expected &&
git grep --max-depth 0 -n -e vvv $H -- t . >actual &&
test_cmp expected actual
ok 54 - grep --max-depth 0 -- t . in working tree
expecting success:
echo "${HC}ab:a+bc" >expected &&
git -c grep.extendedRegexp=false grep "a+b*c" $H ab >actual &&
test_cmp expected actual
ok 55 - grep in working tree with grep.extendedRegexp=false
expecting success:
echo "${HC}ab:abc" >expected &&
git -c grep.extendedRegexp=true grep "a+b*c" $H ab >actual &&
test_cmp expected actual
ok 56 - grep in working tree with grep.extendedRegexp=true
expecting success:
echo "${HC}ab:a+bc" >expected &&
git -c grep.patterntype=basic grep "a+b*c" $H ab >actual &&
test_cmp expected actual
ok 57 - grep in working tree with grep.patterntype=basic
expecting success:
echo "${HC}ab:abc" >expected &&
git -c grep.patterntype=extended grep "a+b*c" $H ab >actual &&
test_cmp expected actual
ok 58 - grep in working tree with grep.patterntype=extended
expecting success:
echo "${HC}ab:a+b*c" >expected &&
git -c grep.patterntype=fixed grep "a+b*c" $H ab >actual &&
test_cmp expected actual
ok 59 - grep in working tree with grep.patterntype=fixed
expecting success:
echo "${HC}ab:a+b*c" >expected &&
git -c grep.patterntype=perl grep "a\x{2b}b\x{2a}c" $H ab >actual &&
test_cmp expected actual
ok 60 - grep in working tree with grep.patterntype=perl
expecting success:
echo "${HC}ab:abc" >expected &&
git \
-c grep.patternType=default \
-c grep.extendedRegexp=true \
grep "a+b*c" $H ab >actual &&
test_cmp expected actual
ok 61 - grep in working tree with grep.patternType=default and grep.extendedRegexp=true
expecting success:
echo "${HC}ab:abc" >expected &&
git \
-c grep.extendedRegexp=true \
-c grep.patternType=default \
grep "a+b*c" $H ab >actual &&
test_cmp expected actual
ok 62 - grep in working tree with grep.extendedRegexp=true and grep.patternType=default
expecting success:
echo "${HC}ab:abc" >expected &&
git \
-c grep.patternType=extended \
-c grep.extendedRegexp=false \
grep "a+b*c" $H ab >actual &&
test_cmp expected actual
ok 63 - grep in working tree with grep.patternType=extended and grep.extendedRegexp=false
expecting success:
echo "${HC}ab:a+bc" >expected &&
git \
-c grep.patternType=basic \
-c grep.extendedRegexp=true \
grep "a+b*c" $H ab >actual &&
test_cmp expected actual
ok 64 - grep in working tree with grep.patternType=basic and grep.extendedRegexp=true
expecting success:
echo "${HC}ab:abc" >expected &&
git \
-c grep.extendedRegexp=false \
-c grep.patternType=extended \
grep "a+b*c" $H ab >actual &&
test_cmp expected actual
ok 65 - grep in working tree with grep.extendedRegexp=false and grep.patternType=extended
expecting success:
echo "${HC}ab:a+bc" >expected &&
git \
-c grep.extendedRegexp=true \
-c grep.patternType=basic \
grep "a+b*c" $H ab >actual &&
test_cmp expected actual
ok 66 - grep in working tree with grep.extendedRegexp=true and grep.patternType=basic
expecting success:
echo ${HC}ab:3 >expected &&
git grep --count -e b $H -- ab >actual &&
test_cmp expected actual
ok 67 - grep --count in working tree
expecting success:
echo 3 >expected &&
git grep --count -h -e b $H -- ab >actual &&
test_cmp expected actual
ok 68 - grep --count -h in working tree
expecting success:
git grep -l -C1 foo >actual &&
test_cmp expected actual
ok 69 - grep -l -C
expecting success:
git grep -c -C1 foo >actual &&
test_cmp expected actual
ok 70 - grep -l -C
expecting success:
git ls-files >expected &&
git grep -L -C1 nonexistent_string >actual &&
test_cmp expected actual
ok 71 - grep -L -C
expecting success:
git grep -e "foo mmap" --and -e bar_mmap >actual &&
test_cmp expected actual
ok 72 - grep -e A --and -e B
expecting success:
git grep \( -e foo_ --or -e baz \) \
--and -e " mmap" >actual &&
test_cmp expected actual
ok 73 - grep ( -e A --or -e B ) --and -e B
expecting success:
git grep -e "foo mmap" --and --not -e bar_mmap >actual &&
test_cmp expected actual
ok 74 - grep -e A --and --not -e B
expecting success:
GREP_OPTIONS=-v git grep " mmap bar\$" >actual &&
test_cmp expected actual
ok 75 - grep should ignore GREP_OPTIONS
expecting success:
test_must_fail git grep -f patterns
fatal: cannot open 'patterns': No such file or directory
ok 76 - grep -f, non-existent file
expecting success:
git grep -f pattern >actual &&
test_cmp expected actual
ok 77 - grep -f, one pattern
expecting success:
git grep -f patterns >actual &&
test_cmp expected actual
ok 78 - grep -f, multiple patterns
expecting success:
git grep "$(cat patterns)" >actual &&
test_cmp expected actual
ok 79 - grep, multiple patterns
expecting success:
git grep -f patterns >actual &&
test_cmp expected actual
ok 80 - grep -f, ignore empty lines
expecting success:
git grep -f - <patterns >actual &&
test_cmp expected actual
ok 81 - grep -f, ignore empty lines, read patterns from stdin
expecting success:
>empty &&
git grep -q mmap >actual &&
test_cmp empty actual &&
test_must_fail git grep -q qfwfq >actual &&
test_cmp empty actual
ok 82 - grep -q, silently report matches
expecting success:
git grep -C1 "^[yz]" >actual &&
test_cmp expected actual
ok 83 - grep -C1 hunk mark between files
expecting success:
echo a >>file &&
test_tick &&
GIT_AUTHOR_NAME="With * Asterisk" \
GIT_AUTHOR_EMAIL="xyzzy@frotz.com" \
git commit -a -m "second" &&
echo a >>file &&
test_tick &&
git commit -a -m "third" &&
echo a >>file &&
test_tick &&
GIT_AUTHOR_NAME="Night Fall" \
GIT_AUTHOR_EMAIL="nitfol@frobozz.com" \
git commit -a -m "fourth"
[master b39ecf0] second
Author: With * Asterisk <xyzzy@frotz.com>
1 file changed, 1 insertion(+)
[master 8f9afb5] third
Author: A U Thor <author@example.com>
1 file changed, 1 insertion(+)
[master 2d5652e] fourth
Author: Night Fall <nitfol@frobozz.com>
1 file changed, 1 insertion(+)
ok 84 - log grep setup
expecting success:
git log --author=author --pretty=tformat:%s >actual &&
{
echo third && echo initial
} >expect &&
test_cmp expect actual
ok 85 - log grep (1)
expecting success:
git log --author=" * " -F --pretty=tformat:%s >actual &&
{
echo second
} >expect &&
test_cmp expect actual
ok 86 - log grep (2)
expecting success:
git log --author="^A U" --pretty=tformat:%s >actual &&
{
echo third && echo initial
} >expect &&
test_cmp expect actual
ok 87 - log grep (3)
expecting success:
git log --author="frotz\.com>$" --pretty=tformat:%s >actual &&
{
echo second
} >expect &&
test_cmp expect actual
ok 88 - log grep (4)
expecting success:
git log --author=Thor -F --pretty=tformat:%s >actual &&
{
echo third && echo initial
} >expect &&
test_cmp expect actual
ok 89 - log grep (5)
expecting success:
git log --author=-0700 --pretty=tformat:%s >actual &&
>expect &&
test_cmp expect actual
ok 90 - log grep (6)
expecting success:
git log -g --grep-reflog="commit: third" --pretty=tformat:%s >actual &&
echo third >expect &&
test_cmp expect actual
ok 91 - log grep (7)
expecting success:
git log -g --grep-reflog="commit: third" --grep-reflog="commit: second" --pretty=tformat:%s >actual &&
{
echo third && echo second
} >expect &&
test_cmp expect actual
ok 92 - log grep (8)
expecting success:
git log -g --grep-reflog="commit: third" --author="Thor" --pretty=tformat:%s >actual &&
echo third >expect &&
test_cmp expect actual
ok 93 - log grep (9)
expecting success:
git log -g --grep-reflog="commit: third" --author="non-existant" --pretty=tformat:%s >actual &&
: >expect &&
test_cmp expect actual
ok 94 - log grep (9)
expecting success:
test_must_fail git log --grep-reflog="commit: third"
fatal: cannot use --grep-reflog without --walk-reflogs
ok 95 - log --grep-reflog can only be used under -g
expecting success:
git log --grep=i --grep=r --format=%s >actual &&
{
echo fourth && echo third && echo initial
} >expect &&
test_cmp expect actual
ok 96 - log with multiple --grep uses union
expecting success:
git log --all-match --grep=i --grep=r --format=%s >actual &&
{
echo third
} >expect &&
test_cmp expect actual
ok 97 - log --all-match with multiple --grep uses intersection
expecting success:
git log --author="Thor" --author="Aster" --format=%s >actual &&
{
echo third && echo second && echo initial
} >expect &&
test_cmp expect actual
ok 98 - log with multiple --author uses union
expecting success:
git log --all-match --author="Thor" --author="Aster" --format=%s >actual &&
{
echo third && echo second && echo initial
} >expect &&
test_cmp expect actual
ok 99 - log --all-match with multiple --author still uses union
expecting success:
# grep matches only third and fourth
# author matches only initial and third
git log --author="A U Thor" --grep=r --format=%s >actual &&
{
echo third
} >expect &&
test_cmp expect actual
ok 100 - log --grep --author uses intersection
expecting success:
# grep matches initial and second but not third
# author matches only initial and third
git log --author="A U Thor" --grep=s --grep=l --format=%s >actual &&
{
echo initial
} >expect &&
test_cmp expect actual
ok 101 - log --grep --grep --author takes union of greps and intersects with author
expecting success:
# grep matches only initial and third
# author matches all but second
git log --all-match --author="Thor" --author="Night" --grep=i --format=%s >actual &&
{
echo third && echo initial
} >expect &&
test_cmp expect actual
ok 102 - log ---all-match -grep --author --author still takes union of authors and intersects with grep
expecting success:
# grep matches only initial and third
# author matches all but second
git log --author="Thor" --author="Night" --grep=i --format=%s >actual &&
{
echo third && echo initial
} >expect &&
test_cmp expect actual
ok 103 - log --grep --author --author takes union of authors and intersects with grep
expecting success:
# grep matches only third
# author matches only initial and third
git log --all-match --author="A U Thor" --grep=i --grep=r --format=%s >actual &&
{
echo third
} >expect &&
test_cmp expect actual
ok 104 - log --all-match --grep --grep --author takes intersection
expecting success:
: >expect &&
git log --author="$GIT_AUTHOR_DATE" >actual &&
test_cmp expect actual
ok 105 - log --author does not search in timestamp
expecting success:
: >expect &&
git log --committer="$GIT_COMMITTER_DATE" >actual &&
test_cmp expect actual
ok 106 - log --committer does not search in timestamp
expecting success:
git update-index --assume-unchanged t/t &&
rm t/t &&
test "$(git grep test)" = "t/t:test" &&
git update-index --no-assume-unchanged t/t &&
git checkout t/t
ok 107 - grep with CE_VALID file
expecting success:
git config diff.custom.funcname "^#" &&
echo "hello.c diff=custom" >.gitattributes &&
git grep -p return >actual &&
test_cmp expected actual
ok 108 - grep -p with userdiff
expecting success:
rm -f .gitattributes &&
git grep -p return >actual &&
test_cmp expected actual
ok 109 - grep -p
expecting success:
git grep -p -B5 return >actual &&
test_cmp expected actual
ok 110 - grep -p -B5
expecting success:
git grep -W return >actual &&
test_cmp expected actual
ok 111 - grep -W
expecting success:
test_when_finished "rm -f .gitattributes" &&
git config diff.custom.xfuncname "(printf.*|})$" &&
echo "hello.c diff=custom" >.gitattributes &&
git grep -W return >actual &&
test_cmp expected actual
ok 112 - grep -W with userdiff
expecting success:
mkdir -p s &&
(
cd s && git grep "x x x" ..
)
../x:x x xx x
ok 113 - grep from a subdirectory to search wider area (1)
expecting success:
mkdir -p s &&
(
cd s || exit 1
( git grep xxyyzz .. >out ; echo $? >status )
! test -s out &&
test 1 = $(cat status)
)
ok 114 - grep from a subdirectory to search wider area (2)
expecting success:
git grep -Fi "CHAR *" >actual &&
test_cmp expected actual
ok 115 - grep -Fi
expecting success:
rm -fr non &&
mkdir -p non/git/sub &&
echo hello >non/git/file1 &&
echo world >non/git/sub/file2 &&
{
echo file1:hello &&
echo sub/file2:world
} >non/expect.full &&
echo file2:world >non/expect.sub &&
(
GIT_CEILING_DIRECTORIES="$(pwd)/non/git" &&
export GIT_CEILING_DIRECTORIES &&
cd non/git &&
test_must_fail git grep o &&
git grep --no-index o >../actual.full &&
test_cmp ../expect.full ../actual.full
cd sub &&
test_must_fail git grep o &&
git grep --no-index o >../../actual.sub &&
test_cmp ../../expect.sub ../../actual.sub
) &&
echo ".*o*" >non/git/.gitignore &&
(
GIT_CEILING_DIRECTORIES="$(pwd)/non/git" &&
export GIT_CEILING_DIRECTORIES &&
cd non/git &&
test_must_fail git grep o &&
git grep --no-index --exclude-standard o >../actual.full &&
test_cmp ../expect.full ../actual.full &&
{
echo ".gitignore:.*o*"
cat ../expect.full
} >../expect.with.ignored &&
git grep --no-index --no-exclude o >../actual.full &&
test_cmp ../expect.with.ignored ../actual.full
)
fatal: Not a git repository (or any of the parent directories): .git
ok 116 - outside of git repository
expecting success:
rm -fr is &&
mkdir -p is/git/sub &&
echo hello >is/git/file1 &&
echo world >is/git/sub/file2 &&
echo ".*o*" >is/git/.gitignore &&
{
echo file1:hello &&
echo sub/file2:world
} >is/expect.unignored &&
{
echo ".gitignore:.*o*" &&
cat is/expect.unignored
} >is/expect.full &&
: >is/expect.empty &&
echo file2:world >is/expect.sub &&
(
cd is/git &&
git init &&
test_must_fail git grep o >../actual.full &&
test_cmp ../expect.empty ../actual.full &&
git grep --untracked o >../actual.unignored &&
test_cmp ../expect.unignored ../actual.unignored &&
git grep --no-index o >../actual.full &&
test_cmp ../expect.full ../actual.full &&
git grep --no-index --exclude-standard o >../actual.unignored &&
test_cmp ../expect.unignored ../actual.unignored &&
cd sub &&
test_must_fail git grep o >../../actual.sub &&
test_cmp ../../expect.empty ../../actual.sub &&
git grep --no-index o >../../actual.sub &&
test_cmp ../../expect.sub ../../actual.sub &&
git grep --untracked o >../../actual.sub &&
test_cmp ../../expect.sub ../../actual.sub
)
Initialized empty Git repository in /usr/src/dev-vcs/git-2.7.3-r1/work/git-2.7.3/t/trash directory.t7810-grep/is/git/.git/
ok 117 - inside git repository but with --no-index
expecting success:
cat >double-dash <<EOF &&
--
->
other
EOF
git add double-dash
ok 118 - setup double-dash tests
expecting success:
git grep -- "->" >actual &&
test_cmp expected actual
ok 119 - grep -- pattern
expecting success:
git grep -- "->" -- double-dash >actual &&
test_cmp expected actual
ok 120 - grep -- pattern -- pathspec
expecting success:
git grep -e "->" -- double-dash >actual &&
test_cmp expected actual
ok 121 - grep -e pattern -- path
expecting success:
git grep -e -- -- double-dash >actual &&
test_cmp expected actual
ok 122 - grep -e -- -- path
expecting success:
git grep --perl-regexp "\p{Ps}.*?\p{Pe}" hello.c >actual &&
test_cmp expected actual
ok 123 - grep --perl-regexp pattern
expecting success:
git grep -P "\p{Ps}.*?\p{Pe}" hello.c >actual &&
test_cmp expected actual
ok 124 - grep -P pattern
expecting success:
>empty &&
test_must_fail git -c grep.extendedregexp=true \
grep "\p{Ps}.*?\p{Pe}" hello.c >actual &&
test_cmp empty actual
fatal: command line, '\p{Ps}.*?\p{Pe}': Invalid contents of {}
ok 125 - grep pattern with grep.extendedRegexp=true
expecting success:
git -c grep.extendedregexp=true \
grep -P "\p{Ps}.*?\p{Pe}" hello.c >actual &&
test_cmp expected actual
ok 126 - grep -P pattern with grep.extendedRegexp=true
expecting success:
{
echo "ab:a+b*c"
echo "ab:a+bc"
} >expected &&
git grep -P -v "abc" ab >actual &&
test_cmp expected actual
ok 127 - grep -P -v pattern
expecting success:
cat >expected <<-EOF &&
hello.c: printf("Hello world.\n");
EOF
git grep -P -i "PRINTF\([^\d]+\)" hello.c >actual &&
test_cmp expected actual
ok 128 - grep -P -i pattern
expecting success:
{
echo "hello_world:Hello world"
echo "hello_world:HeLLo world"
} >expected &&
git grep -P -w "He((?i)ll)o" hello_world >actual &&
test_cmp expected actual
ok 129 - grep -P -w pattern
expecting success:
test_must_fail git grep -G "a["
fatal: command line, 'a[': Missing ']'
ok 130 - grep -G invalidpattern properly dies
expecting success:
test_must_fail git -c grep.patterntype=basic grep "a["
fatal: command line, 'a[': Missing ']'
ok 131 - grep invalidpattern properly dies with grep.patternType=basic
expecting success:
test_must_fail git grep -E "a["
fatal: command line, 'a[': Missing ']'
ok 132 - grep -E invalidpattern properly dies
expecting success:
test_must_fail git -c grep.patterntype=extended grep "a["
fatal: command line, 'a[': Missing ']'
ok 133 - grep invalidpattern properly dies with grep.patternType=extended
expecting success:
test_must_fail git grep -P "a["
fatal: command line, 'a[': missing terminating ] for character class
ok 134 - grep -P invalidpattern properly dies
expecting success:
test_must_fail git -c grep.patterntype=perl grep "a["
fatal: command line, 'a[': missing terminating ] for character class
ok 135 - grep invalidpattern properly dies with grep.patternType=perl
expecting success:
echo "ab:a+b*c" >expected &&
git grep -G -E -F "a+b*c" ab >actual &&
test_cmp expected actual
ok 136 - grep -G -E -F pattern
expecting success:
echo "ab:a+b*c" >expected &&
git \
-c grep.patterntype=basic \
-c grep.patterntype=extended \
-c grep.patterntype=fixed \
grep "a+b*c" ab >actual &&
test_cmp expected actual
ok 137 - grep pattern with grep.patternType=basic, =extended, =fixed
expecting success:
echo "ab:a+bc" >expected &&
git grep -E -F -G "a+b*c" ab >actual &&
test_cmp expected actual
ok 138 - grep -E -F -G pattern
expecting success:
echo "ab:a+bc" >expected &&
git \
-c grep.patterntype=extended \
-c grep.patterntype=fixed \
-c grep.patterntype=basic \
grep "a+b*c" ab >actual &&
test_cmp expected actual
ok 139 - grep pattern with grep.patternType=extended, =fixed, =basic
expecting success:
echo "ab:abc" >expected &&
git grep -F -G -E "a+b*c" ab >actual &&
test_cmp expected actual
ok 140 - grep -F -G -E pattern
expecting success:
echo "ab:abc" >expected &&
git \
-c grep.patterntype=fixed \
-c grep.patterntype=basic \
-c grep.patterntype=extended \
grep "a+b*c" ab >actual &&
test_cmp expected actual
ok 141 - grep pattern with grep.patternType=fixed, =basic, =extended
expecting success:
>empty &&
test_must_fail git grep -G -F -P -E "a\x{2b}b\x{2a}c" ab >actual &&
test_cmp empty actual
test_must_fail: command succeeded: git grep -G -F -P -E a\x{2b}b\x{2a}c ab
not ok 142 - grep -G -F -P -E pattern
#
# >empty &&
# test_must_fail git grep -G -F -P -E "a\x{2b}b\x{2a}c" ab >actual &&
# test_cmp empty actual
#
elaine t # elaine t # cd trash\ directory.t7810-grep/
elaine trash directory.t7810-grep # git grep -G -F -P -E a\x{2b}b\x{2a}c ab >actual
fatal: command line, 'ax{2b}bx{2a}c': Invalid contents of {}
elaine trash directory.t7810-grep # echo $?
128
elaine trash directory.t7810-grep # cat actual
elaine trash directory.t7810-grep # rm actual
elaine trash directory.t7810-grep #
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Test failures when Git is built with libpcre and grep is built without it
2017-01-09 10:51 ` A. Wilcox
@ 2017-01-09 11:27 ` Jeff King
2017-01-09 13:05 ` Andreas Schwab
1 sibling, 0 replies; 12+ messages in thread
From: Jeff King @ 2017-01-09 11:27 UTC (permalink / raw)
To: A. Wilcox; +Cc: git
On Mon, Jan 09, 2017 at 04:51:22AM -0600, A. Wilcox wrote:
> Interestingly enough, you seem to be right. The failure is very
> bizarre and has nothing to do with system /bin/grep:
>
> test_must_fail: command succeeded: git grep -G -F -P -E a\x{2b}b\x{2a}c ab
> not ok 142 - grep -G -F -P -E pattern
> #
> # >empty &&
> # test_must_fail git grep -G -F -P -E "a\x{2b}b\x{2a}c"
> ab >actual &&
> # test_cmp empty actual
> #
>
> However:
>
> elaine trash directory.t7810-grep # git grep -G -F -P -E
> a\x{2b}b\x{2a}c ab >actual
> fatal: command line, 'ax{2b}bx{2a}c': Invalid contents of {}
Hrm, it looks like your shell eats the backslashes in a double-quoted
string.
What does:
printf '%s\n' "a\x{2b}b\x{2a}c"
show?
I'm not sure if that's related or not. And as you said your shell is
bash, that seems weird. Lots of other people run bash, and we haven't
gotten a report (and your version isn't bleeding edge).
That said, the "invalid contents" error message is expected. What's
confusing is that the command returned success. The error comes from
compile_regexp(), which sees that regcomp() failed. It calls
compile_regexp_failed(), which calls die(), which should end in
exit(128). But the shell sees the exit code as 0. Weird.
Your example run after shows that the correct exit code comes out of
git. What does:
./t7810-grep.sh -x --verbose-only=142
say? That should enable "set -x" in the shell just for that test.
-Peff
PS In my repo, the test that is failing for you is actually 145. Are you
trying with a version of git older than v2.7.x? If so, you might
double-check that the problem persists on the latest "master". I
don't know of any particular fixes, but it's worth a shot.
-Peff
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Test failures when Git is built with libpcre and grep is built without it
2017-01-09 10:51 ` A. Wilcox
2017-01-09 11:27 ` Jeff King
@ 2017-01-09 13:05 ` Andreas Schwab
2017-01-09 21:33 ` Jeff King
1 sibling, 1 reply; 12+ messages in thread
From: Andreas Schwab @ 2017-01-09 13:05 UTC (permalink / raw)
To: A. Wilcox; +Cc: Jeff King, git
On Jan 09 2017, "A. Wilcox" <awilfox@adelielinux.org> wrote:
> Interestingly enough, you seem to be right. The failure is very
> bizarre and has nothing to do with system /bin/grep:
>
> test_must_fail: command succeeded: git grep -G -F -P -E a\x{2b}b\x{2a}c ab
> not ok 142 - grep -G -F -P -E pattern
> #
> # >empty &&
> # test_must_fail git grep -G -F -P -E "a\x{2b}b\x{2a}c"
> ab >actual &&
> # test_cmp empty actual
> #
>
> However:
>
> elaine trash directory.t7810-grep # git grep -G -F -P -E
> a\x{2b}b\x{2a}c ab >actual
You need to quote the regexp argument, see the line starting with
"test_must_fail" above.
Andreas.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Test failures when Git is built with libpcre and grep is built without it
2017-01-09 13:05 ` Andreas Schwab
@ 2017-01-09 21:33 ` Jeff King
2017-01-10 10:36 ` A. Wilcox
0 siblings, 1 reply; 12+ messages in thread
From: Jeff King @ 2017-01-09 21:33 UTC (permalink / raw)
To: Andreas Schwab; +Cc: A. Wilcox, git
On Mon, Jan 09, 2017 at 02:05:44PM +0100, Andreas Schwab wrote:
> On Jan 09 2017, "A. Wilcox" <awilfox@adelielinux.org> wrote:
>
> > Interestingly enough, you seem to be right. The failure is very
> > bizarre and has nothing to do with system /bin/grep:
> >
> > test_must_fail: command succeeded: git grep -G -F -P -E a\x{2b}b\x{2a}c ab
> > not ok 142 - grep -G -F -P -E pattern
> > #
> > # >empty &&
> > # test_must_fail git grep -G -F -P -E "a\x{2b}b\x{2a}c"
> > ab >actual &&
> > # test_cmp empty actual
> > #
> >
> > However:
> >
> > elaine trash directory.t7810-grep # git grep -G -F -P -E
> > a\x{2b}b\x{2a}c ab >actual
>
> You need to quote the regexp argument, see the line starting with
> "test_must_fail" above.
Oh, duh. I checked that the line in the test was quoted, and didn't
notice that only the unquoted version he ran later complained. Thanks
for noticing, as that explains the mystery, I think.
The problem is that we are expecting the regex "\x{2b}" to complain in
regcomp() (as an ERE), but it doesn't. And that probably _is_ related to
musl, which is providing the libc regex (I know this looks like a pcre
test, but it's checking that "-P -E" overrides the pcre option with
"-E").
I'm not sure if musl is wrong for failing to complain about a bogus
regex. Generally making something that would break into something that
works is an OK way to extend the standard. So our test is at fault for
assuming that the regex will fail. I guess we'd need to find some more
exotic syntax that pcre supports, but that ERE doesn't. Maybe "(?:)" or
something.
-Peff
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Test failures when Git is built with libpcre and grep is built without it
2017-01-09 21:33 ` Jeff King
@ 2017-01-10 10:36 ` A. Wilcox
2017-01-10 11:40 ` [musl] " Szabolcs Nagy
0 siblings, 1 reply; 12+ messages in thread
From: A. Wilcox @ 2017-01-10 10:36 UTC (permalink / raw)
To: Jeff King, Andreas Schwab; +Cc: git, musl
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
(Hi, musl developers! Read on for some information regarding what
began as a test failure during packaging of Git 2.7.3 that appears to
be related to musl's regexp library.)
On 09/01/17 05:27, Jeff King wrote:
> Are you trying with a version of git older than v2.7.x?
We are using 2.7.3. I will admit the version is a bit old, but it is
working on all other arches (and it took an inordinate amount of time
to spin up PowerPC - hooray for toolchain issues).
On 09/01/17 15:33, Jeff King wrote:
> On Mon, Jan 09, 2017 at 02:05:44PM +0100, Andreas Schwab wrote:
>> You need to quote the regexp argument, see the line starting
>> with "test_must_fail" above.
>
> Oh, duh. I checked that the line in the test was quoted
Guilty of this as well. Sorry about that. With the proper
invocation, I receive a success:
elaine trash directory.t7810-grep # git grep -G -F -P -E
"a\x{2b}b\x{2a}c" ab
error: cannot run less: No such file or directory
ab:a+b*c
elaine trash directory.t7810-grep # echo $?
0
Haven't managed to build less(1) for PowerPC yet, but it does seem to
work when quoted. Yikes!
> The problem is that we are expecting the regex "\x{2b}" to complain
> in regcomp() (as an ERE), but it doesn't. And that probably _is_
> related to musl, which is providing the libc regex (I know this
> looks like a pcre test, but it's checking that "-P -E" overrides
> the pcre option with "-E").
>
> I'm not sure if musl is wrong for failing to complain about a
> bogus regex. Generally making something that would break into
> something that works is an OK way to extend the standard. So our
> test is at fault for assuming that the regex will fail. I guess
> we'd need to find some more exotic syntax that pcre supports, but
> that ERE doesn't. Maybe "(?:)" or something.
>
> -Peff
>
I am cc:ing in the musl development list to see what their thoughts are.
Thanks for the help so far; I really appreciate it. Hopefully we can
resolve this in a way that makes musl and Git's test suite both more
correct, if necessary.
Happy new year!
- --arw
- --
A. Wilcox (awilfox)
Project Lead, Adélie Linux
http://adelielinux.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2
iQIcBAEBCAAGBQJYdLk+AAoJEMspy1GSK50Uz9kP/2JUSzSSXkKLy3788aAjgBOq
aTPBqKXLCvnTeBpsymXoGueaJzgDnYP6Xi9tUb/j4JAXqaJKGHXTgz8ixsFQJ4SJ
p7NN1JZXsIVGKWQHcxvEXEIRmBK7T9BQ2Hq6qUuk3n4PM6lbD1Ur3G1rUqIM/z76
5cSkvwgvGuOVYXLwSTTprb6EbbZc6WTgcDECFIl4z7eJ3GihChg+EgH4cTDt3xLD
9VHx++hWoEZXued0g0myENjBMeCiFOpYw1bzxn7d2s8masx/If2TkK0CLdexy2ti
hFV/F7g8etgZSdmrmiaJIudTsY6p46/sm/VmGm+8yPIeR8/8EOBlyhKhz4EidNtA
2dpUUJW/RD4uz9yVNjmWhIHaL10weuNLQLd/Tt5O/0dG422vhJxOwwJL9Vhxw70y
1PprD11+ZUJeWsz91C/Bl9CqHqljDP00QX8w/dbHCDsjeKgfUdksy2iKlHBG0sx3
CbL0EcHeE9BLmqmJi9ED7w78cTmNryemK29WFHUGSwzR99Rv9QlMn+4GCF1s0O3N
UKPCueLpPcNvRK+1WHkAwUC0iV97Un3WI6kyExs9khygIHRd1y/yRhbpxibbz337
FJfOTcT7e/YqML8Nb8EdwECRhdGX5u1tKqaOfBwLC62SKGTPi5qXpjaSPPJcJsrZ
phxFt6a45PPECV3ZsEO1
=PMkh
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [musl] Re: Test failures when Git is built with libpcre and grep is built without it
2017-01-10 10:36 ` A. Wilcox
@ 2017-01-10 11:40 ` Szabolcs Nagy
2017-01-11 10:04 ` Jeff King
0 siblings, 1 reply; 12+ messages in thread
From: Szabolcs Nagy @ 2017-01-10 11:40 UTC (permalink / raw)
To: musl; +Cc: Jeff King, Andreas Schwab, git, A. Wilcox
* A. Wilcox <awilfox@adelielinux.org> [2017-01-10 04:36:50 -0600]:
> On 09/01/17 15:33, Jeff King wrote:
> > The problem is that we are expecting the regex "\x{2b}" to complain
> > in regcomp() (as an ERE), but it doesn't. And that probably _is_
> > related to musl, which is providing the libc regex (I know this
> > looks like a pcre test, but it's checking that "-P -E" overrides
> > the pcre option with "-E").
> >
> > I'm not sure if musl is wrong for failing to complain about a
> > bogus regex. Generally making something that would break into
> > something that works is an OK way to extend the standard. So our
> > test is at fault for assuming that the regex will fail. I guess
\x is undefined in posix and musl is based on tre which
supports \x{hexdigits} in ere.
(i think some bsd platforms use tre as libc regex so
i'm surprised musl is the first to run into this.)
> > we'd need to find some more exotic syntax that pcre supports, but
> > that ERE doesn't. Maybe "(?:)" or something.
i think you would have to use something that's invalid
in posix ere, ? after empty expression is undefined,
not an error so "(?:)" is a valid ere extension.
since most syntax is either defined or undefined in ere
instead of being invalid, distinguishing pcre using
syntax is not easy.
there are semantic differences in subexpression matching:
leftmost match has higher priority in pcre, longest match
has higher priority in ere.
$ echo ab | grep -o -E '(a|ab)'
ab
$ echo ab | grep -o -P '(a|ab)'
a
unfortunately grep -o is not portable.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [musl] Re: Test failures when Git is built with libpcre and grep is built without it
2017-01-10 11:40 ` [musl] " Szabolcs Nagy
@ 2017-01-11 10:04 ` Jeff King
2017-01-11 11:10 ` [PATCH] t7810: avoid assumption about invalid regex syntax Jeff King
2017-01-11 20:49 ` [musl] Re: Test failures when Git is built with libpcre and grep is built without it Junio C Hamano
0 siblings, 2 replies; 12+ messages in thread
From: Jeff King @ 2017-01-11 10:04 UTC (permalink / raw)
To: git; +Cc: musl, Andreas Schwab, A. Wilcox
On Tue, Jan 10, 2017 at 12:40:00PM +0100, Szabolcs Nagy wrote:
> > > I'm not sure if musl is wrong for failing to complain about a
> > > bogus regex. Generally making something that would break into
> > > something that works is an OK way to extend the standard. So our
> > > test is at fault for assuming that the regex will fail. I guess
>
> \x is undefined in posix and musl is based on tre which
> supports \x{hexdigits} in ere.
Thanks for confirming; I figured it was something like that.
> > > we'd need to find some more exotic syntax that pcre supports, but
> > > that ERE doesn't. Maybe "(?:)" or something.
>
> i think you would have to use something that's invalid
> in posix ere, ? after empty expression is undefined,
> not an error so "(?:)" is a valid ere extension.
Reading through POSIX[1], hardly anything is explicitly labeled as
"invalid". Most things are just "undefined", which leaves rooms for
implementations to do what they like.
That's a good thing for a standard to do, but a bad thing when you are
trying to find behavior that differs reliably between PCRE and ERE. :)
In most cases, PCRE constructs could be viable extensions to ERE.
> since most syntax is either defined or undefined in ere
> instead of being invalid, distinguishing pcre using
> syntax is not easy.
>
> there are semantic differences in subexpression matching:
> leftmost match has higher priority in pcre, longest match
> has higher priority in ere.
>
> $ echo ab | grep -o -E '(a|ab)'
> ab
> $ echo ab | grep -o -P '(a|ab)'
> a
>
> unfortunately grep -o is not portable.
In this case we're testing whether Git has internally fed the regex to
pcre or to regcomp(), not a system grep. So we'd need something like
"-o" for "git grep", which I don't think exists.
Another difference I found is that "[\d]" matches a literal "\" or "d"
in ERE, but behaves like "[0-9]" in PCRE. I'll work up a patch based on
that.
Thanks for your answer. I'll drop the musl list from the cc when I
follow-up, as this is most definitely not a musl problem, but a git one.
-Peff
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH] t7810: avoid assumption about invalid regex syntax
2017-01-11 10:04 ` Jeff King
@ 2017-01-11 11:10 ` Jeff King
2017-01-11 20:49 ` [musl] Re: Test failures when Git is built with libpcre and grep is built without it Junio C Hamano
1 sibling, 0 replies; 12+ messages in thread
From: Jeff King @ 2017-01-11 11:10 UTC (permalink / raw)
To: A. Wilcox; +Cc: git, Andreas Schwab
A few of the tests want to check that "git grep -P -E" will
override -P with -E, and vice versa. To do so, we use a
regex with "\x{..}", which is valid in PCRE but not defined
by POSIX (for basic or extended regular expressions).
However, POSIX declares quite a lot of syntax, including
"\x", as "undefined". That leaves implementations free to
extend the standard if they choose. At least one, musl libc,
implements "\x" in the same way as PCRE. Our tests check
that "-E" complains about "\x", which fails with musl.
We can fix this by finding some construct which behaves
reliably on both PCRE and POSIX, but differently in each
system.
One such construct is the use of backslash inside brackets.
In PCRE, "[\d]" interprets "\d" as it would outside the
brackets, matching a digit. Whereas in POSIX, the backslash
must be treated literally, and we match either it or a
literal "d". Moreover, implementations are not free to
change this according to POSIX, so we should be able to rely
on it.
Signed-off-by: Jeff King <peff@peff.net>
---
I've tested this with glibc, but I wasn't able to do so with musl. The
two complications are:
1. Recent versions of git won't build with musl's regex at all,
because it doesn't support the non-standard REG_STARTEND that we
rely on since b7d36ffca (regex: use regexec_buf(), 2016-09-21).
So if applied on an older git, this patch should help, but newer
versions need NO_REGEX (to use the fallback glibc regex code)
either way, which would also make the problem go away.
Still, I think it's the right thing to do, since we are relying on
something that POSIX clearly leaves up to the implementation. It
may also help on other systems, or if musl ends up supporting
REG_STARTEND in the future.
2. I tried to cherry-pick to v2.7.x and test it with musl. Debian
ships with a "musl-gcc" wrapper, but it doesn't work out of the
box. Both zlib and pcre are compiled against glibc, so I'd have to
rebuild those, too. At which point I gave up and decided to just
let you test it on your musl-based system. :)
t/t7810-grep.sh | 26 +++++++++++++++-----------
1 file changed, 15 insertions(+), 11 deletions(-)
diff --git a/t/t7810-grep.sh b/t/t7810-grep.sh
index de2405ccb..19f0108f8 100755
--- a/t/t7810-grep.sh
+++ b/t/t7810-grep.sh
@@ -39,6 +39,10 @@ test_expect_success setup '
echo "a+bc"
echo "abc"
} >ab &&
+ {
+ echo d &&
+ echo 0
+ } >d0 &&
echo vvv >v &&
echo ww w >w &&
echo x x xx x >x &&
@@ -1105,36 +1109,36 @@ test_expect_success 'grep pattern with grep.patternType=fixed, =basic, =extended
'
test_expect_success 'grep -G -F -P -E pattern' '
- >empty &&
- test_must_fail git grep -G -F -P -E "a\x{2b}b\x{2a}c" ab >actual &&
- test_cmp empty actual
+ echo "d0:d" >expected &&
+ git grep -G -F -P -E "[\d]" d0 >actual &&
+ test_cmp expected actual
'
test_expect_success 'grep pattern with grep.patternType=fixed, =basic, =perl, =extended' '
- >empty &&
- test_must_fail git \
+ echo "d0:d" >expected &&
+ git \
-c grep.patterntype=fixed \
-c grep.patterntype=basic \
-c grep.patterntype=perl \
-c grep.patterntype=extended \
- grep "a\x{2b}b\x{2a}c" ab >actual &&
- test_cmp empty actual
+ grep "[\d]" d0 >actual &&
+ test_cmp expected actual
'
test_expect_success LIBPCRE 'grep -G -F -E -P pattern' '
- echo "ab:a+b*c" >expected &&
- git grep -G -F -E -P "a\x{2b}b\x{2a}c" ab >actual &&
+ echo "d0:0" >expected &&
+ git grep -G -F -E -P "[\d]" d0 >actual &&
test_cmp expected actual
'
test_expect_success LIBPCRE 'grep pattern with grep.patternType=fixed, =basic, =extended, =perl' '
- echo "ab:a+b*c" >expected &&
+ echo "d0:0" >expected &&
git \
-c grep.patterntype=fixed \
-c grep.patterntype=basic \
-c grep.patterntype=extended \
-c grep.patterntype=perl \
- grep "a\x{2b}b\x{2a}c" ab >actual &&
+ grep "[\d]" d0 >actual &&
test_cmp expected actual
'
--
2.11.0.627.gfa6151259
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [musl] Re: Test failures when Git is built with libpcre and grep is built without it
2017-01-11 10:04 ` Jeff King
2017-01-11 11:10 ` [PATCH] t7810: avoid assumption about invalid regex syntax Jeff King
@ 2017-01-11 20:49 ` Junio C Hamano
1 sibling, 0 replies; 12+ messages in thread
From: Junio C Hamano @ 2017-01-11 20:49 UTC (permalink / raw)
To: Jeff King; +Cc: git, Andreas Schwab, A. Wilcox
Jeff King <peff@peff.net> writes:
> Another difference I found is that "[\d]" matches a literal "\" or "d"
> in ERE, but behaves like "[0-9]" in PCRE. I'll work up a patch based on
> that.
Wow, clever.
Thanks.
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2017-01-11 20:53 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-01 4:59 Test failures when Git is built with libpcre and grep is built without it A. Wilcox
2017-01-01 10:19 ` Torsten Bögershausen
2017-01-02 6:53 ` Jeff King
2017-01-09 10:51 ` A. Wilcox
2017-01-09 11:27 ` Jeff King
2017-01-09 13:05 ` Andreas Schwab
2017-01-09 21:33 ` Jeff King
2017-01-10 10:36 ` A. Wilcox
2017-01-10 11:40 ` [musl] " Szabolcs Nagy
2017-01-11 10:04 ` Jeff King
2017-01-11 11:10 ` [PATCH] t7810: avoid assumption about invalid regex syntax Jeff King
2017-01-11 20:49 ` [musl] Re: Test failures when Git is built with libpcre and grep is built without it Junio C Hamano
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).