delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2012/06/10/05:00:53

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-4.4 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,KHOP_RCVD_TRUST,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE,TW_EG
X-Spam-Check-By: sourceware.org
Message-ID: <4FD4622C.8050809@users.sourceforge.net>
Date: Sun, 10 Jun 2012 04:00:28 -0500
From: "Yaakov (Cygwin/X)" <yselkowitz AT users DOT sourceforge DOT net>
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:12.0) Gecko/20120428 Thunderbird/12.0.1
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: regex: incorrect REG_EMPTY
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

--------------010202070000020708040800
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

I encountered an apparent bug in our regex code triggered by one of the 
included hostprogs (namely arch/x86/tools/relocs.c) used while 
cross-compiling an i386 Linux kernel.

The exact regexp in question is included in the attached STC:

$ gcc -Wall regex-test.c  && ./a
./a: empty (sub)expression

$ gcc -DPCRE -Wall regex-test.c -lpcreposix && ./a


Yaakov

--------------010202070000020708040800
Content-Type: text/plain; charset=windows-1252;
 name="regex-test.c"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="regex-test.c"

#ifdef PCRE
#include <pcreposix.h>
#else
#include <regex.h>
#endif
#include <error.h>

int
main(void)
{
  regex_t re;
  int ret;
  char errbuf[128];
  /* offending regex pattern from kernel:arch/x86/tools/relocs.c */
  const char pattern[] = "^(__init_(begin|end)|"
        "__x86_cpu_dev_(start|end)|"
        "(__parainstructions|__alt_instructions)(|_end)|"
        "(__iommu_table|__apicdrivers|__smp_locks)(|_end)|"
        "__(start|end)_pci_.*|"
        "__(start|end)_builtin_fw|"
        "__(start|stop)___ksymtab(|_gpl|_unused|_unused_gpl|_gpl_future)|"
        "__(start|stop)___kcrctab(|_gpl|_unused|_unused_gpl|_gpl_future)|"
        "__(start|stop)___param|"
        "__(start|stop)___modver|"
        "__(start|stop)___bug_table|"
        "__tracedata_(start|end)|"
        "__(start|stop)_notes|"
        "__end_rodata|"
        "__initramfs_start|"
        "(jiffies|jiffies_64)|"
        "_end)$";

  if ((ret = regcomp (&re, pattern, REG_EXTENDED|REG_NOSUB)))
    {
      regerror(ret, &re, errbuf, sizeof(errbuf));
      error(ret, 0, errbuf);
    }
  return 0;
}


--------------010202070000020708040800
Content-Type: text/plain; charset=us-ascii

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

- Raw text -


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