delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2024/03/16/14:02:16

X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C538A3858421
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1710612134;
bh=DN/X9iGqqR2wR+ReLF0XWWvWzgVixTNgVsRlCVQ5qUI=;
h=Date:Subject:To:List-Id:List-Unsubscribe:List-Archive:List-Post:
List-Help:List-Subscribe:From:Reply-To:From;
b=KD5lIHWvlb9A/GMQ7+uOe1Q0PQfxeoMFlrvjfqtgvlLpDLoaplBQyJ0JjIfOuPUz+
cFts9X0NQWApgvn7FIBz9gqnHSHv1MAy2bKdWR6Z9gpxbat6BaakcICW6yk8PcNQfD
jlBOuxvsZ3wGScW307HIBeNYUtsjeW+pLur7yS4c=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 565EF3858D38
ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 565EF3858D38
ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1710612080; cv=none;
b=i+VBwD2bOXAqGelimdU//C2jYqs20STvMCYLmF6/kNSvFL17vmiZkkdE4yP2SjRR777IUH/mnkpHuKrsKDED99K5qofbx0cld/v07if3bcVupeT5u+STeOjKLHgEnZPXZ/r47lp+2NUtfgdZWH5XMny2tx4Al4+5jZra8fo+iao=
ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key;
t=1710612080; c=relaxed/simple;
bh=18qKFBW13QO+HA2qxKSFRL6uQuak9cggEmHo83EMx0s=;
h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To;
b=wgBBpfD9hLgG7BEYfkYemb/aJtb60vV36Nq+YYty/ZmiGtFdqJUYy5GXsC52wHNByHF5BR3bSqzasouoGveFzck6m+/VJsRTJ6b1KAbwEvU3DgIBFS5KlYyHdA6/1TwY3VuEmnuRct+aDHGxdoGMBepVhYQK06EEm/0DKrRcdVU=
ARC-Authentication-Results: i=1; server2.sourceware.org
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1710612076; x=1711216876;
h=to:subject:message-id:date:from:mime-version:x-gm-message-state
:from:to:cc:subject:date:message-id:reply-to;
bh=NFHXyVwR2TQTcbigd94Cs6sgqB9xzASF3RLxpF9W3hs=;
b=nK+Eg0y11llCheKBXrtzUIc6JSXz3MeC23apH/RsOSJEfJbfUDFQ5Y0i7eVsJxPFfN
8dHDagJFDo7PIoE7BhAxcy4eAuGdP72BUX39r4jCFjJ6TndBKMWwSWiga8chsxSIHPey
6m4cLXQWk6RA+2S+pFn+q+fdW+TmDp7HDn5OVsS0lF89bPm2b5p9R0eYz1FWXlbnxhYh
ip5QK1YdgWuMoQaFrRSiZ7LC4E3v95tgnjGNPnftodp2T9X29H6QaUjU6AqhCdIw41Of
Y5LfXlCIBxJMil0Yzl5P5GEJdqX1jIrrV6QtMdApgifwppI1bcJYPvz1Tu+UoN3x2Uw4
GfAA==
X-Gm-Message-State: AOJu0Yz+7hgmTqDe4AUNcgQ1FzizzdPSJRNzMWG9ofDQa1D4xHYEU/PI
1tEWoVqHpvTRjamQHwI6VIdC8ZosiCOgKm/TcfzXLXLhSiykSbanWSD+MfpawDidZ+26Ox1+ugd
ZSaI6eoQVPSA6zBRBVk2OS0XIpj3GxSI5gZjvkw==
X-Google-Smtp-Source: AGHT+IE8EgVKE2OjLCn5zA1L15QxkYL4MyVfzWV01wg/E0ChZavg0dzZYr03YXPNRGzJ4MJqzeAHYGXXb4EqnLczDz8=
X-Received: by 2002:a17:90a:a182:b0:29d:d92d:28cb with SMTP id
t2-20020a17090aa18200b0029dd92d28cbmr7462108pjp.0.1710612075668; Sat, 16 Mar
2024 11:01:15 -0700 (PDT)
MIME-Version: 1.0
Date: Sat, 16 Mar 2024 13:00:59 -0500
Message-ID: <CAEFTnVP=CV_7v=-yRgfsaxk6qbRE=s_LPPZonKPW8CdLiEvfZw@mail.gmail.com>
Subject: The grep 3.11 application when used in perl-regexp mode appears to
now be broken
To: cygwin AT cygwin DOT com
X-Spam-Status: No, score=-0.0 required=5.0 tests=BAYES_00, DKIM_SIGNED,
DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_ENVFROM_END_DIGIT,
FREEMAIL_FROM, HTML_MESSAGE, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,
SPF_PASS, TXREP,
T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on
server2.sourceware.org
X-Content-Filtered-By: Mailman/MimeDel 2.1.30
X-BeenThere: cygwin AT cygwin DOT com
X-Mailman-Version: 2.1.30
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-request AT cygwin DOT com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe>
From: Michael Goldshteyn via Cygwin <cygwin AT cygwin DOT com>
Reply-To: Michael Goldshteyn <mgold10000 AT gmail DOT com>
Sender: "Cygwin" <cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com>

I just updated my Cygwin64 installation, which includes the grep
utility and its behavior has changed. It no longer works like it used to
for Perl reg-ex matching, as demonstrated below:

Simple test cases:
======================
$ ls -l a
-rwxr-xr-x 1 Michael None 6 Mar 16 12:15 a

$ hexdump -C a
00000000  31 30 30 30 0d 0a                                 |1000..|
00000006

# Notice the CR/LF encoding after the "1000" text, as is the case for DOS
text files

# Now let's test grep regular match
$ grep --version
grep (GNU grep) 3.11
Packaged by Cygwin (3.11-1)
Copyright (C) 2023 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <
https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Mike Haertel and others; see
<https://git.savannah.gnu.org/cgit/grep.git/tree/AUTHORS>.

grep -P uses PCRE2 10.43 2024-02-16

$ grep '000' a
1000

# Match using pcre2
$ grep -P '000' a
1000

# OK, so far so good
$ grep -P '000$' a
# No match

# Put another way
$ grep -c -P '000$' a
0

# Now you may be thinking, OK, it's because of the CR/LF line ending
# But, I present the following
$ pcre2grep --version
pcre2grep version 10.43 2024-02-16

$ pcre2grep '000$' a
1000

# As a further cross-check, the same version of the cygpcre2-8-0.Dll is
used for both grep.exe and pcre2grep.exe, as shown below with an "=>"
annotation added by me to direct you to the Dll in question:

$ ldd grep.exe
        ntdll.dll => /cygdrive/c/Windows/SYSTEM32/ntdll.dll (0x7ffa87d50000)
        KERNEL32.DLL => /cygdrive/c/Windows/System32/KERNEL32.DLL
(0x7ffa87700000)
        KERNELBASE.dll => /cygdrive/c/Windows/System32/KERNELBASE.dll
(0x7ffa85570000)
        cygwin1.dll => /usr/bin/cygwin1.dll (0x7ff9c84d0000)
        cygintl-8.dll => /usr/bin/cygintl-8.dll (0x5ee2d0000)
=>        cygpcre2-8-0.dll => /usr/bin/cygpcre2-8-0.dll (0x5ec2b0000)
        cygiconv-2.dll => /usr/bin/cygiconv-2.dll (0x3dff10000)

$ ldd pcre2grep.exe
        ntdll.dll => /cygdrive/c/Windows/SYSTEM32/ntdll.dll (0x7ffa87d50000)
        KERNEL32.DLL => /cygdrive/c/Windows/System32/KERNEL32.DLL
(0x7ffa87700000)
        KERNELBASE.dll => /cygdrive/c/Windows/System32/KERNELBASE.dll
(0x7ffa85570000)
=>        cygpcre2-8-0.dll => /usr/bin/cygpcre2-8-0.dll (0x5ec2b0000)
        cygbz2-1.dll => /usr/bin/cygbz2-1.dll (0x3ed560000)
        cygwin1.dll => /usr/bin/cygwin1.dll (0x7ff9c84d0000)
        cygz.dll => /usr/bin/cygz.dll (0x5ebb10000)

# For what it's worth, I also checked into what versions of libintl8 and
libiconv-2 I have, and these are as follows:
# libintl8 0.22.4-1
# libiconv2 1.17-1

# And as an addition cross-check, I will include the following "complete
hack":
$ strings cygintl-8.dll | pcre2grep '^\d\.\d\d'
0.22.4
0.22.4

$ strings cygiconv-2.dll | pcre2grep '^\d\.\d\d'
1.17
1.17

# For completeness, here is my CYGWIN environment variable setting and some
other info:
$ echo "$CYGWIN"
glob:ignorecase winsymlinks:native pipe_byte
$ echo "$CYGWIN64_DIR"
c:\cygwin64
$ which grep
/usr/bin/grep
$ which pcre2grep
/usr/bin/pcre2grep
# No aliases are set up for these, either
$ alias grep pcre2grep
bash: alias: grep: not found
bash: alias: pcre2grep: not found
======================
Further comments:
I do not know with which version of grep.exe this misbehavior (or at least
misaligned behavior with respect to grep2pcre) of the '-P' switch began. I
discovered it after updating my Cygwin64 install to use the latest grep
version, which likely also picked up the latest version of PCRE2 and
other dependencies along the way.

Thank you for looking into this and/or providing constructive comments on
the source of the issue,

Michael Goldshteyn

-- 
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019