Control: -1 -2
Control: retitle -1 grep: inconsistent behaviour with anchored regex containing 
back-references
Control: severity -1 normal
Control: found -2 3.4-1
Control: notfound -2 2.27-2

On Fri, 02 Dec 2022 02:12:20 +0100 Thorsten Glaser <t...@mirbsd.de> wrote:
> Package: grep
> Version: 3.6-1
> Followup-For: Bug #930247
> X-Debbugs-Cc: t...@mirbsd.de
> Control: found 930247 3.8-3
> Control: severity 930247 serious
> Control: retitle 930247 grep: does not handle backreferences correctly, 
> violating POSIX
> 
> I’m running into this, in stable and unstable both:
> 
> (sid-amd64)tglase@tglase:/tmp $ cat x
> Total failed: 0
> Total failed: 1 (1 ignored)
> Total failed: 2 (1 ignored)
> Total failed: 1 (2 ignored)
> Total failed: 1
> Total failed: 111
> (sid-amd64)tglase@tglase:/tmp $ grep -e '^Total failed: 0$' -e '^Total 
> failed: \([0-9]*\) (\1 ignored)$' x
> Total failed: 0
> Total failed: 1 (1 ignored)
> Total failed: 2 (1 ignored)
> Total failed: 1 (2 ignored)
> 
> By contrast, BSD handles it correctly:
> 
> tg@tglase-bsd:/tmp $ grep -e '^Total failed: 0$' -e '^Total failed: 
> \([0-9]*\) (\1 ignored)$' x
> Total failed: 0
> Total failed: 1 (1 ignored)
> 
> POSIX:
> 
>     3. The back-reference expression '\n' shall match the same (possibly
>        empty) string of characters as was matched by a subexpression
>        enclosed between "\(" and "\)" preceding the '\n'. The character
> 
> via 
> https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap09.html#tag_09_03
> from https://pubs.opengroup.org/onlinepubs/9699919799/utilities/grep.html
> 
> Please fix this clear standards violation; it makes grep
> virtually unusable.
> 
> 
> 
> -- System Information:
> Debian Release: 11.5
>   APT prefers stable-updates
>   APT policy: (500, 'stable-updates'), (500, 'stable-security'), (500, 
> 'stable')
> Architecture: amd64 (x86_64)
> 
> Kernel: Linux 5.10.0-19-amd64 (SMP w/2 CPU threads)
> Locale: LANG=C, LC_CTYPE=C (charmap=UTF-8) (ignored: LC_ALL set to C.UTF-8), 
> LANGUAGE not set
> Shell: /bin/sh linked to /bin/lksh
> Init: sysvinit (via /sbin/init)
> 
> Versions of packages grep depends on:
> ii  dpkg          1.20.12
> ii  install-info  6.7.0.dfsg.2-6
> ii  libc6         2.31-13+deb11u5
> ii  libpcre3      2:8.39-13
> 

Attachment: signature.asc
Description: PGP signature

Reply via email to