VirtualBox

source: kBuild/trunk/src/grep/tests/backref-alt

Last change on this file was 3529, checked in by bird, 3 years ago

Imported grep 3.7 from grep-3.7.tar.gz (sha256: c22b0cf2d4f6bbe599c902387e8058990e1eee99aef333a203829e5fd3dbb342), applying minimal auto-props.

  • Property svn:executable set to *
File size: 1.0 KB
Line 
1#! /bin/sh
2# Test for a bug in glibc's regex code as of 2015-09-19.
3#
4# Copyright 2015-2021 Free Software Foundation, Inc.
5#
6# Copying and distribution of this file, with or without modification,
7# are permitted in any medium without royalty provided the copyright
8# notice and this notice are preserved.
9
10. "${srcdir=.}/init.sh"; path_prepend_ ../src
11
12echo aa > in || framework_failure_
13
14fail=0
15
16grep -E 'b|(.)b|\1|b' in >out
17status=$?
18# POSIX isn't clear whether this regular expression should be invalid,
19# (because the \1 is out of range for REs that could precede it)
20# or valid but \1 should not match. Allow either interpretation.
21test $status -eq 2 || test $status -eq 1 || fail=1
22
23grep -E '0|()0|\1|0' in >out
24status=$?
25test $status -eq 2 || test $status -eq 1 || fail=1
26
27# This test is a reduced version of the one in Bug#27838.
28# It triggers this glibc assertion failure:
29# grep: regexec.c:1342: pop_fail_stack: Assertion `num >= 0' failed.
30LC_ALL=C grep -E '(()x)|\2' in > out
31status=$?
32test $status -eq 2 || test $status -eq 1 || fail=1
33
34Exit $fail
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette