public inbox for glibc-bugs-regex@sourceware.org
help / color / mirror / Atom feed
From: "eggert at gnu dot org" <sourceware-bugzilla@sourceware.org>
To: glibc-bugs-regex@sources.redhat.com
Subject: [Bug regex/1236] regex.h violates POSIX name space rules in several places
Date: Tue, 11 Apr 2006 06:58:00 -0000	[thread overview]
Message-ID: <20060411065808.23116.qmail@sourceware.org> (raw)
In-Reply-To: <20050824222100.1236.eggert@gnu.org>


------- Additional Comments From eggert at gnu dot org  2006-04-11 06:58 -------
I will attach a revised patch, now used in gnulib, which is much more
conservative.  The revised patch leaves almost all the names alone in
the normal case, and this addresses most of the objections.  If the
user compiles pedantically (e.g. by defining _POSIX_C_SOURCE), the
patched regex.h simply does not define the offending names; that
suffices to conform.

I didn't quite follow this objection, though:

> While true that this violates the name space, no other names are reserved
> either.

I take this to claim that names beginning with "re_" are not reserved.

However, XSI section 2.2.2 page 16 line 613
<http://www.opengroup.org/onlinepubs/000095399/functions/xsh_chap02_02.html>
says that <regex.h> implementations can define symbols with the
prefixes re_ and rm_, in the same sense that <errno.h> can define
symbols with the prefixes E[0-9A-Z].  Users therefore can't define
re_* and rm_* macros before including <regex.h>, just as they can't
define an E[0-9A-Z] macro before including <errno.h>.  So, in that
sense, the re_* and rm_* names are free for use within <regex.h>.
This may help to explain why Solaris 10 <regex.h> regex_t can have
members like "re_sc" and "re_len"; this is an allowed extension to the
standard.

PS.  For the record, the glibc <regex.h> identifiers that violate the
POSIX name space include macro names like
RE_BACKSLASH_ESCAPE_IN_LISTS, RE_SYNTAX_AWK, RE_DUP_MAX,
RE_TRANSLATE_TYPE, REGS_FIXED, and RE_NREGS; and member names like
buffer, allocated, start, and end.

For example, here is a program that strictly conforms to POSIX, and
works on Solaris 10, but doesn't work with glibc:

   #define _POSIX_C_SOURCE 200112L
   #define buffer 0
   #define start 0
   #include <regex.h>
   int RE_BACKSLASH_ESCAPE_IN_LISTS;
   int RE_SYNTAX_AWK;
   int RE_DUP_MAX;
   int RE_TRANSLATE_TYPE;
   int REGS_FIXED;
   int RE_NREGS;
   int main (void) { return 0; }


-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=1236

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


  parent reply	other threads:[~2006-04-11  6:58 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-24 22:21 [Bug regex/1236] New: " eggert at gnu dot org
2005-08-24 22:21 ` [Bug regex/1236] " eggert at gnu dot org
2005-08-24 22:23 ` eggert at gnu dot org
2005-08-24 23:08 ` eggert at gnu dot org
2005-08-24 23:21 ` eggert at gnu dot org
2005-09-06 20:03 ` drepper at redhat dot com
2006-04-11  6:58 ` eggert at gnu dot org [this message]
2006-04-11  6:58 ` eggert at gnu dot org
2006-04-11  7:06 ` eggert at gnu dot org
2010-09-02 14:42 ` schwab at linux-m68k dot 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=20060411065808.23116.qmail@sourceware.org \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=glibc-bugs-regex@sources.redhat.com \
    /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).