public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "zackw at panix dot com" <sourceware-bugzilla@sourceware.org>
To: glibc-bugs@sourceware.org
Subject: [Bug libc/18681] New: regexp.h is obsolete and buggy, and should be desupported
Date: Wed, 15 Jul 2015 13:13:00 -0000	[thread overview]
Message-ID: <bug-18681-131@http.sourceware.org/bugzilla/> (raw)

https://sourceware.org/bugzilla/show_bug.cgi?id=18681

            Bug ID: 18681
           Summary: regexp.h is obsolete and buggy, and should be
                    desupported
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
          Assignee: unassigned at sourceware dot org
          Reporter: zackw at panix dot com
                CC: drepper.fsp at gmail dot com
  Target Milestone: ---

<regexp.h> (not to be confused with <regex.h>) is an obsolete and
frankly horrible regular expression-matching API.  It was part of SVID
but was withdrawn in Issue 5 (for reference, we're on Issue 7 now).
It doesn't do anything you can't do with <regex.h>, and using it
involves defining a bunch of macros before including the header.
Moreover, the code in regexp.h that uses those macros has been buggy
since its creation (in 1996) and no one has noticed, which indicates
to me that there are no users.  There are two bugs:

(1) It often invokes RETURN in error situations.  For example, it
    maps REG_EBRACE to RETURN(44).  That should be ERROR(44)
    instead.

(2) If it succeeds, it invokes RETURN with a pointer that points
    outside the buffer provided by the caller.  It should have
    placed the compiled regexp object at the beginning of the
    buffer and given to RETURN a pointer just beyond the end of
    the object.  This means the caller cannot deallocate the
    compiled regular expression.

(1) would be easy to fix, but (2) would require nontrivial surgery on the core
regular expression compiler.  Therefore I think that this API should just be
removed.

[ I discovered this independently, but it was reported to Debian in 2009 as
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=517625 and I have borrowed
some of this text from there.]

-- 
You are receiving this mail because:
You are on the CC list for the bug.


             reply	other threads:[~2015-07-15 13:13 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-15 13:13 zackw at panix dot com [this message]
2015-07-15 13:57 ` [Bug libc/18681] " zackw at panix dot com
2015-07-15 13:58 ` zackw at panix dot com
2015-07-15 13:58 ` zackw at panix dot com
2015-08-16 15:37 ` cvs-commit at gcc dot gnu.org
2015-08-18 13:29 ` vapier at gentoo dot org
2015-08-18 13:29 ` cvs-commit at gcc dot gnu.org
2015-10-29 16:37 ` jsm28 at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-18681-131@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=glibc-bugs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).