public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/18681] New: regexp.h is obsolete and buggy, and should be desupported
@ 2015-07-15 13:13 zackw at panix dot com
  2015-07-15 13:57 ` [Bug libc/18681] " zackw at panix dot com
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: zackw at panix dot com @ 2015-07-15 13:13 UTC (permalink / raw)
  To: glibc-bugs

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.


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2015-10-29 16:37 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-15 13:13 [Bug libc/18681] New: regexp.h is obsolete and buggy, and should be desupported zackw at panix dot com
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 ` cvs-commit at gcc dot gnu.org
2015-08-18 13:29 ` vapier at gentoo dot org
2015-10-29 16:37 ` jsm28 at gcc dot gnu.org

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).