From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Fabrice Popineau Newsgroups: gmane.emacs.devel Subject: Re: Regex PCRE tests failure under windows Date: Thu, 3 Aug 2017 13:52:33 +0200 Message-ID: References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="001a114495464e1a4d0555d80559" X-Trace: blaine.gmane.org 1501761220 11021 195.159.176.226 (3 Aug 2017 11:53:40 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 3 Aug 2017 11:53:40 +0000 (UTC) To: Emacs developers Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Aug 03 13:53:36 2017 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ddEh3-0002T9-FN for ged-emacs-devel@m.gmane.org; Thu, 03 Aug 2017 13:53:33 +0200 Original-Received: from localhost ([::1]:34501 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ddEh8-0001Cz-3W for ged-emacs-devel@m.gmane.org; Thu, 03 Aug 2017 07:53:38 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:49425) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ddEgS-0001Cc-8C for emacs-devel@gnu.org; Thu, 03 Aug 2017 07:52:57 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ddEgQ-000735-Si for emacs-devel@gnu.org; Thu, 03 Aug 2017 07:52:56 -0400 Original-Received: from mail-qk0-x230.google.com ([2607:f8b0:400d:c09::230]:33872) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ddEgQ-00071Z-NH for emacs-devel@gnu.org; Thu, 03 Aug 2017 07:52:54 -0400 Original-Received: by mail-qk0-x230.google.com with SMTP id u139so5944933qka.1 for ; Thu, 03 Aug 2017 04:52:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=yTw4pE0V7fD9TZXRaQLFiJI5PUfYtZciVSqlXZejagw=; b=FUd1u7ucgsvvho5V3omsUwxdASRr+BPoF8+jq4OTJbiwoCQFALZ0SvbNPEh8Fbu4ni 7tjzZKziobNgeNa5SDHEkl0v181wvr44P4YKHhb5YccR/YT51g/knub1OBcgCpAEsVA1 JC+kae4yKwhdg5T0DEFMks4Pwq/We8GQ6F9iSnEpyVb3z/FyC4uf0gVQLulfeCgYd2sC iiEtlUEy7cQd8PnNQvindNAcfxkZNKGT66krKU+fb3J+uEbRDhzLazTRQeB/ZiqNMZpe XJUQ9Qd61O3/QlTtOnuOAVQCPihYtF0UKkO1qGrmWOZIIIcpD5QI+uu7yIp5t704rhCX Wv5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=yTw4pE0V7fD9TZXRaQLFiJI5PUfYtZciVSqlXZejagw=; b=i3x9Rlw0/hJ7Aai426TVF7VhPBX79B53EQm1BvNKf1eAf75VpnefW9cQv5h4Y9GcVM M1z8XET7jPlNHhuyG/Es2IfHY7oaoArUxZtFPfCvP/JBp5bVbSnQEDVsDYLO3rE3ZmhU DVs207DnaKE/H0wxJRNeCSfZoHG1DmIuyXsyDyBrRw15dZoSLVRGgPJcdipdTkj0wEuI dLRuHzKoHWuQ5qyArXAhKywrdgVWz4qtfQrzR4yCX+SxeEi8RGuFHmjjbImFqRCZuO8r 76R9XBsx5ho3UZFz0tIyiGVaPXopbY1MZY9Q5N4THXZCjvZ7yOJp7j3BdKM1SEEIO4PF MmGQ== X-Gm-Message-State: AHYfb5jK+sgaIOPkhfuzm2EbPUxYUOOc+7ULLJ6+EzNcN4xLvEGBGktR apOS11NZ/uZqLRRBLUr9aWTHOGYMIsJb X-Received: by 10.55.20.211 with SMTP id 80mr1844454qku.94.1501761173853; Thu, 03 Aug 2017 04:52:53 -0700 (PDT) Original-Received: by 10.140.82.21 with HTTP; Thu, 3 Aug 2017 04:52:33 -0700 (PDT) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400d:c09::230 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:217259 Archived-At: --001a114495464e1a4d0555d80559 Content-Type: text/plain; charset="UTF-8" Trying to understand this issue a little bit more. Actually, the failure I see occurs a little bit earlier in PCRE.tests, at lines : /(cat(a(ract|tonic)|erpillar)) \1()2(3)/ cataract cataract23 0: cataract cataract23 1: cataract 2: aract 3: ract -> 4: 5: 3 In function `regex-tests-PCRE', there are 4 cases testes in sequence, and in case of failure, there is a catch-all reset which sets the pattern back to nil. The regex that should catch the line starting by "4:" is : ;; verification line: succeeded match ((save-excursion (re-search-forward "^ *\\([0-9]+\\): \\(.*\\)" nil t)) But notice that there is a space after the colon, so the line is not matched and the reset occurs in the test. The patter is set back to nil and there is a failure when reaching the PCRE.tests line starting by "5:". Could it be that there is a space in PCRE.tests at end of line "4: " and that git has removed it ? Fabrice 2017-08-03 12:28 GMT+02:00 Fabrice Popineau : > > I have this test failure on PCRE regex tests (emacs-master, mingw64) : > > $ cat test/src/regex-tests.log > Running 22 tests (2017-08-01 22:21:34+0200) > passed 1/22 regex-tests-BOOST > Test regex-tests-PCRE backtrace: > Test regex-tests-PCRE condition: > (wrong-type-argument stringp nil) > FAILED 2/22 regex-tests-PCRE > > > The failure occurs here in PCRE.tests : > > caterpillar caterpillar23 > 0: caterpillar caterpillar23 > 1: caterpillar > 2: erpillar > 3: > 4: > 5: 3 > > The variable which is nil instead of being a string is `pattern' > in (if (string-match pattern string) nil 'search-failed)`' : > > (defun regex-tests-PCRE () > (let (failures > pattern icase string what-failed matches-observed) > (regex-tests-generic-line > ?# "PCRE.tests" regex-tests-PCRE-whitelist > > (cond > > ;; pattern > ((save-excursion (re-search-forward "^/\\(.*\\)/\\(.*i?\\)$" nil t)) > (setq icase (string= "i" (match-string 2)) > pattern (regex-tests-unextend (match-string 1)))) > > ;; string. read it in, match against pattern, and save all the > results > ((save-excursion (re-search-forward "^ \\(.*\\)" nil t)) > (let ((case-fold-search icase)) > (setq string (match-string 1) > > ;; the regex match under test > what-failed > (condition-case nil > (if (string-match pattern string) nil 'search-failed) > ('invalid-regexp 'compilation-failed)) > > matches-observed > (cl-loop for x from 0 to 20 > collect (and (not what-failed) > (or (match-string x string) > ""))))) > nil) > > But I have no idea why pattern is losing its value ? > > Any clue ? > > Regards, > > Fabrice > > --001a114495464e1a4d0555d80559 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Trying to understand this issue a little bit more.
Actually, the failure I see occurs a little bit earlier in PCRE= .tests, at lines :

=C2=A0 /(cat(a(ract|tonic)= |erpillar)) \1()2(3)/
=C2=A0 =C2=A0 =C2=A0 cataract cataract23
=C2=A0 =C2=A00: cataract cataract23
=C2=A0 =C2=A01: catar= act
=C2=A0 =C2=A02: aract
=C2=A0 =C2=A03: ract
-> 4:
=C2=A0 =C2=A05: 3

In function= `regex-tests-PCRE', there are 4 cases testes in sequence, and in case = of failure, there is a catch-all reset which sets the pattern back to nil.<= /div>

The regex that should catch the line starting by &= quot;4:" is :=C2=A0

=C2=A0 =C2=A0 = =C2=A0 ;; verification line: succeeded match
=C2=A0 =C2=A0 =C2=A0= ((save-excursion (re-search-forward "^ *\\([0-9]+\\): \\(.*\\)" = nil t))
But notice that there is a space after the colon, s= o the line is not matched and the reset occurs in the test. The patter is s= et back to nil and there is a failure when
reaching the PCRE.test= s line starting by "5:".

Could it be tha= t there is a space in PCRE.tests at end of line "4: " and that gi= t has removed it ?

Fabrice


2017-08-03 12:= 28 GMT+02:00 Fabrice Popineau <fabrice.popineau@gmail.com>= :

=
I have this test failure on PCRE regex tests (emacs-master, mingw64) :=

$ cat test/src/regex-tests.log
Run= ning 22 tests (2017-08-01 22:21:34+0200)
=C2=A0 =C2=A0passed =C2= =A0 1/22 =C2=A0regex-tests-BOOST
Test regex-tests-PCRE backtrace:=
Test regex-tests-PCRE condition:
=C2=A0 =C2=A0 (wrong-= type-argument stringp nil)
=C2=A0 =C2=A0FAILED =C2=A0 2/22 =C2=A0= regex-tests-PCRE


The failure = occurs here in PCRE.tests :

=C2=A0 =C2=A0 cat= erpillar caterpillar23
=C2=A00: caterpillar caterpillar23
=C2=A01: caterpillar
=C2=A02: erpillar
=C2=A03: <= unset>
=C2=A04:
=C2=A05: 3

The variable which is nil instead of being a string is `pattern'<= /div>
in (if (string-match pattern string) nil 'search-failed)`'= ; :

(defun regex-tests-PCRE ()
=C2= =A0 (let (failures
=C2=A0 =C2=A0 =C2=A0 =C2=A0 pattern icase stri= ng what-failed matches-observed)
=C2=A0 =C2=A0 (regex-tests-gener= ic-line
=C2=A0 =C2=A0 =C2=A0?# "PCRE.tests" regex-tests= -PCRE-whitelist

=C2=A0 =C2=A0 =C2=A0(cond

=C2=A0 =C2=A0 =C2=A0 ;; pattern
=C2=A0 =C2=A0 = =C2=A0 ((save-excursion (re-search-forward "^/\\(.*\\)/\\(.*i?\\)$&quo= t; nil t))
=C2=A0 =C2=A0 =C2=A0 =C2=A0(setq icase (string=3D &quo= t;i" (match-string 2))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0pattern (regex-tests-unextend (match-string 1))))
=C2=A0 =C2=A0 =C2=A0 ;; string. read it in, match against patt= ern, and save all the results
=C2=A0 =C2=A0 =C2=A0 ((save-excursi= on (re-search-forward "^ =C2=A0 =C2=A0\\(.*\\)" nil t))
=C2=A0 =C2=A0 =C2=A0 =C2=A0(let ((case-fold-search icase))
=C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(setq string (match-string 1)

=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0;; the re= gex match under test
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0what-failed
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0(condition-case nil
=C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(if (string-match pattern string) = nil 'search-failed)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0('invalid-regexp 'compilation-failed))

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0ma= tches-observed
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0(cl-loop for x from 0 to 20
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 collect (and (not what= -failed)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0(or (match-string x string) "<unset>")))))
=C2= =A0 =C2=A0 =C2=A0 =C2=A0nil)

But I have no i= dea why pattern is losing its value ?

Any clue ?

Regards,

Fabrice


--001a114495464e1a4d0555d80559--