* [PATCH] Kill regexp.h
@ 2015-07-12 19:55 Zack Weinberg
2015-07-12 20:46 ` Andreas Schwab
` (5 more replies)
0 siblings, 6 replies; 47+ messages in thread
From: Zack Weinberg @ 2015-07-12 19:55 UTC (permalink / raw)
To: libc-alpha
<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. (Specifically, RETURN() is used in a
whole bunch of cases where it should have been ERROR().)
Therefore, this patch stubs out the header and demotes the
implementation to compatibility symbols. I hope this is not too late
to squeeze into glibc 2.22. (Note: there isn't any predefined macro
to put .bss symbols in a compatibility subsection. Using
'attribute_data_compat_section' would make the libc on disk bigger,
which seems like a move in the wrong direction. It's only three
pointers' worth of junk, anyway...)
The ABI checker does not appear to cover these symbols; I manually
tested the effect of the patch as follows:
# glibc 2.19 (Debian)
$ readelf --dyn-syms /lib/x86_64-linux-gnu/libc.so.6 | grep -E 'advance|step|loc[12s]'
540: 00000000000e4da0 104 FUNC WEAK DEFAULT 12 step@@GLIBC_2.2.5
1364: 00000000000e4e10 84 FUNC WEAK DEFAULT 12 advance@@GLIBC_2.2.5
2051: 00000000003a85e8 8 OBJECT GLOBAL DEFAULT 32 loc1@@GLIBC_2.2.5
2054: 00000000003a85f0 8 OBJECT GLOBAL DEFAULT 32 loc2@@GLIBC_2.2.5
2198: 00000000003a85f8 8 OBJECT GLOBAL DEFAULT 32 locs@@GLIBC_2.2.5
# patched libc
$ readelf --dyn-syms ./libc.so.6 | grep -E 'advance|step|loc[12s]'
541: 000000000011eb80 104 FUNC WEAK DEFAULT 12 step@GLIBC_2.2.5
1374: 000000000011ebf0 84 FUNC WEAK DEFAULT 12 advance@GLIBC_2.2.5
2065: 00000000003a35e0 8 OBJECT GLOBAL DEFAULT 32 loc1@GLIBC_2.2.5
2068: 00000000003a35e8 8 OBJECT GLOBAL DEFAULT 32 loc2@GLIBC_2.2.5
2211: 00000000003a35d8 8 OBJECT GLOBAL DEFAULT 32 locs@GLIBC_2.2.5
$ cat test.c
#include <inttypes.h>
extern char *loc1;
extern char *loc2;
extern char *locs;
extern int step();
extern int advance();
int main(void)
{
return (int)((intptr_t)step + (intptr_t)advance + (intptr_t)&locs + (intptr_t)&loc1 + (intptr_t)&loc2);
}
$ gcc-5 test.c; echo $?
0
$ ./testrun.sh ./a.out; echo $?
136
$ gcc-5 -nostdlib -nostartfiles csu/crt1.o csu/crti.o `gcc-5 --print-file-name=crtbegin.o` test.c libc.so.6 libc_nonshared.a -lgcc `gcc-5 --print-file-name=crtend.o` csu/crtn.o
/tmp/ccC6lyqC.o: In function `main':
test.c:(.text+0x5): undefined reference to `locs'
test.c:(.text+0xc): undefined reference to `step'
test.c:(.text+0x13): undefined reference to `loc2'
test.c:(.text+0x1c): undefined reference to `advance'
test.c:(.text+0x23): undefined reference to `loc1'
collect2: error: ld returned 1 exit status
---
N.B. I believe there *is* a past-and-future-changes copyright
assignment on file for me for glibc, but it was filed long, long
ago, if I need to do new paperwork that's OK.
zw
---
2015-07-12 Zack Weinberg <zackw@panix.com>
* misc/regexp.h: This interface is no longer supported.
Remove all contents, leaving only an #error directive.
* misc/regexp.c: Do not include regexp.h.
(loc1, loc2, locs, step, advance): Demote to compatibility symbols.
NEWS | 4 ++
misc/regexp.c | 37 +++++++----
misc/regexp.h | 207 ++--------------------------------------------------------
3 files changed, 34 insertions(+), 214 deletions(-)
diff --git a/NEWS b/NEWS
index 2cfc43e..c00dba1 100644
--- a/NEWS
+++ b/NEWS
@@ -71,6 +71,10 @@ Version 2.22
compliance. The new implementation fixes the following long-standing
issues: BZ#6544, BZ#11216, BZ#12836, BZ#13151, BZ#13152, and BZ#14292. The
old implementation is still present for use be by existing binaries.
+
+* The obsolete header <regexp.h> (from SUSv2) has been replaced with a
+ stub. Programs that require this header must be updated to use
+ <regex.h> instead.
\f
Version 2.21
diff --git a/misc/regexp.c b/misc/regexp.c
index 3b83203..d35888f 100644
--- a/misc/regexp.c
+++ b/misc/regexp.c
@@ -1,4 +1,4 @@
-/* Define function and variables for the obsolete <regexp.h> interface.
+/* Compatibility symbols for the obsolete <regexp.h> interface.
Copyright (C) 1996-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
@@ -17,24 +17,32 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-#define __DO_NOT_DEFINE_COMPILE
-#include <regexp.h>
+/* regexp.h now contains only an #error directive, so it cannot be
+ used in this file.
+
+ The function that would produce an 'expbuf' to use as the second
+ argument to 'step' and 'advance' was defined only in regexp.h,
+ as its definition depended on macros defined by the user. */
+
+#include <regex.h>
+#include <shlib-compat.h>
+
+#if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_22)
-/* Define the variables used for the interface. */
char *loc1;
char *loc2;
-
-/* Although we do not support the use we define this variable as well. */
char *locs;
-
+compat_symbol(libc, loc1, loc1, GLIBC_2_0);
+compat_symbol(libc, loc2, loc2, GLIBC_2_0);
+compat_symbol(libc, locs, locs, GLIBC_2_0);
/* Find the next match in STRING. The compiled regular expression is
found in the buffer starting at EXPBUF. `loc1' will return the
first character matched and `loc2' points to the next unmatched
character. */
-extern int __step (const char *string, const char *expbuf);
int
-__step (const char *string, const char *expbuf)
+weak_function attribute_compat_text_section
+step (const char *string, const char *expbuf)
{
regmatch_t match; /* We only need info about the full match. */
@@ -49,15 +57,14 @@ __step (const char *string, const char *expbuf)
loc2 = (char *) string + match.rm_eo;
return 1;
}
-weak_alias (__step, step)
-
+compat_symbol (libc, step, step, GLIBC_2_0);
/* Match the beginning of STRING with the compiled regular expression
in EXPBUF. If the match is successful `loc2' will contain the
position of the first unmatched character. */
-extern int __advance (const char *string, const char *expbuf);
int
-__advance (const char *string, const char *expbuf)
+weak_function attribute_compat_text_section
+advance (const char *string, const char *expbuf)
{
regmatch_t match; /* We only need info about the full match. */
@@ -74,4 +81,6 @@ __advance (const char *string, const char *expbuf)
loc2 = (char *) string + match.rm_eo;
return 1;
}
-weak_alias (__advance, advance)
+compat_symbol (libc, advance, advance, GLIBC_2_0);
+
+#endif /* SHLIB_COMPAT(2.0, 2.22) */
diff --git a/misc/regexp.h b/misc/regexp.h
index 3fc0bc5..43c6e10 100644
--- a/misc/regexp.h
+++ b/misc/regexp.h
@@ -19,208 +19,15 @@
#ifndef _REGEXP_H
#define _REGEXP_H 1
-/* The contents of this header file was first standardized in X/Open
+/* The contents of this header file were first standardized in X/Open
System Interface and Headers Issue 2, originally coming from SysV.
- In issue 4, version 2, it is marked as TO BE WITDRAWN, and it has
- been withdrawn in SUSv3.
+ In issue 4, version 2, it was marked as TO BE WITHDRAWN, and it was
+ duly withdrawn in issue 5.
- This code shouldn't be used in any newly written code. It is
- included only for compatibility reasons. Use the POSIX definition
- in <regex.h> for portable applications and a reasonable interface. */
+ As of GNU libc 2.22, the interfaces in this header have been removed.
+ Use the <regex.h> interfaces instead. */
-#include <features.h>
-#include <alloca.h>
-#include <regex.h>
-#include <stdlib.h>
-#include <string.h>
-
-/* The implementation provided here emulates the needed functionality
- by mapping to the POSIX regular expression matcher. The interface
- for the here included function is weird (this really is a harmless
- word).
-
- The user has to provide six macros before this header file can be
- included:
-
- INIT Declarations vor variables which can be used by the
- other macros.
-
- GETC() Return the value of the next character in the regular
- expression pattern. Successive calls should return
- successive characters.
-
- PEEKC() Return the value of the next character in the regular
- expression pattern. Immediately successive calls to
- PEEKC() should return the same character which should
- also be the next character returned by GETC().
-
- UNGETC(c) Cause `c' to be returned by the next call to GETC() and
- PEEKC().
-
- RETURN(ptr) Used for normal exit of the `compile' function. `ptr'
- is a pointer to the character after the last character of
- the compiled regular expression.
-
- ERROR(val) Used for abnormal return from `compile'. `val' is the
- error number. The error codes are:
- 11 Range endpoint too large.
- 16 Bad number.
- 25 \digit out of range.
- 36 Illegal or missing delimiter.
- 41 No remembered search string.
- 42 \( \) imbalance.
- 43 Too many \(.
- 44 More tan two numbers given in \{ \}.
- 45 } expected after \.
- 46 First number exceeds second in \{ \}.
- 49 [ ] imbalance.
- 50 Regular expression overflow.
-
- */
-
-__BEGIN_DECLS
-
-/* Interface variables. They contain the results of the successful
- calls to `setp' and `advance'. */
-extern char *loc1;
-extern char *loc2;
-
-/* The use of this variable in the `advance' function is not
- supported. */
-extern char *locs;
-
-
-#ifndef __DO_NOT_DEFINE_COMPILE
-/* Get and compile the user supplied pattern up to end of line or
- string or until EOF is seen, whatever happens first. The result is
- placed in the buffer starting at EXPBUF and delimited by ENDBUF.
-
- This function cannot be defined in the libc itself since it depends
- on the macros. */
-char *
-compile (char *__restrict instring, char *__restrict expbuf,
- const char *__restrict endbuf, int eof)
-{
- char *__input_buffer = NULL;
- size_t __input_size = 0;
- size_t __current_size = 0;
- int __ch;
- int __error;
- INIT
-
- /* Align the expression buffer according to the needs for an object
- of type `regex_t'. Then check for minimum size of the buffer for
- the compiled regular expression. */
- regex_t *__expr_ptr;
-# if defined __GNUC__ && __GNUC__ >= 2
- const size_t __req = __alignof__ (regex_t *);
-# else
- /* How shall we find out? We simply guess it and can change it is
- this really proofs to be wrong. */
- const size_t __req = 8;
-# endif
- expbuf += __req;
- expbuf -= (expbuf - ((char *) 0)) % __req;
- if (endbuf < expbuf + sizeof (regex_t))
- {
- ERROR (50);
- }
- __expr_ptr = (regex_t *) expbuf;
- /* The remaining space in the buffer can be used for the compiled
- pattern. */
- __expr_ptr->__REPB_PREFIX (buffer) = expbuf + sizeof (regex_t);
- __expr_ptr->__REPB_PREFIX (allocated)
- = endbuf - (char *) __expr_ptr->__REPB_PREFIX (buffer);
-
- while ((__ch = (GETC ())) != eof)
- {
- if (__ch == '\0' || __ch == '\n')
- {
- UNGETC (__ch);
- break;
- }
-
- if (__current_size + 1 >= __input_size)
- {
- size_t __new_size = __input_size ? 2 * __input_size : 128;
- char *__new_room = (char *) alloca (__new_size);
- /* See whether we can use the old buffer. */
- if (__new_room + __new_size == __input_buffer)
- {
- __input_size += __new_size;
- __input_buffer = (char *) memcpy (__new_room, __input_buffer,
- __current_size);
- }
- else if (__input_buffer + __input_size == __new_room)
- __input_size += __new_size;
- else
- {
- __input_size = __new_size;
- __input_buffer = (char *) memcpy (__new_room, __input_buffer,
- __current_size);
- }
- }
- __input_buffer[__current_size++] = __ch;
- }
- if (__current_size)
- __input_buffer[__current_size++] = '\0';
- else
- __input_buffer = "";
-
- /* Now compile the pattern. */
- __error = regcomp (__expr_ptr, __input_buffer, REG_NEWLINE);
- if (__error != 0)
- /* Oh well, we have to translate POSIX error codes. */
- switch (__error)
- {
- case REG_BADPAT:
- case REG_ECOLLATE:
- case REG_ECTYPE:
- case REG_EESCAPE:
- case REG_BADRPT:
- case REG_EEND:
- case REG_ERPAREN:
- default:
- /* There is no matching error code. */
- RETURN (36);
- case REG_ESUBREG:
- RETURN (25);
- case REG_EBRACK:
- RETURN (49);
- case REG_EPAREN:
- RETURN (42);
- case REG_EBRACE:
- RETURN (44);
- case REG_BADBR:
- RETURN (46);
- case REG_ERANGE:
- RETURN (11);
- case REG_ESPACE:
- case REG_ESIZE:
- ERROR (50);
- }
-
- /* Everything is ok. */
- RETURN ((char *) (__expr_ptr->__REPB_PREFIX (buffer)
- + __expr_ptr->__REPB_PREFIX (used)));
-}
-#endif
-
-
-/* Find the next match in STRING. The compiled regular expression is
- found in the buffer starting at EXPBUF. `loc1' will return the
- first character matched and `loc2' points to the next unmatched
- character. */
-extern int step (const char *__restrict __string,
- const char *__restrict __expbuf) __THROW;
-
-/* Match the beginning of STRING with the compiled regular expression
- in EXPBUF. If the match is successful `loc2' will contain the
- position of the first unmatched character. */
-extern int advance (const char *__restrict __string,
- const char *__restrict __expbuf) __THROW;
-
-
-__END_DECLS
+#error "GNU libc no longer implements <regexp.h>."
+#error "Revise your code to use <regex.h> (no P)."
#endif /* regexp.h */
--
2.1.4
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [PATCH] Kill regexp.h
2015-07-12 19:55 [PATCH] Kill regexp.h Zack Weinberg
@ 2015-07-12 20:46 ` Andreas Schwab
2015-07-12 21:58 ` Zack Weinberg
2015-07-13 5:30 ` Kalle Olavi Niemitalo
` (4 subsequent siblings)
5 siblings, 1 reply; 47+ messages in thread
From: Andreas Schwab @ 2015-07-12 20:46 UTC (permalink / raw)
To: Zack Weinberg; +Cc: libc-alpha
Zack Weinberg <zackw@panix.com> writes:
> The ABI checker does not appear to cover these symbols;
What do you mean with that?
Andreas.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [PATCH] Kill regexp.h
2015-07-12 20:46 ` Andreas Schwab
@ 2015-07-12 21:58 ` Zack Weinberg
0 siblings, 0 replies; 47+ messages in thread
From: Zack Weinberg @ 2015-07-12 21:58 UTC (permalink / raw)
To: Andreas Schwab; +Cc: libc-alpha
On Sun, Jul 12, 2015 at 4:46 PM, Andreas Schwab <schwab@linux-m68k.org> wrote:
> Zack Weinberg <zackw@panix.com> writes:
>> The ABI checker does not appear to cover these symbols;
>
> What do you mean with that?
I mean that neither `make check-abi` nor the tester described at
https://sourceware.org/glibc/wiki/Testing/ABI_checker found a problem
with this patch, however, the latter specifically cannot handle
regexp.h (because of the macros) so I was uncertain whether the
relevant symbols had actually been tested. I see now that they *are*
in the .abilist files, so hopefully that's good enough.
zw
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [PATCH] Kill regexp.h
2015-07-12 19:55 [PATCH] Kill regexp.h Zack Weinberg
2015-07-12 20:46 ` Andreas Schwab
@ 2015-07-13 5:30 ` Kalle Olavi Niemitalo
2015-07-14 21:21 ` Carlos O'Donell
` (3 subsequent siblings)
5 siblings, 0 replies; 47+ messages in thread
From: Kalle Olavi Niemitalo @ 2015-07-13 5:30 UTC (permalink / raw)
To: libc-alpha
Zack Weinberg <zackw@panix.com> writes:
> 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. (Specifically, RETURN() is used in a
> whole bunch of cases where it should have been ERROR().)
Also, it allocates new memory for the compiled regexp, instead of
using the memory that the caller provided for that purpose.
http://bugs.debian.org/517625
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [PATCH] Kill regexp.h
2015-07-12 19:55 [PATCH] Kill regexp.h Zack Weinberg
2015-07-12 20:46 ` Andreas Schwab
2015-07-13 5:30 ` Kalle Olavi Niemitalo
@ 2015-07-14 21:21 ` Carlos O'Donell
2015-07-15 0:20 ` Zack Weinberg
2015-07-15 4:01 ` Mike Frysinger
` (2 subsequent siblings)
5 siblings, 1 reply; 47+ messages in thread
From: Carlos O'Donell @ 2015-07-14 21:21 UTC (permalink / raw)
To: Zack Weinberg, libc-alpha
On 07/12/2015 03:27 PM, Zack Weinberg wrote:
> <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. (Specifically, RETURN() is used in a
> whole bunch of cases where it should have been ERROR().)
>
> Therefore, this patch stubs out the header and demotes the
> implementation to compatibility symbols. I hope this is not too late
> to squeeze into glibc 2.22. (Note: there isn't any predefined macro
> to put .bss symbols in a compatibility subsection. Using
> 'attribute_data_compat_section' would make the libc on disk bigger,
> which seems like a move in the wrong direction. It's only three
> pointers' worth of junk, anyway...)
Too late for 2.22. You posted on the 12th which was technically frozen.
Please keep discussing for 2.23.
> The ABI checker does not appear to cover these symbols; I manually
> tested the effect of the patch as follows:
Interesting. I would have expected the ABI symbol checker to catch these
symbols... but I haven't looked yet.
Do you have any explanation for that? A manual test is not exactly what
we want to see going forward.
> # glibc 2.19 (Debian)
> $ readelf --dyn-syms /lib/x86_64-linux-gnu/libc.so.6 | grep -E 'advance|step|loc[12s]'
> 540: 00000000000e4da0 104 FUNC WEAK DEFAULT 12 step@@GLIBC_2.2.5
> 1364: 00000000000e4e10 84 FUNC WEAK DEFAULT 12 advance@@GLIBC_2.2.5
> 2051: 00000000003a85e8 8 OBJECT GLOBAL DEFAULT 32 loc1@@GLIBC_2.2.5
> 2054: 00000000003a85f0 8 OBJECT GLOBAL DEFAULT 32 loc2@@GLIBC_2.2.5
> 2198: 00000000003a85f8 8 OBJECT GLOBAL DEFAULT 32 locs@@GLIBC_2.2.5
>
> # patched libc
> $ readelf --dyn-syms ./libc.so.6 | grep -E 'advance|step|loc[12s]'
> 541: 000000000011eb80 104 FUNC WEAK DEFAULT 12 step@GLIBC_2.2.5
> 1374: 000000000011ebf0 84 FUNC WEAK DEFAULT 12 advance@GLIBC_2.2.5
> 2065: 00000000003a35e0 8 OBJECT GLOBAL DEFAULT 32 loc1@GLIBC_2.2.5
> 2068: 00000000003a35e8 8 OBJECT GLOBAL DEFAULT 32 loc2@GLIBC_2.2.5
> 2211: 00000000003a35d8 8 OBJECT GLOBAL DEFAULT 32 locs@GLIBC_2.2.5
>
> $ cat test.c
> #include <inttypes.h>
>
> extern char *loc1;
> extern char *loc2;
> extern char *locs;
> extern int step();
> extern int advance();
>
> int main(void)
> {
> return (int)((intptr_t)step + (intptr_t)advance + (intptr_t)&locs + (intptr_t)&loc1 + (intptr_t)&loc2);
> }
>
> $ gcc-5 test.c; echo $?
> 0
> $ ./testrun.sh ./a.out; echo $?
> 136
> $ gcc-5 -nostdlib -nostartfiles csu/crt1.o csu/crti.o `gcc-5 --print-file-name=crtbegin.o` test.c libc.so.6 libc_nonshared.a -lgcc `gcc-5 --print-file-name=crtend.o` csu/crtn.o
> /tmp/ccC6lyqC.o: In function `main':
> test.c:(.text+0x5): undefined reference to `locs'
> test.c:(.text+0xc): undefined reference to `step'
> test.c:(.text+0x13): undefined reference to `loc2'
> test.c:(.text+0x1c): undefined reference to `advance'
> test.c:(.text+0x23): undefined reference to `loc1'
> collect2: error: ld returned 1 exit status
>
> ---
>
> N.B. I believe there *is* a past-and-future-changes copyright
> assignment on file for me for glibc, but it was filed long, long
> ago, if I need to do new paperwork that's OK.
The problem is that your past-and-futures-changes were with
zack@rabi.phys.columbia.edu, and we don't know what your present
employer might say about the copyright of your work. Therefore
we do need new paperwork either personal ones for you @panix.com,
or corporate coverage.
At a high level your patch looks OK, it makes sense to deprecate
these interfaces, but I think we should to do this in two stages.
Add warnings and then remove.
Not to mention we need a test to make sure the symbols are at the
versions they should be.
Cheers,
Carlos.
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [PATCH] Kill regexp.h
2015-07-14 21:21 ` Carlos O'Donell
@ 2015-07-15 0:20 ` Zack Weinberg
2015-07-15 13:12 ` Carlos O'Donell
0 siblings, 1 reply; 47+ messages in thread
From: Zack Weinberg @ 2015-07-15 0:20 UTC (permalink / raw)
To: Carlos O'Donell; +Cc: libc-alpha
On Tue, Jul 14, 2015 at 5:21 PM, Carlos O'Donell <carlos@redhat.com> wrote:
> On 07/12/2015 03:27 PM, Zack Weinberg wrote:
>> ... this patch stubs out the header and demotes the
>> implementation to compatibility symbols. I hope this is not too late
>> to squeeze into glibc 2.22.
>
> Too late for 2.22. You posted on the 12th which was technically frozen.
> Please keep discussing for 2.23.
OK. I won't be able to submit a revised patch till after 2.23 opens
due to the use of SHLIB_COMPAT.
>> The ABI checker does not appear to cover these symbols; I manually
>> tested the effect of the patch as follows:
>
> Interesting. I would have expected the ABI symbol checker to catch these
> symbols... but I haven't looked yet.
I was mistaken, the .abilist files *do* cover these symbols. (The
tool described at
http://ispras.linuxbase.org/index.php/ABI_compliance_checker cannot
process the *header*, which is what confused me.)
>> N.B. I believe there *is* a past-and-future-changes copyright
>> assignment on file for me for glibc, but it was filed long, long
>> ago, if I need to do new paperwork that's OK.
>
> The problem is that your past-and-futures-changes were with
> zack@rabi.phys.columbia.edu, and we don't know what your present
> employer might say about the copyright of your work. Therefore
> we do need new paperwork either personal ones for you @panix.com,
> or corporate coverage.
My current employer is CMU and I believe they make no copyright claim
on work done on my own time with no use of university resources. I
will get the ball rolling on a new personal copyright assignment.
> At a high level your patch looks OK, it makes sense to deprecate
> these interfaces, but I think we should to do this in two stages.
> Add warnings and then remove.
Hm. If we do that then I would feel obliged to fix the bugs in the
header in phase one. I'm not sure that's worth doing...
zw
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [PATCH] Kill regexp.h
2015-07-12 19:55 [PATCH] Kill regexp.h Zack Weinberg
` (2 preceding siblings ...)
2015-07-14 21:21 ` Carlos O'Donell
@ 2015-07-15 4:01 ` Mike Frysinger
2015-07-15 13:15 ` Zack Weinberg
2015-08-05 15:21 ` [2.23 PATCH] Desupport regexp.h (bug 18681) Zack Weinberg
2015-08-05 15:21 ` [2.22 PATCH] Correct comments about the history of <regexp.h> Zack Weinberg
5 siblings, 1 reply; 47+ messages in thread
From: Mike Frysinger @ 2015-07-15 4:01 UTC (permalink / raw)
To: Zack Weinberg; +Cc: libc-alpha
[-- Attachment #1: Type: text/plain, Size: 1032 bytes --]
On 12 Jul 2015 15:27, Zack Weinberg wrote:
> Therefore, this patch stubs out the header and demotes the
> implementation to compatibility symbols.
our current workflow says that all user visible changes (like this) require a
bugzilla bug to be created for reference. please do that and update the various
pieces with that BZ #.
> +#if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_22)
should be a space before the (
> -/* Define the variables used for the interface. */
> char *loc1;
> char *loc2;
> -
> -/* Although we do not support the use we define this variable as well. */
> char *locs;
should probably leave the comments alone
> +compat_symbol(libc, loc1, loc1, GLIBC_2_0);
> +compat_symbol(libc, loc2, loc2, GLIBC_2_0);
> +compat_symbol(libc, locs, locs, GLIBC_2_0);
should be a space before the (
> +#error "GNU libc no longer implements <regexp.h>."
> +#error "Revise your code to use <regex.h> (no P)."
how about changing the parenthetical aside to:
... (no trailing 'p').
-mike
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [PATCH] Kill regexp.h
2015-07-15 0:20 ` Zack Weinberg
@ 2015-07-15 13:12 ` Carlos O'Donell
2015-07-15 13:56 ` Zack Weinberg
0 siblings, 1 reply; 47+ messages in thread
From: Carlos O'Donell @ 2015-07-15 13:12 UTC (permalink / raw)
To: Zack Weinberg; +Cc: libc-alpha
On 07/14/2015 08:20 PM, Zack Weinberg wrote:
>> At a high level your patch looks OK, it makes sense to deprecate
>> these interfaces, but I think we should to do this in two stages.
>> Add warnings and then remove.
>
> Hm. If we do that then I would feel obliged to fix the bugs in the
> header in phase one. I'm not sure that's worth doing...
Worth is certainly in the eye of the beholder. How would you feel if
you were a user of this interface?
c.
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [PATCH] Kill regexp.h
2015-07-15 4:01 ` Mike Frysinger
@ 2015-07-15 13:15 ` Zack Weinberg
0 siblings, 0 replies; 47+ messages in thread
From: Zack Weinberg @ 2015-07-15 13:15 UTC (permalink / raw)
To: libc-alpha
[-- Attachment #1: Type: text/plain, Size: 1088 bytes --]
On 07/15/2015 12:01 AM, Mike Frysinger wrote:
> On 12 Jul 2015 15:27, Zack Weinberg wrote:
>> Therefore, this patch stubs out the header and demotes the
>> implementation to compatibility symbols.
>
> our current workflow says that all user visible changes (like this) require a
> bugzilla bug to be created for reference. please do that and update the various
> pieces with that BZ #.
OK, filed https://sourceware.org/bugzilla/show_bug.cgi?id=18681 .
>> +#if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_22)
>
> should be a space before the (
Thanks, I haven't coded to the GNU style standards in a long time.
>> -/* Define the variables used for the interface. */
>> char *loc1;
>> char *loc2;
>> -
>> -/* Although we do not support the use we define this variable as well. */
>> char *locs;
>
> should probably leave the comments alone
yeah, ok
>> +#error "GNU libc no longer implements <regexp.h>."
>> +#error "Revise your code to use <regex.h> (no P)."
>
> how about changing the parenthetical aside to:
> ... (no trailing 'p').
ok
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [PATCH] Kill regexp.h
2015-07-15 13:12 ` Carlos O'Donell
@ 2015-07-15 13:56 ` Zack Weinberg
2015-07-21 18:09 ` Zack Weinberg
` (3 more replies)
0 siblings, 4 replies; 47+ messages in thread
From: Zack Weinberg @ 2015-07-15 13:56 UTC (permalink / raw)
To: Carlos O'Donell; +Cc: libc-alpha
[-- Attachment #1: Type: text/plain, Size: 4940 bytes --]
On 07/15/2015 09:12 AM, Carlos O'Donell wrote:
> On 07/14/2015 08:20 PM, Zack Weinberg wrote:
>>> At a high level your patch looks OK, it makes sense to deprecate
>>> these interfaces, but I think we should to do this in two stages.
>>> Add warnings and then remove.
>>
>> Hm. If we do that then I would feel obliged to fix the bugs in the
>> header in phase one. I'm not sure that's worth doing...
>
> Worth is certainly in the eye of the beholder. How would you feel if
> you were a user of this interface?
So thinking about this a bit more, would you take this patch for 2.22?
All it does is add #warning directives and correct the RETURN .vs. ERROR
thing (leaving the memory-allocation issue reported in Debian).
---
* regexp.h: Add unconditional #warning stating that this header
will be removed soon. Revise banner comment to match.
(compile): Consistently use ERROR instead of RETURN to report
errors (partial fix for bz#18681).
* regexp.c: Don't include regexp.h.
---
NEWS | 6 ++++++
misc/regexp.c | 8 ++++----
misc/regexp.h | 30 +++++++++++++++++-------------
3 files changed, 27 insertions(+), 17 deletions(-)
diff --git a/NEWS b/NEWS
index f91edc7..d9cf4a7 100644
--- a/NEWS
+++ b/NEWS
@@ -71,6 +71,12 @@ Version 2.22
compliance. The new implementation fixes the following long-standing
issues: BZ#6544, BZ#11216, BZ#12836, BZ#13151, BZ#13152, and
BZ#14292. The
old implementation is still present for use be by existing binaries.
+
+* The header <regexp.h> is deprecated, and will be removed in a future
+ release. (It was removed from POSIX long ago, and it has bugs we cannot
+ easily fix. See BZ#18681 for more details.) We suspect that no one has
+ used this header in many years, but if you have code that does use it,
+ you will need to update it to use <regex.h> instead.
\f
Version 2.21
diff --git a/misc/regexp.c b/misc/regexp.c
index 3b83203..d389804 100644
--- a/misc/regexp.c
+++ b/misc/regexp.c
@@ -17,8 +17,10 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-#define __DO_NOT_DEFINE_COMPILE
-#include <regexp.h>
+/* We don't include regexp.h here because of the macros it requires, and
+ because it now contains an unconditional #warning. */
+
+#include <regex.h>
/* Define the variables used for the interface. */
char *loc1;
@@ -32,7 +34,6 @@ char *locs;
found in the buffer starting at EXPBUF. `loc1' will return the
first character matched and `loc2' points to the next unmatched
character. */
-extern int __step (const char *string, const char *expbuf);
int
__step (const char *string, const char *expbuf)
{
@@ -55,7 +56,6 @@ weak_alias (__step, step)
/* Match the beginning of STRING with the compiled regular expression
in EXPBUF. If the match is successful `loc2' will contain the
position of the first unmatched character. */
-extern int __advance (const char *string, const char *expbuf);
int
__advance (const char *string, const char *expbuf)
{
diff --git a/misc/regexp.h b/misc/regexp.h
index 3fc0bc5..f8eefe4 100644
--- a/misc/regexp.h
+++ b/misc/regexp.h
@@ -19,14 +19,18 @@
#ifndef _REGEXP_H
#define _REGEXP_H 1
-/* The contents of this header file was first standardized in X/Open
+/* The contents of this header file were first standardized in X/Open
System Interface and Headers Issue 2, originally coming from SysV.
- In issue 4, version 2, it is marked as TO BE WITDRAWN, and it has
- been withdrawn in SUSv3.
+ In issue 4, version 2, it was marked as TO BE WITHDRAWN, and it was
+ duly withdrawn in issue 6.
- This code shouldn't be used in any newly written code. It is
- included only for compatibility reasons. Use the POSIX definition
- in <regex.h> for portable applications and a reasonable interface. */
+ This header is provided only for backward compatibility, and it will
+ be removed in the next release of GNU libc. New code should use
+ <regex.h> instead. */
+
+#warning "regexp.h is obsolete and buggy."
+#warning "It will be removed in the next release of GNU libc."
+#warning "Please update your code to use regex.h instead (no trailing
'p')."
#include <features.h>
#include <alloca.h>
@@ -182,19 +186,19 @@ compile (char *__restrict instring, char
*__restrict expbuf,
case REG_ERPAREN:
default:
/* There is no matching error code. */
- RETURN (36);
+ ERROR (36);
case REG_ESUBREG:
- RETURN (25);
+ ERROR (25);
case REG_EBRACK:
- RETURN (49);
+ ERROR (49);
case REG_EPAREN:
- RETURN (42);
+ ERROR (42);
case REG_EBRACE:
- RETURN (44);
+ ERROR (44);
case REG_BADBR:
- RETURN (46);
+ ERROR (46);
case REG_ERANGE:
- RETURN (11);
+ ERROR (11);
case REG_ESPACE:
case REG_ESIZE:
ERROR (50);
--
2.1.4
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [PATCH] Kill regexp.h
2015-07-15 13:56 ` Zack Weinberg
@ 2015-07-21 18:09 ` Zack Weinberg
2015-07-21 23:59 ` Mike Frysinger
` (2 subsequent siblings)
3 siblings, 0 replies; 47+ messages in thread
From: Zack Weinberg @ 2015-07-21 18:09 UTC (permalink / raw)
To: Carlos O'Donell; +Cc: libc-alpha
[-- Attachment #1: Type: text/plain, Size: 5252 bytes --]
Ping?
On 07/15/2015 09:56 AM, Zack Weinberg wrote:
> On 07/15/2015 09:12 AM, Carlos O'Donell wrote:
>> On 07/14/2015 08:20 PM, Zack Weinberg wrote:
>>>> At a high level your patch looks OK, it makes sense to deprecate
>>>> these interfaces, but I think we should to do this in two stages.
>>>> Add warnings and then remove.
>>>
>>> Hm. If we do that then I would feel obliged to fix the bugs in the
>>> header in phase one. I'm not sure that's worth doing...
>>
>> Worth is certainly in the eye of the beholder. How would you feel if
>> you were a user of this interface?
>
> So thinking about this a bit more, would you take this patch for 2.22?
> All it does is add #warning directives and correct the RETURN .vs. ERROR
> thing (leaving the memory-allocation issue reported in Debian).
>
> ---
> * regexp.h: Add unconditional #warning stating that this header
> will be removed soon. Revise banner comment to match.
> (compile): Consistently use ERROR instead of RETURN to report
> errors (partial fix for bz#18681).
> * regexp.c: Don't include regexp.h.
> ---
> NEWS | 6 ++++++
> misc/regexp.c | 8 ++++----
> misc/regexp.h | 30 +++++++++++++++++-------------
> 3 files changed, 27 insertions(+), 17 deletions(-)
>
> diff --git a/NEWS b/NEWS
> index f91edc7..d9cf4a7 100644
> --- a/NEWS
> +++ b/NEWS
> @@ -71,6 +71,12 @@ Version 2.22
> compliance. The new implementation fixes the following long-standing
> issues: BZ#6544, BZ#11216, BZ#12836, BZ#13151, BZ#13152, and
> BZ#14292. The
> old implementation is still present for use be by existing binaries.
> +
> +* The header <regexp.h> is deprecated, and will be removed in a future
> + release. (It was removed from POSIX long ago, and it has bugs we cannot
> + easily fix. See BZ#18681 for more details.) We suspect that no one has
> + used this header in many years, but if you have code that does use it,
> + you will need to update it to use <regex.h> instead.
> \f
> Version 2.21
>
> diff --git a/misc/regexp.c b/misc/regexp.c
> index 3b83203..d389804 100644
> --- a/misc/regexp.c
> +++ b/misc/regexp.c
> @@ -17,8 +17,10 @@
> License along with the GNU C Library; if not, see
> <http://www.gnu.org/licenses/>. */
>
> -#define __DO_NOT_DEFINE_COMPILE
> -#include <regexp.h>
> +/* We don't include regexp.h here because of the macros it requires, and
> + because it now contains an unconditional #warning. */
> +
> +#include <regex.h>
>
> /* Define the variables used for the interface. */
> char *loc1;
> @@ -32,7 +34,6 @@ char *locs;
> found in the buffer starting at EXPBUF. `loc1' will return the
> first character matched and `loc2' points to the next unmatched
> character. */
> -extern int __step (const char *string, const char *expbuf);
> int
> __step (const char *string, const char *expbuf)
> {
> @@ -55,7 +56,6 @@ weak_alias (__step, step)
> /* Match the beginning of STRING with the compiled regular expression
> in EXPBUF. If the match is successful `loc2' will contain the
> position of the first unmatched character. */
> -extern int __advance (const char *string, const char *expbuf);
> int
> __advance (const char *string, const char *expbuf)
> {
> diff --git a/misc/regexp.h b/misc/regexp.h
> index 3fc0bc5..f8eefe4 100644
> --- a/misc/regexp.h
> +++ b/misc/regexp.h
> @@ -19,14 +19,18 @@
> #ifndef _REGEXP_H
> #define _REGEXP_H 1
>
> -/* The contents of this header file was first standardized in X/Open
> +/* The contents of this header file were first standardized in X/Open
> System Interface and Headers Issue 2, originally coming from SysV.
> - In issue 4, version 2, it is marked as TO BE WITDRAWN, and it has
> - been withdrawn in SUSv3.
> + In issue 4, version 2, it was marked as TO BE WITHDRAWN, and it was
> + duly withdrawn in issue 6.
>
> - This code shouldn't be used in any newly written code. It is
> - included only for compatibility reasons. Use the POSIX definition
> - in <regex.h> for portable applications and a reasonable interface. */
> + This header is provided only for backward compatibility, and it will
> + be removed in the next release of GNU libc. New code should use
> + <regex.h> instead. */
> +
> +#warning "regexp.h is obsolete and buggy."
> +#warning "It will be removed in the next release of GNU libc."
> +#warning "Please update your code to use regex.h instead (no trailing
> 'p')."
>
> #include <features.h>
> #include <alloca.h>
> @@ -182,19 +186,19 @@ compile (char *__restrict instring, char
> *__restrict expbuf,
> case REG_ERPAREN:
> default:
> /* There is no matching error code. */
> - RETURN (36);
> + ERROR (36);
> case REG_ESUBREG:
> - RETURN (25);
> + ERROR (25);
> case REG_EBRACK:
> - RETURN (49);
> + ERROR (49);
> case REG_EPAREN:
> - RETURN (42);
> + ERROR (42);
> case REG_EBRACE:
> - RETURN (44);
> + ERROR (44);
> case REG_BADBR:
> - RETURN (46);
> + ERROR (46);
> case REG_ERANGE:
> - RETURN (11);
> + ERROR (11);
> case REG_ESPACE:
> case REG_ESIZE:
> ERROR (50);
>
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [PATCH] Kill regexp.h
2015-07-15 13:56 ` Zack Weinberg
2015-07-21 18:09 ` Zack Weinberg
@ 2015-07-21 23:59 ` Mike Frysinger
2015-07-25 3:45 ` Carlos O'Donell
2015-07-25 3:59 ` Carlos O'Donell
3 siblings, 0 replies; 47+ messages in thread
From: Mike Frysinger @ 2015-07-21 23:59 UTC (permalink / raw)
To: Zack Weinberg; +Cc: Carlos O'Donell, libc-alpha
[-- Attachment #1: Type: text/plain, Size: 78 bytes --]
patch looks fine to me, but whether it makes it in 2.22 is up to Carlos
-mike
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [PATCH] Kill regexp.h
2015-07-15 13:56 ` Zack Weinberg
2015-07-21 18:09 ` Zack Weinberg
2015-07-21 23:59 ` Mike Frysinger
@ 2015-07-25 3:45 ` Carlos O'Donell
2015-07-25 3:59 ` Carlos O'Donell
3 siblings, 0 replies; 47+ messages in thread
From: Carlos O'Donell @ 2015-07-25 3:45 UTC (permalink / raw)
To: Zack Weinberg; +Cc: libc-alpha
On 07/15/2015 09:56 AM, Zack Weinberg wrote:
> On 07/15/2015 09:12 AM, Carlos O'Donell wrote:
>> On 07/14/2015 08:20 PM, Zack Weinberg wrote:
>>>> At a high level your patch looks OK, it makes sense to deprecate
>>>> these interfaces, but I think we should to do this in two stages.
>>>> Add warnings and then remove.
>>>
>>> Hm. If we do that then I would feel obliged to fix the bugs in the
>>> header in phase one. I'm not sure that's worth doing...
>>
>> Worth is certainly in the eye of the beholder. How would you feel if
>> you were a user of this interface?
>
> So thinking about this a bit more, would you take this patch for 2.22?
> All it does is add #warning directives and correct the RETURN .vs. ERROR
> thing (leaving the memory-allocation issue reported in Debian).
Maybe, but only because I'd like someone to review it.
I *may* get to reviewing it and push the patch myself,
but I can't promise that, otherwise we'll get to it in
2.23.
I apologize if that seems lame. We need more reviewers.
c.
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [PATCH] Kill regexp.h
2015-07-15 13:56 ` Zack Weinberg
` (2 preceding siblings ...)
2015-07-25 3:45 ` Carlos O'Donell
@ 2015-07-25 3:59 ` Carlos O'Donell
2015-07-25 14:42 ` Zack Weinberg
3 siblings, 1 reply; 47+ messages in thread
From: Carlos O'Donell @ 2015-07-25 3:59 UTC (permalink / raw)
To: Zack Weinberg; +Cc: libc-alpha
On 07/15/2015 09:56 AM, Zack Weinberg wrote:
> On 07/15/2015 09:12 AM, Carlos O'Donell wrote:
>> On 07/14/2015 08:20 PM, Zack Weinberg wrote:
>>>> At a high level your patch looks OK, it makes sense to deprecate
>>>> these interfaces, but I think we should to do this in two stages.
>>>> Add warnings and then remove.
>>>
>>> Hm. If we do that then I would feel obliged to fix the bugs in the
>>> header in phase one. I'm not sure that's worth doing...
>>
>> Worth is certainly in the eye of the beholder. How would you feel if
>> you were a user of this interface?
>
> So thinking about this a bit more, would you take this patch for 2.22?
> All it does is add #warning directives and correct the RETURN .vs. ERROR
> thing (leaving the memory-allocation issue reported in Debian).
>
> ---
> * regexp.h: Add unconditional #warning stating that this header
> will be removed soon. Revise banner comment to match.
> (compile): Consistently use ERROR instead of RETURN to report
> errors (partial fix for bz#18681).
> * regexp.c: Don't include regexp.h.
> ---
> NEWS | 6 ++++++
> misc/regexp.c | 8 ++++----
> misc/regexp.h | 30 +++++++++++++++++-------------
> 3 files changed, 27 insertions(+), 17 deletions(-)
>
> diff --git a/NEWS b/NEWS
> index f91edc7..d9cf4a7 100644
> --- a/NEWS
> +++ b/NEWS
> @@ -71,6 +71,12 @@ Version 2.22
> compliance. The new implementation fixes the following long-standing
> issues: BZ#6544, BZ#11216, BZ#12836, BZ#13151, BZ#13152, and
> BZ#14292. The
> old implementation is still present for use be by existing binaries.
> +
> +* The header <regexp.h> is deprecated, and will be removed in a future
> + release. (It was removed from POSIX long ago, and it has bugs we cannot
> + easily fix. See BZ#18681 for more details.) We suspect that no one has
> + used this header in many years, but if you have code that does use it,
> + you will need to update it to use <regex.h> instead.
Suggest:
* The header <regexp.h> is deprecated, and will be removed in a future
release. As of 1997, SUSv2 marked this interface as legacy and recommended
applications migrate. Application developers are expected to update to
<regex.h> instead. Use of the <regexp.h> header will trigger a
deprecation warning.
> \f
> Version 2.21
>
> diff --git a/misc/regexp.c b/misc/regexp.c
> index 3b83203..d389804 100644
> --- a/misc/regexp.c
> +++ b/misc/regexp.c
> @@ -17,8 +17,10 @@
> License along with the GNU C Library; if not, see
> <http://www.gnu.org/licenses/>. */
>
> -#define __DO_NOT_DEFINE_COMPILE
> -#include <regexp.h>
> +/* We don't include regexp.h here because of the macros it requires, and
> + because it now contains an unconditional #warning. */
> +
> +#include <regex.h>
>
> /* Define the variables used for the interface. */
> char *loc1;
> @@ -32,7 +34,6 @@ char *locs;
> found in the buffer starting at EXPBUF. `loc1' will return the
> first character matched and `loc2' points to the next unmatched
> character. */
> -extern int __step (const char *string, const char *expbuf);
> int
> __step (const char *string, const char *expbuf)
> {
> @@ -55,7 +56,6 @@ weak_alias (__step, step)
> /* Match the beginning of STRING with the compiled regular expression
> in EXPBUF. If the match is successful `loc2' will contain the
> position of the first unmatched character. */
> -extern int __advance (const char *string, const char *expbuf);
> int
> __advance (const char *string, const char *expbuf)
> {
> diff --git a/misc/regexp.h b/misc/regexp.h
> index 3fc0bc5..f8eefe4 100644
> --- a/misc/regexp.h
> +++ b/misc/regexp.h
> @@ -19,14 +19,18 @@
> #ifndef _REGEXP_H
> #define _REGEXP_H 1
>
> -/* The contents of this header file was first standardized in X/Open
> +/* The contents of this header file were first standardized in X/Open
> System Interface and Headers Issue 2, originally coming from SysV.
> - In issue 4, version 2, it is marked as TO BE WITDRAWN, and it has
> - been withdrawn in SUSv3.
> + In issue 4, version 2, it was marked as TO BE WITHDRAWN, and it was
> + duly withdrawn in issue 6.
Issue 6 of what? I assume you mean POSIX issue 6? Please clarify.
>
> - This code shouldn't be used in any newly written code. It is
> - included only for compatibility reasons. Use the POSIX definition
> - in <regex.h> for portable applications and a reasonable interface. */
> + This header is provided only for backward compatibility, and it will
> + be removed in the next release of GNU libc. New code should use
s/GNU libc/GNU C Library/g
> + <regex.h> instead. */
> +
> +#warning "regexp.h is obsolete and buggy."
> +#warning "It will be removed in the next release of GNU libc."
> +#warning "Please update your code to use regex.h instead (no trailing
> 'p')."
Suggest:
#warning "Use of the <regexp.h> header is deprecated."
#warning "It will be removed in the next release of the GNU C Library."
#warning "Please use <regex.h> instead (no trailing 'p')"
>
> #include <features.h>
> #include <alloca.h>
> @@ -182,19 +186,19 @@ compile (char *__restrict instring, char
> *__restrict expbuf,
> case REG_ERPAREN:
> default:
> /* There is no matching error code. */
> - RETURN (36);
> + ERROR (36);
> case REG_ESUBREG:
> - RETURN (25);
> + ERROR (25);
> case REG_EBRACK:
> - RETURN (49);
> + ERROR (49);
> case REG_EPAREN:
> - RETURN (42);
> + ERROR (42);
> case REG_EBRACE:
> - RETURN (44);
> + ERROR (44);
> case REG_BADBR:
> - RETURN (46);
> + ERROR (46);
> case REG_ERANGE:
> - RETURN (11);
> + ERROR (11);
> case REG_ESPACE:
> case REG_ESIZE:
> ERROR (50);
OK.
Can you do a v3 with those changes for a final check?
patchwork workflow is easier that way.
Cheers,
Carlos.
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [PATCH] Kill regexp.h
2015-07-25 3:59 ` Carlos O'Donell
@ 2015-07-25 14:42 ` Zack Weinberg
2015-07-27 15:07 ` Joseph Myers
0 siblings, 1 reply; 47+ messages in thread
From: Zack Weinberg @ 2015-07-25 14:42 UTC (permalink / raw)
To: Carlos O'Donell; +Cc: libc-alpha
[-- Attachment #1: Type: text/plain, Size: 3968 bytes --]
On 07/24/2015 11:59 PM, Carlos O'Donell wrote:
> On 07/15/2015 09:56 AM, Zack Weinberg wrote:
>> +* The header <regexp.h> is deprecated, and will be removed in a future
>> + release. (It was removed from POSIX long ago, and it has bugs we cannot
>> + easily fix. See BZ#18681 for more details.) We suspect that no one has
>> + used this header in many years, but if you have code that does use it,
>> + you will need to update it to use <regex.h> instead.
>
> Suggest:
>
> * The header <regexp.h> is deprecated, and will be removed in a future
> release. As of 1997, SUSv2 marked this interface as legacy and recommended
> applications migrate. Application developers are expected to update to
> <regex.h> instead. Use of the <regexp.h> header will trigger a
> deprecation warning.
I'd like to keep the bug number in there, how's this?
* The header <regexp.h> is deprecated, and will be removed in a future
release. Use of this header will trigger a deprecation warning.
Application developers should update their code to use <regex.h>
instead.
This header was formerly part of SUSv2, but was deprecated in 1997 and
removed from the standard in 2001. Also, the glibc implementation
leaks memory. See BZ#18681 for more details.
>> -/* The contents of this header file was first standardized in X/Open
>> +/* The contents of this header file were first standardized in X/Open
>> System Interface and Headers Issue 2, originally coming from SysV.
>> - In issue 4, version 2, it is marked as TO BE WITDRAWN, and it has
>> - been withdrawn in SUSv3.
>> + In issue 4, version 2, it was marked as TO BE WITHDRAWN, and it was
>> + duly withdrawn in issue 6.
>
> Issue 6 of what? I assume you mean POSIX issue 6? Please clarify.
Yes, POSIX issue 6. ("The Open Group Base Specifications Issue 6, IEEE
Std 1003.1, 2004 Edition", which is the version more commonly known as
POSIX.1-2001.) I tried to do some more research; unfortunately, the
*previous* version of SUS (corresponding to POSIX.1-1996) identifies
itself as "The Single Unix Specification, Version 2". I have not been
able to pin down exactly what "issue 4, version 2" was, or find an
"issue 5" anywhere; regexp.h is completely gone from "issue 6" and there
is no overall change log; "version 2" already says
NAME
regexp.h - regular-expression declarations (LEGACY)
...
APPLICATION USAGE
This header is kept for historical reasons. New applications should
use the regcomp(), regexec(), regerror() and regfree() functions,
and the <regex.h> header ...
and I would have to give them money to get my hands on "version 1."
Given all that, how about this wording?
+/* The contents of this header file were standardized in the
+ Single Unix Specification, Version 2 (1997) but marked as
+ LEGACY; new applications were already being encouraged to
+ use <regex.h> instead. POSIX.1-2001 removed this header. */
>> + This header is provided only for backward compatibility, and it will
>> + be removed in the next release of GNU libc. New code should use
>
> s/GNU libc/GNU C Library/g
OK.
>> + <regex.h> instead. */
>> +
>> +#warning "regexp.h is obsolete and buggy."
>> +#warning "It will be removed in the next release of GNU libc."
>> +#warning "Please update your code to use regex.h instead (no trailing
>> 'p')."
>
> Suggest:
>
> #warning "Use of the <regexp.h> header is deprecated."
> #warning "It will be removed in the next release of the GNU C Library."
> #warning "Please use <regex.h> instead (no trailing 'p')"
Actually, how about just
#warning "<regexp.h> will be removed in the next release of the GNU C
Library."
#warning "Please update your code to use regex.h instead (no trailing 'p')."
> Can you do a v3 with those changes for a final check?
Coming up as soon as I complete some smoke tests.
zw
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [PATCH] Kill regexp.h
2015-07-25 14:42 ` Zack Weinberg
@ 2015-07-27 15:07 ` Joseph Myers
2015-07-27 15:28 ` Zack Weinberg
0 siblings, 1 reply; 47+ messages in thread
From: Joseph Myers @ 2015-07-27 15:07 UTC (permalink / raw)
To: Zack Weinberg; +Cc: Carlos O'Donell, libc-alpha
On Sat, 25 Jul 2015, Zack Weinberg wrote:
> itself as "The Single Unix Specification, Version 2". I have not been
> able to pin down exactly what "issue 4, version 2" was, or find an
See http://archive.opengroup.org/publications/archive/CDROM/ (specifically
C434, C435, C436, C438; there are also corrigenda U038 U045 U052 U053
available separately somewhere).
> "issue 5" anywhere; regexp.h is completely gone from "issue 6" and there
> is no overall change log; "version 2" already says
Issue 5 is the Single Unix Specification, Version 2.
--
Joseph S. Myers
joseph@codesourcery.com
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [PATCH] Kill regexp.h
2015-07-27 15:07 ` Joseph Myers
@ 2015-07-27 15:28 ` Zack Weinberg
2015-07-27 15:45 ` Joseph Myers
0 siblings, 1 reply; 47+ messages in thread
From: Zack Weinberg @ 2015-07-27 15:28 UTC (permalink / raw)
To: Joseph Myers; +Cc: Carlos O'Donell, libc-alpha
On Mon, Jul 27, 2015 at 11:07 AM, Joseph Myers <joseph@codesourcery.com> wrote:
> On Sat, 25 Jul 2015, Zack Weinberg wrote:
>
>> itself as "The Single Unix Specification, Version 2". I have not been
>> able to pin down exactly what "issue 4, version 2" was, or find an
>
> See http://archive.opengroup.org/publications/archive/CDROM/ (specifically
> C434, C435, C436, C438; there are also corrigenda U038 U045 U052 U053
> available separately somewhere).
Thanks. Looking at those documents, the release history seems to be
System V Release 2 (1984) (regexp.h invented)
Issue 3 (????) (regexp.h standardized)
Issue 4, version 2 (1994) (regexp.h marked TO BE WITHDRAWN)
Issue 5 = Version 2 (1997) (no change)
Issue 6 = POSIX.1-2001 (regexp.h deleted)
probably with a bunch of intermediate editions in there, and of course
the POSIX release history only converges with the SUS release history
at -2001. I hope you can see why I was confused.
So for perfect historical accuracy the comment should read
/* The contents of this header file were standardized in the
Single Unix Specification, Issue 3. In Issue 4 (1994) the
header was marked as TO BE WITHDRAWN and new applications
were encouraged to use <regex.h> instead. Issue 6
(aka POSIX.1-2001) removed the header entirely. */
... and it would be nice to pin down a year for Issue 3 but I can't find one.
zw
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [PATCH] Kill regexp.h
2015-07-27 15:28 ` Zack Weinberg
@ 2015-07-27 15:45 ` Joseph Myers
0 siblings, 0 replies; 47+ messages in thread
From: Joseph Myers @ 2015-07-27 15:45 UTC (permalink / raw)
To: Zack Weinberg; +Cc: Carlos O'Donell, libc-alpha
On Mon, 27 Jul 2015, Zack Weinberg wrote:
> ... and it would be nice to pin down a year for Issue 3 but I can't find one.
<http://pubs.opengroup.org/onlinepubs/009604499/frontmatter/refdocs.html>
says "1988, 1989, February 1992" (though all the individual component
documents are listed with "January 1989" as the first date, so I'm not
sure where 1988 comes in).
--
Joseph S. Myers
joseph@codesourcery.com
^ permalink raw reply [flat|nested] 47+ messages in thread
* [2.23 PATCH] Desupport regexp.h (bug 18681)
@ 2015-08-05 15:21 ` Zack Weinberg
2015-08-06 2:40 ` Mike Frysinger
2015-08-17 8:50 ` Stefan Liebler
0 siblings, 2 replies; 47+ messages in thread
From: Zack Weinberg @ 2015-08-05 15:21 UTC (permalink / raw)
To: libc-alpha
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
I posted this a couple weeks ago, but now that the branch has been
cut, `SHLIB_COMPAT(GLIBC_2_0, GLIBC_2_23)` compiles, so I've actually
tested it. ;-) Also, I merged in the corrections to NEWS and the
comment at the top of regexp.h, which I posted separately for the
2.22 branch. And hopefully it will not get mangled this time.
I can see two ways to proceed with this patch. First is just to go
ahead and land it now, and hope that if it breaks someone, they will
tell us about it during the 2.23 development cycle. Second is to
attempt to search for code it will break, e.g. with a Debian archive
rebuild or a broad-spectrum code-search service. I did try the latter
but was not able to find one that would distinguish *this* <regexp.h>
from one provided by the application, and there are lots of those.
zw
* misc/regexp.h: This interface is no longer supported.
Remove all contents, leaving only an #error directive.
* misc/regexp.c (loc1, loc2, locs, step, advance):
Demote to compatibility symbols.
- ---
NEWS | 8 ++-
misc/regexp.c | 29 ++++++--
misc/regexp.h | 212 +++-------------------------------------------------------
3 files changed, 36 insertions(+), 213 deletions(-)
diff --git a/NEWS b/NEWS
index 6e0726c..b3a0f2e 100644
- --- a/NEWS
+++ b/NEWS
@@ -8,7 +8,11 @@ using `glibc' in the "product" field.
Version 2.23
* The following bugs are resolved with this release:
- - 18265, 18525.
+
+ 18265, 18525, 18681.
+
+* The obsolete header <regexp.h> has been removed. Programs that require
+ this header must be updated to use <regex.h> instead.
\f
Version 2.22
@@ -89,7 +93,7 @@ Version 2.22
release. Use of this header will trigger a deprecation warning.
Application developers should update their code to use <regex.h> instead.
- - This header was formerly part of SUSv2, but was deprecated in 1997 and
+ This header was formerly part of SUS, but was deprecated in 1994 and
removed from the standard in 2001. Also, the glibc implementation
leaks memory. See BZ#18681 for more details.
\f
diff --git a/misc/regexp.c b/misc/regexp.c
index ee7d572..ef5e18b 100644
- --- a/misc/regexp.c
+++ b/misc/regexp.c
@@ -1,4 +1,4 @@
- -/* Define function and variables for the obsolete <regexp.h> interface.
+/* Compatibility symbols for the obsolete <regexp.h> interface.
Copyright (C) 1996-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
@@ -17,17 +17,27 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
- -/* We don't include regexp.h here because of the macros it requires, and
- - because it now contains an unconditional #warning. */
+/* regexp.h now contains only an #error directive, so it cannot be
+ used in this file.
+
+ The function that would produce an 'expbuf' to use as the second
+ argument to 'step' and 'advance' was defined only in regexp.h,
+ as its definition depended on macros defined by the user. */
#include <regex.h>
+#include <shlib-compat.h>
+
+#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_23)
/* Define the variables used for the interface. */
char *loc1;
char *loc2;
+compat_symbol (libc, loc1, loc1, GLIBC_2_0);
+compat_symbol (libc, loc2, loc2, GLIBC_2_0);
/* Although we do not support the use we define this variable as well. */
char *locs;
+compat_symbol (libc, locs, locs, GLIBC_2_0);
/* Find the next match in STRING. The compiled regular expression is
@@ -35,7 +45,8 @@ char *locs;
first character matched and `loc2' points to the next unmatched
character. */
int
- -__step (const char *string, const char *expbuf)
+weak_function attribute_compat_text_section
+step (const char *string, const char *expbuf)
{
regmatch_t match; /* We only need info about the full match. */
@@ -50,14 +61,15 @@ __step (const char *string, const char *expbuf)
loc2 = (char *) string + match.rm_eo;
return 1;
}
- -weak_alias (__step, step)
+compat_symbol (libc, step, step, GLIBC_2_0);
/* Match the beginning of STRING with the compiled regular expression
in EXPBUF. If the match is successful `loc2' will contain the
position of the first unmatched character. */
int
- -__advance (const char *string, const char *expbuf)
+weak_function attribute_compat_text_section
+advance (const char *string, const char *expbuf)
{
regmatch_t match; /* We only need info about the full match. */
@@ -74,4 +86,7 @@ __advance (const char *string, const char *expbuf)
loc2 = (char *) string + match.rm_eo;
return 1;
}
- -weak_alias (__advance, advance)
+compat_symbol (libc, advance, advance, GLIBC_2_0);
+
+
+#endif /* SHLIB_COMPAT (2.0, 2.23) */
diff --git a/misc/regexp.h b/misc/regexp.h
index 3460989..9f5c413 100644
- --- a/misc/regexp.h
+++ b/misc/regexp.h
@@ -19,211 +19,15 @@
#ifndef _REGEXP_H
#define _REGEXP_H 1
- -/* The contents of this header file were standardized in the
- - Single Unix Specification, Version 2 (1997) but marked as
- - LEGACY; new applications were already being encouraged to
- - use <regex.h> instead. POSIX.1-2001 removed this header.
+/* The contents of this header file were originally standardized in
+ the Single Unix Specification, Issue 3 (1992). In Issue 4 (1994)
+ the header was marked as TO BE WITHDRAWN, and new applications
+ were encouraged to use <regex.h> instead. It was officially
+ withdrawn from the standard in Issue 6 (aka POSIX.1-2001).
- - This header is provided only for backward compatibility.
- - It will be removed in the next release of the GNU C Library.
- - New code should use <regex.h> instead. */
+ The GNU C Library provided this header through version 2.22. */
- -#warning "<regexp.h> will be removed in the next release of the GNU C Library."
- -#warning "Please update your code to use <regex.h> instead (no trailing 'p')."
- -
- -#include <features.h>
- -#include <alloca.h>
- -#include <regex.h>
- -#include <stdlib.h>
- -#include <string.h>
- -
- -/* The implementation provided here emulates the needed functionality
- - by mapping to the POSIX regular expression matcher. The interface
- - for the here included function is weird (this really is a harmless
- - word).
- -
- - The user has to provide six macros before this header file can be
- - included:
- -
- - INIT Declarations vor variables which can be used by the
- - other macros.
- -
- - GETC() Return the value of the next character in the regular
- - expression pattern. Successive calls should return
- - successive characters.
- -
- - PEEKC() Return the value of the next character in the regular
- - expression pattern. Immediately successive calls to
- - PEEKC() should return the same character which should
- - also be the next character returned by GETC().
- -
- - UNGETC(c) Cause `c' to be returned by the next call to GETC() and
- - PEEKC().
- -
- - RETURN(ptr) Used for normal exit of the `compile' function. `ptr'
- - is a pointer to the character after the last character of
- - the compiled regular expression.
- -
- - ERROR(val) Used for abnormal return from `compile'. `val' is the
- - error number. The error codes are:
- - 11 Range endpoint too large.
- - 16 Bad number.
- - 25 \digit out of range.
- - 36 Illegal or missing delimiter.
- - 41 No remembered search string.
- - 42 \( \) imbalance.
- - 43 Too many \(.
- - 44 More tan two numbers given in \{ \}.
- - 45 } expected after \.
- - 46 First number exceeds second in \{ \}.
- - 49 [ ] imbalance.
- - 50 Regular expression overflow.
- -
- - */
- -
- -__BEGIN_DECLS
- -
- -/* Interface variables. They contain the results of the successful
- - calls to `setp' and `advance'. */
- -extern char *loc1;
- -extern char *loc2;
- -
- -/* The use of this variable in the `advance' function is not
- - supported. */
- -extern char *locs;
- -
- -
- -#ifndef __DO_NOT_DEFINE_COMPILE
- -/* Get and compile the user supplied pattern up to end of line or
- - string or until EOF is seen, whatever happens first. The result is
- - placed in the buffer starting at EXPBUF and delimited by ENDBUF.
- -
- - This function cannot be defined in the libc itself since it depends
- - on the macros. */
- -char *
- -compile (char *__restrict instring, char *__restrict expbuf,
- - const char *__restrict endbuf, int eof)
- -{
- - char *__input_buffer = NULL;
- - size_t __input_size = 0;
- - size_t __current_size = 0;
- - int __ch;
- - int __error;
- - INIT
- -
- - /* Align the expression buffer according to the needs for an object
- - of type `regex_t'. Then check for minimum size of the buffer for
- - the compiled regular expression. */
- - regex_t *__expr_ptr;
- -# if defined __GNUC__ && __GNUC__ >= 2
- - const size_t __req = __alignof__ (regex_t *);
- -# else
- - /* How shall we find out? We simply guess it and can change it is
- - this really proofs to be wrong. */
- - const size_t __req = 8;
- -# endif
- - expbuf += __req;
- - expbuf -= (expbuf - ((char *) 0)) % __req;
- - if (endbuf < expbuf + sizeof (regex_t))
- - {
- - ERROR (50);
- - }
- - __expr_ptr = (regex_t *) expbuf;
- - /* The remaining space in the buffer can be used for the compiled
- - pattern. */
- - __expr_ptr->__REPB_PREFIX (buffer) = expbuf + sizeof (regex_t);
- - __expr_ptr->__REPB_PREFIX (allocated)
- - = endbuf - (char *) __expr_ptr->__REPB_PREFIX (buffer);
- -
- - while ((__ch = (GETC ())) != eof)
- - {
- - if (__ch == '\0' || __ch == '\n')
- - {
- - UNGETC (__ch);
- - break;
- - }
- -
- - if (__current_size + 1 >= __input_size)
- - {
- - size_t __new_size = __input_size ? 2 * __input_size : 128;
- - char *__new_room = (char *) alloca (__new_size);
- - /* See whether we can use the old buffer. */
- - if (__new_room + __new_size == __input_buffer)
- - {
- - __input_size += __new_size;
- - __input_buffer = (char *) memcpy (__new_room, __input_buffer,
- - __current_size);
- - }
- - else if (__input_buffer + __input_size == __new_room)
- - __input_size += __new_size;
- - else
- - {
- - __input_size = __new_size;
- - __input_buffer = (char *) memcpy (__new_room, __input_buffer,
- - __current_size);
- - }
- - }
- - __input_buffer[__current_size++] = __ch;
- - }
- - if (__current_size)
- - __input_buffer[__current_size++] = '\0';
- - else
- - __input_buffer = "";
- -
- - /* Now compile the pattern. */
- - __error = regcomp (__expr_ptr, __input_buffer, REG_NEWLINE);
- - if (__error != 0)
- - /* Oh well, we have to translate POSIX error codes. */
- - switch (__error)
- - {
- - case REG_BADPAT:
- - case REG_ECOLLATE:
- - case REG_ECTYPE:
- - case REG_EESCAPE:
- - case REG_BADRPT:
- - case REG_EEND:
- - case REG_ERPAREN:
- - default:
- - /* There is no matching error code. */
- - ERROR (36);
- - case REG_ESUBREG:
- - ERROR (25);
- - case REG_EBRACK:
- - ERROR (49);
- - case REG_EPAREN:
- - ERROR (42);
- - case REG_EBRACE:
- - ERROR (44);
- - case REG_BADBR:
- - ERROR (46);
- - case REG_ERANGE:
- - ERROR (11);
- - case REG_ESPACE:
- - case REG_ESIZE:
- - ERROR (50);
- - }
- -
- - /* Everything is ok. */
- - RETURN ((char *) (__expr_ptr->__REPB_PREFIX (buffer)
- - + __expr_ptr->__REPB_PREFIX (used)));
- -}
- -#endif
- -
- -
- -/* Find the next match in STRING. The compiled regular expression is
- - found in the buffer starting at EXPBUF. `loc1' will return the
- - first character matched and `loc2' points to the next unmatched
- - character. */
- -extern int step (const char *__restrict __string,
- - const char *__restrict __expbuf) __THROW;
- -
- -/* Match the beginning of STRING with the compiled regular expression
- - in EXPBUF. If the match is successful `loc2' will contain the
- - position of the first unmatched character. */
- -extern int advance (const char *__restrict __string,
- - const char *__restrict __expbuf) __THROW;
- -
- -
- -__END_DECLS
+#error "The GNU C Library no longer implements <regexp.h>."
+#error "Please update your code to use <regex.h> instead (no trailing 'p')."
#endif /* regexp.h */
- --
2.5.0
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2
iQIcBAEBCAAGBQJVwik2AAoJEJH8wytnaapkPyUP/1mEVmSyTkoia9fvVl1GI+6w
A2pK+58hN8jsCHhp4YWSWcMCsTdKWGqQXbExFmJHeDrlPs+E6h60LtKrdaIbR343
ucdgXRB6F6bvq0vuNIVuvFqTCgj+oMi2Nh4eu8mmc+Om+UmLqsKiopulNQ3AGEXN
jqDV+3dYnbC4ydtP8C5xdiEfpovv1uJEETWmWKOC8KkRwDHxP5tNa5Qr5zW8b+Ky
TaVVbRYANAzqKQXoolgJ54ohem1sxpsJ6BtL+/YHnBAVcctPOpZ3Ci3jaZ72/ZDf
J4rVuLZHolqULiqQoSeItRlTSSzJZKxd/XDJlhTSvnoLAes01DdvhEZtELLHYoMR
rOhYg03cvGU8g8O0WBEVzXr0xXLbV12mUcZo9vF+ftDvF5DEhqWssps1N5ScYanL
FGibVDqWJCHg8krsJvVq0+vTofydYjl8ctZpBZKNjTG52WJC9tN2Q0jF73Jqv98T
sR7SRc0sxIaO5nUnGMSYOW3e7S+Hxb5plicmCJEWW6ATaVqbM6062Uldr4keQzlP
EDyCfBDpBXWxSHj4LKYau08ODMqvYtNPEqtx8tHPXN62yT+qJ6DV352HerdmSP6y
Q4p73oifmG4nJFPMJ4BKo1GMJXqmusNn8LVe5wGiU+iPR6+LjciA86Oi4ORa7msl
o/TRGNV931M7ohc3uZID
=7aEz
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 47+ messages in thread
* [2.22 PATCH] Correct comments about the history of <regexp.h>.
@ 2015-08-05 15:21 ` Zack Weinberg
2015-08-06 2:37 ` Mike Frysinger
0 siblings, 1 reply; 47+ messages in thread
From: Zack Weinberg @ 2015-08-05 15:21 UTC (permalink / raw)
To: libc-alpha
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
In the "Kill regexp.h" thread, Joseph dug up more accurate information
about exactly which editions of the Single Unix Standard included and
deprecated this header.
This only affects comments and NEWS; please consider for 2.22.
zw
* misc/regexp.h: Correct commentary about the editions of the
Single Unix Standard that included this header.
* NEWS: Likewise.
- ---
NEWS | 2 +-
misc/regexp.h | 9 +++++----
2 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/NEWS b/NEWS
index 4c31de7..43dcfdb 100644
- --- a/NEWS
+++ b/NEWS
@@ -84,7 +84,7 @@ Version 2.22
release. Use of this header will trigger a deprecation warning.
Application developers should update their code to use <regex.h> instead.
- - This header was formerly part of SUSv2, but was deprecated in 1997 and
+ This header was formerly part of SUS, but was deprecated in 1994 and
removed from the standard in 2001. Also, the glibc implementation
leaks memory. See BZ#18681 for more details.
\f
diff --git a/misc/regexp.h b/misc/regexp.h
index 3460989..42394f7 100644
- --- a/misc/regexp.h
+++ b/misc/regexp.h
@@ -19,10 +19,11 @@
#ifndef _REGEXP_H
#define _REGEXP_H 1
- -/* The contents of this header file were standardized in the
- - Single Unix Specification, Version 2 (1997) but marked as
- - LEGACY; new applications were already being encouraged to
- - use <regex.h> instead. POSIX.1-2001 removed this header.
+/* The contents of this header file were originally standardized in
+ the Single Unix Specification, Issue 3 (1992). In Issue 4 (1994)
+ the header was marked as TO BE WITHDRAWN, and new applications
+ were encouraged to use <regex.h> instead. It was officially
+ withdrawn from the standard in Issue 6 (aka POSIX.1-2001).
This header is provided only for backward compatibility.
It will be removed in the next release of the GNU C Library.
- --
2.5.0
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2
iQIcBAEBCAAGBQJVwidlAAoJEJH8wytnaapkZ6IQALc0fIj29w3IehibL/rSKXig
rjIYpxyo5+qapCTNgp2WhrPkmpyWUUWp2LNv/nJySOV0Vny/W0M7mQZhFsMmXPA5
VLEivx/u5Nnl2yhFQvfubwbRUtmB15SYRmHME8t+vOxSiYRujLLQDqoyu1hBg41K
+eCKSrCUdyIwH/43i7+Y0thlhH+dKndr9CisaBC5wATvmxdqacrCmgy1wlhGmVCd
KEx3ENJtsVF7srWvH2p3diMyEUP5ghRZ9VniEGEHssz/rburKgky104tmHN6GGK/
Wd57ry7SNVLUuwLJWqMLhCEUc91iHo0UcnmLl8Lxi0bNzVEEUhtYG42TJKysN+f0
+EcStnOj/8RIdnXaFFYsoqyyL9D4FQ6KTfGlhaNo5ok+vVKJPTlYYakkDbRotMj3
uEDZkkq9f4Lm7On4HqipzCCsDkvCaA/Lx9zxdJpii+P8mN9cMzL6WBVPQ4l9IaSS
w2QgHsC08qeTdvl5vdPYRKqawiqkgH7nX8PjVFA1ayIkL5UU3ZCwzftMxXdUrnCi
K9RDlyBf6sF0x+4kA9Jky0fOQr1wQXDcJkEaTQC00HWgS/FIyAAfv0PsGDSNz0Go
6baRxznWU7xIDdsEayHABvBx6MK5HtQn6DwS+RtakrWO5MMmCpdab8nydosHJKly
gIRpB+K9oscNHHge5ees
=OQRL
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [2.22 PATCH] Correct comments about the history of <regexp.h>.
2015-08-05 15:21 ` [2.22 PATCH] Correct comments about the history of <regexp.h> Zack Weinberg
@ 2015-08-06 2:37 ` Mike Frysinger
0 siblings, 0 replies; 47+ messages in thread
From: Mike Frysinger @ 2015-08-06 2:37 UTC (permalink / raw)
To: Zack Weinberg; +Cc: libc-alpha
[-- Attachment #1: Type: text/plain, Size: 237 bytes --]
On 05 Aug 2015 10:58, Zack Weinberg wrote:
> In the "Kill regexp.h" thread, Joseph dug up more accurate information
> about exactly which editions of the Single Unix Standard included and
> deprecated this header.
pushed, thanks!
-mike
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [2.23 PATCH] Desupport regexp.h (bug 18681)
2015-08-05 15:21 ` [2.23 PATCH] Desupport regexp.h (bug 18681) Zack Weinberg
@ 2015-08-06 2:40 ` Mike Frysinger
2015-08-07 1:16 ` Zack Weinberg
2015-08-17 8:50 ` Stefan Liebler
1 sibling, 1 reply; 47+ messages in thread
From: Mike Frysinger @ 2015-08-06 2:40 UTC (permalink / raw)
To: Zack Weinberg; +Cc: libc-alpha
[-- Attachment #1: Type: text/plain, Size: 1035 bytes --]
On 12 Jul 2015 15:27, Zack Weinberg wrote:
> I posted this a couple weeks ago, but now that the branch has been
> cut, `SHLIB_COMPAT(GLIBC_2_0, GLIBC_2_23)` compiles, so I've actually
> tested it. ;-) Also, I merged in the corrections to NEWS and the
> comment at the top of regexp.h, which I posted separately for the
> 2.22 branch. And hopefully it will not get mangled this time.
i merged the NEWS/comment correction by itself to keep the master/branch in
sync, so you'll have to rebase.
> I can see two ways to proceed with this patch. First is just to go
> ahead and land it now, and hope that if it breaks someone, they will
> tell us about it during the 2.23 development cycle. Second is to
> attempt to search for code it will break, e.g. with a Debian archive
> rebuild or a broad-spectrum code-search service. I did try the latter
> but was not able to find one that would distinguish *this* <regexp.h>
> from one provided by the application, and there are lots of those.
i'm fine with deleting the header now.
-mike
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [2.23 PATCH] Desupport regexp.h (bug 18681)
2015-08-06 2:40 ` Mike Frysinger
@ 2015-08-07 1:16 ` Zack Weinberg
2015-08-07 2:14 ` Mike Frysinger
0 siblings, 1 reply; 47+ messages in thread
From: Zack Weinberg @ 2015-08-07 1:16 UTC (permalink / raw)
To: libc-alpha
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
On 08/05/2015 10:40 PM, Mike Frysinger wrote:
> On 12 Jul 2015 15:27, Zack Weinberg wrote:
>> I posted this a couple weeks ago, but now that the branch has been
>> cut, `SHLIB_COMPAT(GLIBC_2_0, GLIBC_2_23)` compiles, so I've actually
>> tested it. ;-) Also, I merged in the corrections to NEWS and the
>> comment at the top of regexp.h, which I posted separately for the
>> 2.22 branch. And hopefully it will not get mangled this time.
>
> i merged the NEWS/comment correction by itself to keep the
> master/branch in sync, so you'll have to rebase.
OK, rebased patch follows. Thanks for the quick turnaround.
zw
* misc/regexp.h: This interface is no longer supported.
Remove all contents, leaving only an #error directive.
* misc/regexp.c (loc1, loc2, locs, step, advance):
Demote to compatibility symbols.
- ---
NEWS | 6 +-
misc/regexp.c | 29 +++++++--
misc/regexp.h | 203 +---------------------------------------------------------
3 files changed, 30 insertions(+), 208 deletions(-)
diff --git a/NEWS b/NEWS
index e3c2351..794a515 100644
- --- a/NEWS
+++ b/NEWS
@@ -8,7 +8,11 @@ using `glibc' in the "product" field.
Version 2.23
* The following bugs are resolved with this release:
- - 16519, 18265, 18525, 18647, 18661.
+
+ 16519, 18265, 18525, 18647, 18661, 18681.
+
+* The obsolete header <regexp.h> has been removed. Programs that require
+ this header must be updated to use <regex.h> instead.
\f
Version 2.22
diff --git a/misc/regexp.c b/misc/regexp.c
index ee7d572..ef5e18b 100644
- --- a/misc/regexp.c
+++ b/misc/regexp.c
@@ -1,4 +1,4 @@
- -/* Define function and variables for the obsolete <regexp.h> interface.
+/* Compatibility symbols for the obsolete <regexp.h> interface.
Copyright (C) 1996-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
@@ -17,17 +17,27 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
- -/* We don't include regexp.h here because of the macros it requires, and
- - because it now contains an unconditional #warning. */
+/* regexp.h now contains only an #error directive, so it cannot be
+ used in this file.
+
+ The function that would produce an 'expbuf' to use as the second
+ argument to 'step' and 'advance' was defined only in regexp.h,
+ as its definition depended on macros defined by the user. */
#include <regex.h>
+#include <shlib-compat.h>
+
+#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_23)
/* Define the variables used for the interface. */
char *loc1;
char *loc2;
+compat_symbol (libc, loc1, loc1, GLIBC_2_0);
+compat_symbol (libc, loc2, loc2, GLIBC_2_0);
/* Although we do not support the use we define this variable as well. */
char *locs;
+compat_symbol (libc, locs, locs, GLIBC_2_0);
/* Find the next match in STRING. The compiled regular expression is
@@ -35,7 +45,8 @@ char *locs;
first character matched and `loc2' points to the next unmatched
character. */
int
- -__step (const char *string, const char *expbuf)
+weak_function attribute_compat_text_section
+step (const char *string, const char *expbuf)
{
regmatch_t match; /* We only need info about the full match. */
@@ -50,14 +61,15 @@ __step (const char *string, const char *expbuf)
loc2 = (char *) string + match.rm_eo;
return 1;
}
- -weak_alias (__step, step)
+compat_symbol (libc, step, step, GLIBC_2_0);
/* Match the beginning of STRING with the compiled regular expression
in EXPBUF. If the match is successful `loc2' will contain the
position of the first unmatched character. */
int
- -__advance (const char *string, const char *expbuf)
+weak_function attribute_compat_text_section
+advance (const char *string, const char *expbuf)
{
regmatch_t match; /* We only need info about the full match. */
@@ -74,4 +86,7 @@ __advance (const char *string, const char *expbuf)
loc2 = (char *) string + match.rm_eo;
return 1;
}
- -weak_alias (__advance, advance)
+compat_symbol (libc, advance, advance, GLIBC_2_0);
+
+
+#endif /* SHLIB_COMPAT (2.0, 2.23) */
diff --git a/misc/regexp.h b/misc/regexp.h
index 42394f7..9f5c413 100644
- --- a/misc/regexp.h
+++ b/misc/regexp.h
@@ -25,206 +25,9 @@
were encouraged to use <regex.h> instead. It was officially
withdrawn from the standard in Issue 6 (aka POSIX.1-2001).
- - This header is provided only for backward compatibility.
- - It will be removed in the next release of the GNU C Library.
- - New code should use <regex.h> instead. */
+ The GNU C Library provided this header through version 2.22. */
- -#warning "<regexp.h> will be removed in the next release of the GNU C Library."
- -#warning "Please update your code to use <regex.h> instead (no trailing 'p')."
- -
- -#include <features.h>
- -#include <alloca.h>
- -#include <regex.h>
- -#include <stdlib.h>
- -#include <string.h>
- -
- -/* The implementation provided here emulates the needed functionality
- - by mapping to the POSIX regular expression matcher. The interface
- - for the here included function is weird (this really is a harmless
- - word).
- -
- - The user has to provide six macros before this header file can be
- - included:
- -
- - INIT Declarations vor variables which can be used by the
- - other macros.
- -
- - GETC() Return the value of the next character in the regular
- - expression pattern. Successive calls should return
- - successive characters.
- -
- - PEEKC() Return the value of the next character in the regular
- - expression pattern. Immediately successive calls to
- - PEEKC() should return the same character which should
- - also be the next character returned by GETC().
- -
- - UNGETC(c) Cause `c' to be returned by the next call to GETC() and
- - PEEKC().
- -
- - RETURN(ptr) Used for normal exit of the `compile' function. `ptr'
- - is a pointer to the character after the last character of
- - the compiled regular expression.
- -
- - ERROR(val) Used for abnormal return from `compile'. `val' is the
- - error number. The error codes are:
- - 11 Range endpoint too large.
- - 16 Bad number.
- - 25 \digit out of range.
- - 36 Illegal or missing delimiter.
- - 41 No remembered search string.
- - 42 \( \) imbalance.
- - 43 Too many \(.
- - 44 More tan two numbers given in \{ \}.
- - 45 } expected after \.
- - 46 First number exceeds second in \{ \}.
- - 49 [ ] imbalance.
- - 50 Regular expression overflow.
- -
- - */
- -
- -__BEGIN_DECLS
- -
- -/* Interface variables. They contain the results of the successful
- - calls to `setp' and `advance'. */
- -extern char *loc1;
- -extern char *loc2;
- -
- -/* The use of this variable in the `advance' function is not
- - supported. */
- -extern char *locs;
- -
- -
- -#ifndef __DO_NOT_DEFINE_COMPILE
- -/* Get and compile the user supplied pattern up to end of line or
- - string or until EOF is seen, whatever happens first. The result is
- - placed in the buffer starting at EXPBUF and delimited by ENDBUF.
- -
- - This function cannot be defined in the libc itself since it depends
- - on the macros. */
- -char *
- -compile (char *__restrict instring, char *__restrict expbuf,
- - const char *__restrict endbuf, int eof)
- -{
- - char *__input_buffer = NULL;
- - size_t __input_size = 0;
- - size_t __current_size = 0;
- - int __ch;
- - int __error;
- - INIT
- -
- - /* Align the expression buffer according to the needs for an object
- - of type `regex_t'. Then check for minimum size of the buffer for
- - the compiled regular expression. */
- - regex_t *__expr_ptr;
- -# if defined __GNUC__ && __GNUC__ >= 2
- - const size_t __req = __alignof__ (regex_t *);
- -# else
- - /* How shall we find out? We simply guess it and can change it is
- - this really proofs to be wrong. */
- - const size_t __req = 8;
- -# endif
- - expbuf += __req;
- - expbuf -= (expbuf - ((char *) 0)) % __req;
- - if (endbuf < expbuf + sizeof (regex_t))
- - {
- - ERROR (50);
- - }
- - __expr_ptr = (regex_t *) expbuf;
- - /* The remaining space in the buffer can be used for the compiled
- - pattern. */
- - __expr_ptr->__REPB_PREFIX (buffer) = expbuf + sizeof (regex_t);
- - __expr_ptr->__REPB_PREFIX (allocated)
- - = endbuf - (char *) __expr_ptr->__REPB_PREFIX (buffer);
- -
- - while ((__ch = (GETC ())) != eof)
- - {
- - if (__ch == '\0' || __ch == '\n')
- - {
- - UNGETC (__ch);
- - break;
- - }
- -
- - if (__current_size + 1 >= __input_size)
- - {
- - size_t __new_size = __input_size ? 2 * __input_size : 128;
- - char *__new_room = (char *) alloca (__new_size);
- - /* See whether we can use the old buffer. */
- - if (__new_room + __new_size == __input_buffer)
- - {
- - __input_size += __new_size;
- - __input_buffer = (char *) memcpy (__new_room, __input_buffer,
- - __current_size);
- - }
- - else if (__input_buffer + __input_size == __new_room)
- - __input_size += __new_size;
- - else
- - {
- - __input_size = __new_size;
- - __input_buffer = (char *) memcpy (__new_room, __input_buffer,
- - __current_size);
- - }
- - }
- - __input_buffer[__current_size++] = __ch;
- - }
- - if (__current_size)
- - __input_buffer[__current_size++] = '\0';
- - else
- - __input_buffer = "";
- -
- - /* Now compile the pattern. */
- - __error = regcomp (__expr_ptr, __input_buffer, REG_NEWLINE);
- - if (__error != 0)
- - /* Oh well, we have to translate POSIX error codes. */
- - switch (__error)
- - {
- - case REG_BADPAT:
- - case REG_ECOLLATE:
- - case REG_ECTYPE:
- - case REG_EESCAPE:
- - case REG_BADRPT:
- - case REG_EEND:
- - case REG_ERPAREN:
- - default:
- - /* There is no matching error code. */
- - ERROR (36);
- - case REG_ESUBREG:
- - ERROR (25);
- - case REG_EBRACK:
- - ERROR (49);
- - case REG_EPAREN:
- - ERROR (42);
- - case REG_EBRACE:
- - ERROR (44);
- - case REG_BADBR:
- - ERROR (46);
- - case REG_ERANGE:
- - ERROR (11);
- - case REG_ESPACE:
- - case REG_ESIZE:
- - ERROR (50);
- - }
- -
- - /* Everything is ok. */
- - RETURN ((char *) (__expr_ptr->__REPB_PREFIX (buffer)
- - + __expr_ptr->__REPB_PREFIX (used)));
- -}
- -#endif
- -
- -
- -/* Find the next match in STRING. The compiled regular expression is
- - found in the buffer starting at EXPBUF. `loc1' will return the
- - first character matched and `loc2' points to the next unmatched
- - character. */
- -extern int step (const char *__restrict __string,
- - const char *__restrict __expbuf) __THROW;
- -
- -/* Match the beginning of STRING with the compiled regular expression
- - in EXPBUF. If the match is successful `loc2' will contain the
- - position of the first unmatched character. */
- -extern int advance (const char *__restrict __string,
- - const char *__restrict __expbuf) __THROW;
- -
- -
- -__END_DECLS
+#error "The GNU C Library no longer implements <regexp.h>."
+#error "Please update your code to use <regex.h> instead (no trailing 'p')."
#endif /* regexp.h */
- --
2.5.0
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2
iQIcBAEBCAAGBQJVxAa6AAoJEJH8wytnaapk+YIQAJOyW9MRAP8PSx+eeNegYZSF
wqfUdtyYefjLmJOQEhk82OcFh1Xwrg1wXnoVJOnOg29iipMa1ebNcAFvDQvGYCW4
ITLrCrf3ISTltxkaJpGkUIU1TSIth2+yDdBca1BeNOqPnr3F9qjNlGSxXJdlvqlx
uByj2DiczNR2Yyy+S7HFxKEU96m0DBYGlS8F75oN7lHaPefWR07uAl/5JeBeahiK
lznYDwxlWyAtUhCiVNE/WA8vB45ib4CA7RRlM/ASOlg+WiXfex/ep3Bz1sw/ciMm
caTr1bVVNqYdKuSscvLa0FalcVqfUXFCTVzt7Oiud/6otDOTr63guc41ZsVrJQ2U
GrzpF9rEz3vY/AWqwSWeShtHiDOW/mTEDYaA18V6aAy4jg0aaW5NWrgSb4p13hcN
8sk9Ku4eP5WTmGv7b7y87QeAlsBxrWdzbJ3P212nZ6yejZCUOWXJNuEmYoByZUiM
gUn3Kwbs7E7v9Jrs2x6Q92ZQUtp4UNsNMBn/XGbdV0C67NFnrh3ZS2uaqW15blYl
jPgiPXD6jULjSe1cJWcpsZiDn9LxhROdhOcsmLAN/wQXRyRJF/1Ol2ZxsZWpqVja
7qZMcg6/UbW8xSYv5vKYMFohgYaILRuLOTtgPpNM6Mf+nU+Dv1qMZhjJX7ZiA+6y
r994Y8TJTopzmVYEHEHF
=fK7E
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [2.23 PATCH] Desupport regexp.h (bug 18681)
2015-08-07 1:16 ` Zack Weinberg
@ 2015-08-07 2:14 ` Mike Frysinger
2015-08-14 13:48 ` Zack Weinberg
0 siblings, 1 reply; 47+ messages in thread
From: Mike Frysinger @ 2015-08-07 2:14 UTC (permalink / raw)
To: Zack Weinberg; +Cc: libc-alpha
[-- Attachment #1: Type: text/plain, Size: 70 bytes --]
i'm ok with this, but i think Carlos wanted to look at it first
-mike
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [2.23 PATCH] Desupport regexp.h (bug 18681)
2015-08-07 2:14 ` Mike Frysinger
@ 2015-08-14 13:48 ` Zack Weinberg
2015-08-16 14:20 ` Zack Weinberg
0 siblings, 1 reply; 47+ messages in thread
From: Zack Weinberg @ 2015-08-14 13:48 UTC (permalink / raw)
To: libc-alpha, Carlos O'Donell
[-- Attachment #1.1: Type: text/plain, Size: 149 bytes --]
On 08/06/2015 10:14 PM, Mike Frysinger wrote:
> i'm ok with this, but i think Carlos wanted to look at it first
Ping? Rebased patch attached.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: 0001-Desupport-regexp.h-bug-18681.patch --]
[-- Type: text/x-patch; name="0001-Desupport-regexp.h-bug-18681.patch", Size: 10845 bytes --]
From ee88f758d65cd3eb217a8209b0465cb706cea974 Mon Sep 17 00:00:00 2001
From: Zack Weinberg <zackw@panix.com>
Date: Sun, 12 Jul 2015 15:27:34 -0400
Subject: [PATCH] Desupport regexp.h (bug 18681)
* misc/regexp.h: This interface is no longer supported.
Remove all contents, leaving only an #error directive.
* misc/regexp.c (loc1, loc2, locs, step, advance):
Demote to compatibility symbols.
---
NEWS | 5 +-
misc/regexp.c | 29 +++++++--
misc/regexp.h | 203 +---------------------------------------------------------
3 files changed, 29 insertions(+), 208 deletions(-)
diff --git a/NEWS b/NEWS
index 5ca3de8..ba09555 100644
--- a/NEWS
+++ b/NEWS
@@ -10,8 +10,11 @@ Version 2.23
* The following bugs are resolved with this release:
16517, 16519, 16520, 16734, 17905, 18086, 18265, 18480, 18525, 18618,
- 18647, 18661, 18674, 18778, 18781, 18787, 18789, 18790, 18820.
+ 18647, 18661, 18674, 18681, 18778, 18781, 18787, 18789, 18790, 18820.
+ 16519, 18265, 18525, 18647, 18661, 18681.
+* The obsolete header <regexp.h> has been removed. Programs that require
+ this header must be updated to use <regex.h> instead.
\f
Version 2.22
diff --git a/misc/regexp.c b/misc/regexp.c
index ee7d572..ef5e18b 100644
--- a/misc/regexp.c
+++ b/misc/regexp.c
@@ -1,4 +1,4 @@
-/* Define function and variables for the obsolete <regexp.h> interface.
+/* Compatibility symbols for the obsolete <regexp.h> interface.
Copyright (C) 1996-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
@@ -17,17 +17,27 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-/* We don't include regexp.h here because of the macros it requires, and
- because it now contains an unconditional #warning. */
+/* regexp.h now contains only an #error directive, so it cannot be
+ used in this file.
+
+ The function that would produce an 'expbuf' to use as the second
+ argument to 'step' and 'advance' was defined only in regexp.h,
+ as its definition depended on macros defined by the user. */
#include <regex.h>
+#include <shlib-compat.h>
+
+#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_23)
/* Define the variables used for the interface. */
char *loc1;
char *loc2;
+compat_symbol (libc, loc1, loc1, GLIBC_2_0);
+compat_symbol (libc, loc2, loc2, GLIBC_2_0);
/* Although we do not support the use we define this variable as well. */
char *locs;
+compat_symbol (libc, locs, locs, GLIBC_2_0);
/* Find the next match in STRING. The compiled regular expression is
@@ -35,7 +45,8 @@ char *locs;
first character matched and `loc2' points to the next unmatched
character. */
int
-__step (const char *string, const char *expbuf)
+weak_function attribute_compat_text_section
+step (const char *string, const char *expbuf)
{
regmatch_t match; /* We only need info about the full match. */
@@ -50,14 +61,15 @@ __step (const char *string, const char *expbuf)
loc2 = (char *) string + match.rm_eo;
return 1;
}
-weak_alias (__step, step)
+compat_symbol (libc, step, step, GLIBC_2_0);
/* Match the beginning of STRING with the compiled regular expression
in EXPBUF. If the match is successful `loc2' will contain the
position of the first unmatched character. */
int
-__advance (const char *string, const char *expbuf)
+weak_function attribute_compat_text_section
+advance (const char *string, const char *expbuf)
{
regmatch_t match; /* We only need info about the full match. */
@@ -74,4 +86,7 @@ __advance (const char *string, const char *expbuf)
loc2 = (char *) string + match.rm_eo;
return 1;
}
-weak_alias (__advance, advance)
+compat_symbol (libc, advance, advance, GLIBC_2_0);
+
+
+#endif /* SHLIB_COMPAT (2.0, 2.23) */
diff --git a/misc/regexp.h b/misc/regexp.h
index 42394f7..9f5c413 100644
--- a/misc/regexp.h
+++ b/misc/regexp.h
@@ -25,206 +25,9 @@
were encouraged to use <regex.h> instead. It was officially
withdrawn from the standard in Issue 6 (aka POSIX.1-2001).
- This header is provided only for backward compatibility.
- It will be removed in the next release of the GNU C Library.
- New code should use <regex.h> instead. */
+ The GNU C Library provided this header through version 2.22. */
-#warning "<regexp.h> will be removed in the next release of the GNU C Library."
-#warning "Please update your code to use <regex.h> instead (no trailing 'p')."
-
-#include <features.h>
-#include <alloca.h>
-#include <regex.h>
-#include <stdlib.h>
-#include <string.h>
-
-/* The implementation provided here emulates the needed functionality
- by mapping to the POSIX regular expression matcher. The interface
- for the here included function is weird (this really is a harmless
- word).
-
- The user has to provide six macros before this header file can be
- included:
-
- INIT Declarations vor variables which can be used by the
- other macros.
-
- GETC() Return the value of the next character in the regular
- expression pattern. Successive calls should return
- successive characters.
-
- PEEKC() Return the value of the next character in the regular
- expression pattern. Immediately successive calls to
- PEEKC() should return the same character which should
- also be the next character returned by GETC().
-
- UNGETC(c) Cause `c' to be returned by the next call to GETC() and
- PEEKC().
-
- RETURN(ptr) Used for normal exit of the `compile' function. `ptr'
- is a pointer to the character after the last character of
- the compiled regular expression.
-
- ERROR(val) Used for abnormal return from `compile'. `val' is the
- error number. The error codes are:
- 11 Range endpoint too large.
- 16 Bad number.
- 25 \digit out of range.
- 36 Illegal or missing delimiter.
- 41 No remembered search string.
- 42 \( \) imbalance.
- 43 Too many \(.
- 44 More tan two numbers given in \{ \}.
- 45 } expected after \.
- 46 First number exceeds second in \{ \}.
- 49 [ ] imbalance.
- 50 Regular expression overflow.
-
- */
-
-__BEGIN_DECLS
-
-/* Interface variables. They contain the results of the successful
- calls to `setp' and `advance'. */
-extern char *loc1;
-extern char *loc2;
-
-/* The use of this variable in the `advance' function is not
- supported. */
-extern char *locs;
-
-
-#ifndef __DO_NOT_DEFINE_COMPILE
-/* Get and compile the user supplied pattern up to end of line or
- string or until EOF is seen, whatever happens first. The result is
- placed in the buffer starting at EXPBUF and delimited by ENDBUF.
-
- This function cannot be defined in the libc itself since it depends
- on the macros. */
-char *
-compile (char *__restrict instring, char *__restrict expbuf,
- const char *__restrict endbuf, int eof)
-{
- char *__input_buffer = NULL;
- size_t __input_size = 0;
- size_t __current_size = 0;
- int __ch;
- int __error;
- INIT
-
- /* Align the expression buffer according to the needs for an object
- of type `regex_t'. Then check for minimum size of the buffer for
- the compiled regular expression. */
- regex_t *__expr_ptr;
-# if defined __GNUC__ && __GNUC__ >= 2
- const size_t __req = __alignof__ (regex_t *);
-# else
- /* How shall we find out? We simply guess it and can change it is
- this really proofs to be wrong. */
- const size_t __req = 8;
-# endif
- expbuf += __req;
- expbuf -= (expbuf - ((char *) 0)) % __req;
- if (endbuf < expbuf + sizeof (regex_t))
- {
- ERROR (50);
- }
- __expr_ptr = (regex_t *) expbuf;
- /* The remaining space in the buffer can be used for the compiled
- pattern. */
- __expr_ptr->__REPB_PREFIX (buffer) = expbuf + sizeof (regex_t);
- __expr_ptr->__REPB_PREFIX (allocated)
- = endbuf - (char *) __expr_ptr->__REPB_PREFIX (buffer);
-
- while ((__ch = (GETC ())) != eof)
- {
- if (__ch == '\0' || __ch == '\n')
- {
- UNGETC (__ch);
- break;
- }
-
- if (__current_size + 1 >= __input_size)
- {
- size_t __new_size = __input_size ? 2 * __input_size : 128;
- char *__new_room = (char *) alloca (__new_size);
- /* See whether we can use the old buffer. */
- if (__new_room + __new_size == __input_buffer)
- {
- __input_size += __new_size;
- __input_buffer = (char *) memcpy (__new_room, __input_buffer,
- __current_size);
- }
- else if (__input_buffer + __input_size == __new_room)
- __input_size += __new_size;
- else
- {
- __input_size = __new_size;
- __input_buffer = (char *) memcpy (__new_room, __input_buffer,
- __current_size);
- }
- }
- __input_buffer[__current_size++] = __ch;
- }
- if (__current_size)
- __input_buffer[__current_size++] = '\0';
- else
- __input_buffer = "";
-
- /* Now compile the pattern. */
- __error = regcomp (__expr_ptr, __input_buffer, REG_NEWLINE);
- if (__error != 0)
- /* Oh well, we have to translate POSIX error codes. */
- switch (__error)
- {
- case REG_BADPAT:
- case REG_ECOLLATE:
- case REG_ECTYPE:
- case REG_EESCAPE:
- case REG_BADRPT:
- case REG_EEND:
- case REG_ERPAREN:
- default:
- /* There is no matching error code. */
- ERROR (36);
- case REG_ESUBREG:
- ERROR (25);
- case REG_EBRACK:
- ERROR (49);
- case REG_EPAREN:
- ERROR (42);
- case REG_EBRACE:
- ERROR (44);
- case REG_BADBR:
- ERROR (46);
- case REG_ERANGE:
- ERROR (11);
- case REG_ESPACE:
- case REG_ESIZE:
- ERROR (50);
- }
-
- /* Everything is ok. */
- RETURN ((char *) (__expr_ptr->__REPB_PREFIX (buffer)
- + __expr_ptr->__REPB_PREFIX (used)));
-}
-#endif
-
-
-/* Find the next match in STRING. The compiled regular expression is
- found in the buffer starting at EXPBUF. `loc1' will return the
- first character matched and `loc2' points to the next unmatched
- character. */
-extern int step (const char *__restrict __string,
- const char *__restrict __expbuf) __THROW;
-
-/* Match the beginning of STRING with the compiled regular expression
- in EXPBUF. If the match is successful `loc2' will contain the
- position of the first unmatched character. */
-extern int advance (const char *__restrict __string,
- const char *__restrict __expbuf) __THROW;
-
-
-__END_DECLS
+#error "The GNU C Library no longer implements <regexp.h>."
+#error "Please update your code to use <regex.h> instead (no trailing 'p')."
#endif /* regexp.h */
--
2.5.0
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [2.23 PATCH] Desupport regexp.h (bug 18681)
2015-08-14 13:48 ` Zack Weinberg
@ 2015-08-16 14:20 ` Zack Weinberg
2015-08-16 14:45 ` Andreas Schwab
0 siblings, 1 reply; 47+ messages in thread
From: Zack Weinberg @ 2015-08-16 14:20 UTC (permalink / raw)
To: libc-alpha, Carlos O'Donell
[-- Attachment #1.1: Type: text/plain, Size: 255 bytes --]
On 08/14/2015 09:48 AM, Zack Weinberg wrote:
> On 08/06/2015 10:14 PM, Mike Frysinger wrote:
>> i'm ok with this, but i think Carlos wanted to look at it first
>
> Ping? Rebased patch attached.
Rebased again, now without a merge botch in NEWS.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: 0001-Desupport-regexp.h-bug-18681.patch --]
[-- Type: text/x-patch; name="0001-Desupport-regexp.h-bug-18681.patch", Size: 10849 bytes --]
From 38848058ad265986aa974f59e101bb36bb7d932c Mon Sep 17 00:00:00 2001
From: Zack Weinberg <zackw@panix.com>
Date: Sun, 12 Jul 2015 15:27:34 -0400
Subject: [PATCH] Desupport regexp.h (bug 18681)
* misc/regexp.h: This interface is no longer supported.
Remove all contents, leaving only an #error directive.
* misc/regexp.c (loc1, loc2, locs, step, advance):
Demote to compatibility symbols.
---
NEWS | 6 +-
misc/regexp.c | 29 +++++++--
misc/regexp.h | 203 +---------------------------------------------------------
3 files changed, 29 insertions(+), 209 deletions(-)
diff --git a/NEWS b/NEWS
index 12b258a..64230e2 100644
--- a/NEWS
+++ b/NEWS
@@ -10,9 +10,11 @@ Version 2.23
* The following bugs are resolved with this release:
16517, 16519, 16520, 16734, 17905, 18084, 18086, 18265, 18480, 18525,
- 18618, 18647, 18661, 18674, 18778, 18781, 18787, 18789, 18790, 18795,
- 18820, 18824.
+ 18618, 18647, 18661, 18681, 18674, 18778, 18781, 18787, 18789, 18790,
+ 18795, 18820, 18824.
+* The obsolete header <regexp.h> has been removed. Programs that require
+ this header must be updated to use <regex.h> instead.
\f
Version 2.22
diff --git a/misc/regexp.c b/misc/regexp.c
index ee7d572..ef5e18b 100644
--- a/misc/regexp.c
+++ b/misc/regexp.c
@@ -1,4 +1,4 @@
-/* Define function and variables for the obsolete <regexp.h> interface.
+/* Compatibility symbols for the obsolete <regexp.h> interface.
Copyright (C) 1996-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
@@ -17,17 +17,27 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-/* We don't include regexp.h here because of the macros it requires, and
- because it now contains an unconditional #warning. */
+/* regexp.h now contains only an #error directive, so it cannot be
+ used in this file.
+
+ The function that would produce an 'expbuf' to use as the second
+ argument to 'step' and 'advance' was defined only in regexp.h,
+ as its definition depended on macros defined by the user. */
#include <regex.h>
+#include <shlib-compat.h>
+
+#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_23)
/* Define the variables used for the interface. */
char *loc1;
char *loc2;
+compat_symbol (libc, loc1, loc1, GLIBC_2_0);
+compat_symbol (libc, loc2, loc2, GLIBC_2_0);
/* Although we do not support the use we define this variable as well. */
char *locs;
+compat_symbol (libc, locs, locs, GLIBC_2_0);
/* Find the next match in STRING. The compiled regular expression is
@@ -35,7 +45,8 @@ char *locs;
first character matched and `loc2' points to the next unmatched
character. */
int
-__step (const char *string, const char *expbuf)
+weak_function attribute_compat_text_section
+step (const char *string, const char *expbuf)
{
regmatch_t match; /* We only need info about the full match. */
@@ -50,14 +61,15 @@ __step (const char *string, const char *expbuf)
loc2 = (char *) string + match.rm_eo;
return 1;
}
-weak_alias (__step, step)
+compat_symbol (libc, step, step, GLIBC_2_0);
/* Match the beginning of STRING with the compiled regular expression
in EXPBUF. If the match is successful `loc2' will contain the
position of the first unmatched character. */
int
-__advance (const char *string, const char *expbuf)
+weak_function attribute_compat_text_section
+advance (const char *string, const char *expbuf)
{
regmatch_t match; /* We only need info about the full match. */
@@ -74,4 +86,7 @@ __advance (const char *string, const char *expbuf)
loc2 = (char *) string + match.rm_eo;
return 1;
}
-weak_alias (__advance, advance)
+compat_symbol (libc, advance, advance, GLIBC_2_0);
+
+
+#endif /* SHLIB_COMPAT (2.0, 2.23) */
diff --git a/misc/regexp.h b/misc/regexp.h
index 42394f7..9f5c413 100644
--- a/misc/regexp.h
+++ b/misc/regexp.h
@@ -25,206 +25,9 @@
were encouraged to use <regex.h> instead. It was officially
withdrawn from the standard in Issue 6 (aka POSIX.1-2001).
- This header is provided only for backward compatibility.
- It will be removed in the next release of the GNU C Library.
- New code should use <regex.h> instead. */
+ The GNU C Library provided this header through version 2.22. */
-#warning "<regexp.h> will be removed in the next release of the GNU C Library."
-#warning "Please update your code to use <regex.h> instead (no trailing 'p')."
-
-#include <features.h>
-#include <alloca.h>
-#include <regex.h>
-#include <stdlib.h>
-#include <string.h>
-
-/* The implementation provided here emulates the needed functionality
- by mapping to the POSIX regular expression matcher. The interface
- for the here included function is weird (this really is a harmless
- word).
-
- The user has to provide six macros before this header file can be
- included:
-
- INIT Declarations vor variables which can be used by the
- other macros.
-
- GETC() Return the value of the next character in the regular
- expression pattern. Successive calls should return
- successive characters.
-
- PEEKC() Return the value of the next character in the regular
- expression pattern. Immediately successive calls to
- PEEKC() should return the same character which should
- also be the next character returned by GETC().
-
- UNGETC(c) Cause `c' to be returned by the next call to GETC() and
- PEEKC().
-
- RETURN(ptr) Used for normal exit of the `compile' function. `ptr'
- is a pointer to the character after the last character of
- the compiled regular expression.
-
- ERROR(val) Used for abnormal return from `compile'. `val' is the
- error number. The error codes are:
- 11 Range endpoint too large.
- 16 Bad number.
- 25 \digit out of range.
- 36 Illegal or missing delimiter.
- 41 No remembered search string.
- 42 \( \) imbalance.
- 43 Too many \(.
- 44 More tan two numbers given in \{ \}.
- 45 } expected after \.
- 46 First number exceeds second in \{ \}.
- 49 [ ] imbalance.
- 50 Regular expression overflow.
-
- */
-
-__BEGIN_DECLS
-
-/* Interface variables. They contain the results of the successful
- calls to `setp' and `advance'. */
-extern char *loc1;
-extern char *loc2;
-
-/* The use of this variable in the `advance' function is not
- supported. */
-extern char *locs;
-
-
-#ifndef __DO_NOT_DEFINE_COMPILE
-/* Get and compile the user supplied pattern up to end of line or
- string or until EOF is seen, whatever happens first. The result is
- placed in the buffer starting at EXPBUF and delimited by ENDBUF.
-
- This function cannot be defined in the libc itself since it depends
- on the macros. */
-char *
-compile (char *__restrict instring, char *__restrict expbuf,
- const char *__restrict endbuf, int eof)
-{
- char *__input_buffer = NULL;
- size_t __input_size = 0;
- size_t __current_size = 0;
- int __ch;
- int __error;
- INIT
-
- /* Align the expression buffer according to the needs for an object
- of type `regex_t'. Then check for minimum size of the buffer for
- the compiled regular expression. */
- regex_t *__expr_ptr;
-# if defined __GNUC__ && __GNUC__ >= 2
- const size_t __req = __alignof__ (regex_t *);
-# else
- /* How shall we find out? We simply guess it and can change it is
- this really proofs to be wrong. */
- const size_t __req = 8;
-# endif
- expbuf += __req;
- expbuf -= (expbuf - ((char *) 0)) % __req;
- if (endbuf < expbuf + sizeof (regex_t))
- {
- ERROR (50);
- }
- __expr_ptr = (regex_t *) expbuf;
- /* The remaining space in the buffer can be used for the compiled
- pattern. */
- __expr_ptr->__REPB_PREFIX (buffer) = expbuf + sizeof (regex_t);
- __expr_ptr->__REPB_PREFIX (allocated)
- = endbuf - (char *) __expr_ptr->__REPB_PREFIX (buffer);
-
- while ((__ch = (GETC ())) != eof)
- {
- if (__ch == '\0' || __ch == '\n')
- {
- UNGETC (__ch);
- break;
- }
-
- if (__current_size + 1 >= __input_size)
- {
- size_t __new_size = __input_size ? 2 * __input_size : 128;
- char *__new_room = (char *) alloca (__new_size);
- /* See whether we can use the old buffer. */
- if (__new_room + __new_size == __input_buffer)
- {
- __input_size += __new_size;
- __input_buffer = (char *) memcpy (__new_room, __input_buffer,
- __current_size);
- }
- else if (__input_buffer + __input_size == __new_room)
- __input_size += __new_size;
- else
- {
- __input_size = __new_size;
- __input_buffer = (char *) memcpy (__new_room, __input_buffer,
- __current_size);
- }
- }
- __input_buffer[__current_size++] = __ch;
- }
- if (__current_size)
- __input_buffer[__current_size++] = '\0';
- else
- __input_buffer = "";
-
- /* Now compile the pattern. */
- __error = regcomp (__expr_ptr, __input_buffer, REG_NEWLINE);
- if (__error != 0)
- /* Oh well, we have to translate POSIX error codes. */
- switch (__error)
- {
- case REG_BADPAT:
- case REG_ECOLLATE:
- case REG_ECTYPE:
- case REG_EESCAPE:
- case REG_BADRPT:
- case REG_EEND:
- case REG_ERPAREN:
- default:
- /* There is no matching error code. */
- ERROR (36);
- case REG_ESUBREG:
- ERROR (25);
- case REG_EBRACK:
- ERROR (49);
- case REG_EPAREN:
- ERROR (42);
- case REG_EBRACE:
- ERROR (44);
- case REG_BADBR:
- ERROR (46);
- case REG_ERANGE:
- ERROR (11);
- case REG_ESPACE:
- case REG_ESIZE:
- ERROR (50);
- }
-
- /* Everything is ok. */
- RETURN ((char *) (__expr_ptr->__REPB_PREFIX (buffer)
- + __expr_ptr->__REPB_PREFIX (used)));
-}
-#endif
-
-
-/* Find the next match in STRING. The compiled regular expression is
- found in the buffer starting at EXPBUF. `loc1' will return the
- first character matched and `loc2' points to the next unmatched
- character. */
-extern int step (const char *__restrict __string,
- const char *__restrict __expbuf) __THROW;
-
-/* Match the beginning of STRING with the compiled regular expression
- in EXPBUF. If the match is successful `loc2' will contain the
- position of the first unmatched character. */
-extern int advance (const char *__restrict __string,
- const char *__restrict __expbuf) __THROW;
-
-
-__END_DECLS
+#error "The GNU C Library no longer implements <regexp.h>."
+#error "Please update your code to use <regex.h> instead (no trailing 'p')."
#endif /* regexp.h */
--
2.5.0
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [2.23 PATCH] Desupport regexp.h (bug 18681)
2015-08-16 14:20 ` Zack Weinberg
@ 2015-08-16 14:45 ` Andreas Schwab
2015-08-16 15:19 ` Zack Weinberg
2015-08-17 16:22 ` Carlos O'Donell
0 siblings, 2 replies; 47+ messages in thread
From: Andreas Schwab @ 2015-08-16 14:45 UTC (permalink / raw)
To: Zack Weinberg; +Cc: libc-alpha, Carlos O'Donell
Zack Weinberg <zackw@panix.com> writes:
> * misc/regexp.h: This interface is no longer supported.
> Remove all contents, leaving only an #error directive.
> * misc/regexp.c (loc1, loc2, locs, step, advance):
> Demote to compatibility symbols.
Ok.
Andreas.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [2.23 PATCH] Desupport regexp.h (bug 18681)
2015-08-16 14:45 ` Andreas Schwab
@ 2015-08-16 15:19 ` Zack Weinberg
2015-08-17 16:22 ` Carlos O'Donell
1 sibling, 0 replies; 47+ messages in thread
From: Zack Weinberg @ 2015-08-16 15:19 UTC (permalink / raw)
To: Andreas Schwab; +Cc: libc-alpha, Carlos O'Donell
[-- Attachment #1: Type: text/plain, Size: 374 bytes --]
On 08/16/2015 10:45 AM, Andreas Schwab wrote:
> Zack Weinberg <zackw@panix.com> writes:
>
>> * misc/regexp.h: This interface is no longer supported.
>> Remove all contents, leaving only an #error directive.
>> * misc/regexp.c (loc1, loc2, locs, step, advance):
>> Demote to compatibility symbols.
>
> Ok.
I will need someone to commit it for me.
zw
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [2.23 PATCH] Desupport regexp.h (bug 18681)
2015-08-05 15:21 ` [2.23 PATCH] Desupport regexp.h (bug 18681) Zack Weinberg
2015-08-06 2:40 ` Mike Frysinger
@ 2015-08-17 8:50 ` Stefan Liebler
2015-08-17 13:30 ` Zack Weinberg
1 sibling, 1 reply; 47+ messages in thread
From: Stefan Liebler @ 2015-08-17 8:50 UTC (permalink / raw)
To: libc-alpha
Hi,
i get the following warning while compiling misc/regexp.c:
gcc regexp.c -c -Wall -Werror -Wno-error=undef -Wundef
...
In file included from regexp.c:28:0:
../include/shlib-compat.h:45:10: warning: "ABI_libc_GLIBC_2_23" is not
defined [-Wundef]
&& (!(ABI_##lib##_##obsoleted - 0) \
^
../include/shlib-compat.h:42:3: note: in expansion of macro ‘_SHLIB_COMPAT’
_SHLIB_COMPAT (lib, introduced, obsoleted)
^
regexp.c:30:5: note: in expansion of macro ‘SHLIB_COMPAT’
#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_23)
^
The generated abi-versions.h file does not contain a define for
ABI_libc_GLIBC_2_23.
Bye
Stefan
On 07/12/2015 09:27 PM, Zack Weinberg wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
>
> I posted this a couple weeks ago, but now that the branch has been
> cut, `SHLIB_COMPAT(GLIBC_2_0, GLIBC_2_23)` compiles, so I've actually
> tested it. ;-) Also, I merged in the corrections to NEWS and the
> comment at the top of regexp.h, which I posted separately for the
> 2.22 branch. And hopefully it will not get mangled this time.
>
> I can see two ways to proceed with this patch. First is just to go
> ahead and land it now, and hope that if it breaks someone, they will
> tell us about it during the 2.23 development cycle. Second is to
> attempt to search for code it will break, e.g. with a Debian archive
> rebuild or a broad-spectrum code-search service. I did try the latter
> but was not able to find one that would distinguish *this* <regexp.h>
> from one provided by the application, and there are lots of those.
>
> zw
>
> * misc/regexp.h: This interface is no longer supported.
> Remove all contents, leaving only an #error directive.
> * misc/regexp.c (loc1, loc2, locs, step, advance):
> Demote to compatibility symbols.
> - ---
> NEWS | 8 ++-
> misc/regexp.c | 29 ++++++--
> misc/regexp.h | 212 +++-------------------------------------------------------
> 3 files changed, 36 insertions(+), 213 deletions(-)
>
> diff --git a/NEWS b/NEWS
> index 6e0726c..b3a0f2e 100644
> - --- a/NEWS
> +++ b/NEWS
> @@ -8,7 +8,11 @@ using `glibc' in the "product" field.
> Version 2.23
>
> * The following bugs are resolved with this release:
> - - 18265, 18525.
> +
> + 18265, 18525, 18681.
> +
> +* The obsolete header <regexp.h> has been removed. Programs that require
> + this header must be updated to use <regex.h> instead.
> \f
> Version 2.22
>
> @@ -89,7 +93,7 @@ Version 2.22
> release. Use of this header will trigger a deprecation warning.
> Application developers should update their code to use <regex.h> instead.
>
> - - This header was formerly part of SUSv2, but was deprecated in 1997 and
> + This header was formerly part of SUS, but was deprecated in 1994 and
> removed from the standard in 2001. Also, the glibc implementation
> leaks memory. See BZ#18681 for more details.
> \f
> diff --git a/misc/regexp.c b/misc/regexp.c
> index ee7d572..ef5e18b 100644
> - --- a/misc/regexp.c
> +++ b/misc/regexp.c
> @@ -1,4 +1,4 @@
> - -/* Define function and variables for the obsolete <regexp.h> interface.
> +/* Compatibility symbols for the obsolete <regexp.h> interface.
> Copyright (C) 1996-2015 Free Software Foundation, Inc.
> This file is part of the GNU C Library.
> Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
> @@ -17,17 +17,27 @@
> License along with the GNU C Library; if not, see
> <http://www.gnu.org/licenses/>. */
>
> - -/* We don't include regexp.h here because of the macros it requires, and
> - - because it now contains an unconditional #warning. */
> +/* regexp.h now contains only an #error directive, so it cannot be
> + used in this file.
> +
> + The function that would produce an 'expbuf' to use as the second
> + argument to 'step' and 'advance' was defined only in regexp.h,
> + as its definition depended on macros defined by the user. */
>
> #include <regex.h>
> +#include <shlib-compat.h>
> +
> +#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_23)
>
> /* Define the variables used for the interface. */
> char *loc1;
> char *loc2;
> +compat_symbol (libc, loc1, loc1, GLIBC_2_0);
> +compat_symbol (libc, loc2, loc2, GLIBC_2_0);
>
> /* Although we do not support the use we define this variable as well. */
> char *locs;
> +compat_symbol (libc, locs, locs, GLIBC_2_0);
>
>
> /* Find the next match in STRING. The compiled regular expression is
> @@ -35,7 +45,8 @@ char *locs;
> first character matched and `loc2' points to the next unmatched
> character. */
> int
> - -__step (const char *string, const char *expbuf)
> +weak_function attribute_compat_text_section
> +step (const char *string, const char *expbuf)
> {
> regmatch_t match; /* We only need info about the full match. */
>
> @@ -50,14 +61,15 @@ __step (const char *string, const char *expbuf)
> loc2 = (char *) string + match.rm_eo;
> return 1;
> }
> - -weak_alias (__step, step)
> +compat_symbol (libc, step, step, GLIBC_2_0);
>
>
> /* Match the beginning of STRING with the compiled regular expression
> in EXPBUF. If the match is successful `loc2' will contain the
> position of the first unmatched character. */
> int
> - -__advance (const char *string, const char *expbuf)
> +weak_function attribute_compat_text_section
> +advance (const char *string, const char *expbuf)
> {
> regmatch_t match; /* We only need info about the full match. */
>
> @@ -74,4 +86,7 @@ __advance (const char *string, const char *expbuf)
> loc2 = (char *) string + match.rm_eo;
> return 1;
> }
> - -weak_alias (__advance, advance)
> +compat_symbol (libc, advance, advance, GLIBC_2_0);
> +
> +
> +#endif /* SHLIB_COMPAT (2.0, 2.23) */
> diff --git a/misc/regexp.h b/misc/regexp.h
> index 3460989..9f5c413 100644
> - --- a/misc/regexp.h
> +++ b/misc/regexp.h
> @@ -19,211 +19,15 @@
> #ifndef _REGEXP_H
> #define _REGEXP_H 1
>
> - -/* The contents of this header file were standardized in the
> - - Single Unix Specification, Version 2 (1997) but marked as
> - - LEGACY; new applications were already being encouraged to
> - - use <regex.h> instead. POSIX.1-2001 removed this header.
> +/* The contents of this header file were originally standardized in
> + the Single Unix Specification, Issue 3 (1992). In Issue 4 (1994)
> + the header was marked as TO BE WITHDRAWN, and new applications
> + were encouraged to use <regex.h> instead. It was officially
> + withdrawn from the standard in Issue 6 (aka POSIX.1-2001).
>
> - - This header is provided only for backward compatibility.
> - - It will be removed in the next release of the GNU C Library.
> - - New code should use <regex.h> instead. */
> + The GNU C Library provided this header through version 2.22. */
>
> - -#warning "<regexp.h> will be removed in the next release of the GNU C Library."
> - -#warning "Please update your code to use <regex.h> instead (no trailing 'p')."
> - -
> - -#include <features.h>
> - -#include <alloca.h>
> - -#include <regex.h>
> - -#include <stdlib.h>
> - -#include <string.h>
> - -
> - -/* The implementation provided here emulates the needed functionality
> - - by mapping to the POSIX regular expression matcher. The interface
> - - for the here included function is weird (this really is a harmless
> - - word).
> - -
> - - The user has to provide six macros before this header file can be
> - - included:
> - -
> - - INIT Declarations vor variables which can be used by the
> - - other macros.
> - -
> - - GETC() Return the value of the next character in the regular
> - - expression pattern. Successive calls should return
> - - successive characters.
> - -
> - - PEEKC() Return the value of the next character in the regular
> - - expression pattern. Immediately successive calls to
> - - PEEKC() should return the same character which should
> - - also be the next character returned by GETC().
> - -
> - - UNGETC(c) Cause `c' to be returned by the next call to GETC() and
> - - PEEKC().
> - -
> - - RETURN(ptr) Used for normal exit of the `compile' function. `ptr'
> - - is a pointer to the character after the last character of
> - - the compiled regular expression.
> - -
> - - ERROR(val) Used for abnormal return from `compile'. `val' is the
> - - error number. The error codes are:
> - - 11 Range endpoint too large.
> - - 16 Bad number.
> - - 25 \digit out of range.
> - - 36 Illegal or missing delimiter.
> - - 41 No remembered search string.
> - - 42 \( \) imbalance.
> - - 43 Too many \(.
> - - 44 More tan two numbers given in \{ \}.
> - - 45 } expected after \.
> - - 46 First number exceeds second in \{ \}.
> - - 49 [ ] imbalance.
> - - 50 Regular expression overflow.
> - -
> - - */
> - -
> - -__BEGIN_DECLS
> - -
> - -/* Interface variables. They contain the results of the successful
> - - calls to `setp' and `advance'. */
> - -extern char *loc1;
> - -extern char *loc2;
> - -
> - -/* The use of this variable in the `advance' function is not
> - - supported. */
> - -extern char *locs;
> - -
> - -
> - -#ifndef __DO_NOT_DEFINE_COMPILE
> - -/* Get and compile the user supplied pattern up to end of line or
> - - string or until EOF is seen, whatever happens first. The result is
> - - placed in the buffer starting at EXPBUF and delimited by ENDBUF.
> - -
> - - This function cannot be defined in the libc itself since it depends
> - - on the macros. */
> - -char *
> - -compile (char *__restrict instring, char *__restrict expbuf,
> - - const char *__restrict endbuf, int eof)
> - -{
> - - char *__input_buffer = NULL;
> - - size_t __input_size = 0;
> - - size_t __current_size = 0;
> - - int __ch;
> - - int __error;
> - - INIT
> - -
> - - /* Align the expression buffer according to the needs for an object
> - - of type `regex_t'. Then check for minimum size of the buffer for
> - - the compiled regular expression. */
> - - regex_t *__expr_ptr;
> - -# if defined __GNUC__ && __GNUC__ >= 2
> - - const size_t __req = __alignof__ (regex_t *);
> - -# else
> - - /* How shall we find out? We simply guess it and can change it is
> - - this really proofs to be wrong. */
> - - const size_t __req = 8;
> - -# endif
> - - expbuf += __req;
> - - expbuf -= (expbuf - ((char *) 0)) % __req;
> - - if (endbuf < expbuf + sizeof (regex_t))
> - - {
> - - ERROR (50);
> - - }
> - - __expr_ptr = (regex_t *) expbuf;
> - - /* The remaining space in the buffer can be used for the compiled
> - - pattern. */
> - - __expr_ptr->__REPB_PREFIX (buffer) = expbuf + sizeof (regex_t);
> - - __expr_ptr->__REPB_PREFIX (allocated)
> - - = endbuf - (char *) __expr_ptr->__REPB_PREFIX (buffer);
> - -
> - - while ((__ch = (GETC ())) != eof)
> - - {
> - - if (__ch == '\0' || __ch == '\n')
> - - {
> - - UNGETC (__ch);
> - - break;
> - - }
> - -
> - - if (__current_size + 1 >= __input_size)
> - - {
> - - size_t __new_size = __input_size ? 2 * __input_size : 128;
> - - char *__new_room = (char *) alloca (__new_size);
> - - /* See whether we can use the old buffer. */
> - - if (__new_room + __new_size == __input_buffer)
> - - {
> - - __input_size += __new_size;
> - - __input_buffer = (char *) memcpy (__new_room, __input_buffer,
> - - __current_size);
> - - }
> - - else if (__input_buffer + __input_size == __new_room)
> - - __input_size += __new_size;
> - - else
> - - {
> - - __input_size = __new_size;
> - - __input_buffer = (char *) memcpy (__new_room, __input_buffer,
> - - __current_size);
> - - }
> - - }
> - - __input_buffer[__current_size++] = __ch;
> - - }
> - - if (__current_size)
> - - __input_buffer[__current_size++] = '\0';
> - - else
> - - __input_buffer = "";
> - -
> - - /* Now compile the pattern. */
> - - __error = regcomp (__expr_ptr, __input_buffer, REG_NEWLINE);
> - - if (__error != 0)
> - - /* Oh well, we have to translate POSIX error codes. */
> - - switch (__error)
> - - {
> - - case REG_BADPAT:
> - - case REG_ECOLLATE:
> - - case REG_ECTYPE:
> - - case REG_EESCAPE:
> - - case REG_BADRPT:
> - - case REG_EEND:
> - - case REG_ERPAREN:
> - - default:
> - - /* There is no matching error code. */
> - - ERROR (36);
> - - case REG_ESUBREG:
> - - ERROR (25);
> - - case REG_EBRACK:
> - - ERROR (49);
> - - case REG_EPAREN:
> - - ERROR (42);
> - - case REG_EBRACE:
> - - ERROR (44);
> - - case REG_BADBR:
> - - ERROR (46);
> - - case REG_ERANGE:
> - - ERROR (11);
> - - case REG_ESPACE:
> - - case REG_ESIZE:
> - - ERROR (50);
> - - }
> - -
> - - /* Everything is ok. */
> - - RETURN ((char *) (__expr_ptr->__REPB_PREFIX (buffer)
> - - + __expr_ptr->__REPB_PREFIX (used)));
> - -}
> - -#endif
> - -
> - -
> - -/* Find the next match in STRING. The compiled regular expression is
> - - found in the buffer starting at EXPBUF. `loc1' will return the
> - - first character matched and `loc2' points to the next unmatched
> - - character. */
> - -extern int step (const char *__restrict __string,
> - - const char *__restrict __expbuf) __THROW;
> - -
> - -/* Match the beginning of STRING with the compiled regular expression
> - - in EXPBUF. If the match is successful `loc2' will contain the
> - - position of the first unmatched character. */
> - -extern int advance (const char *__restrict __string,
> - - const char *__restrict __expbuf) __THROW;
> - -
> - -
> - -__END_DECLS
> +#error "The GNU C Library no longer implements <regexp.h>."
> +#error "Please update your code to use <regex.h> instead (no trailing 'p')."
>
> #endif /* regexp.h */
> - --
> 2.5.0
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v2
>
> iQIcBAEBCAAGBQJVwik2AAoJEJH8wytnaapkPyUP/1mEVmSyTkoia9fvVl1GI+6w
> A2pK+58hN8jsCHhp4YWSWcMCsTdKWGqQXbExFmJHeDrlPs+E6h60LtKrdaIbR343
> ucdgXRB6F6bvq0vuNIVuvFqTCgj+oMi2Nh4eu8mmc+Om+UmLqsKiopulNQ3AGEXN
> jqDV+3dYnbC4ydtP8C5xdiEfpovv1uJEETWmWKOC8KkRwDHxP5tNa5Qr5zW8b+Ky
> TaVVbRYANAzqKQXoolgJ54ohem1sxpsJ6BtL+/YHnBAVcctPOpZ3Ci3jaZ72/ZDf
> J4rVuLZHolqULiqQoSeItRlTSSzJZKxd/XDJlhTSvnoLAes01DdvhEZtELLHYoMR
> rOhYg03cvGU8g8O0WBEVzXr0xXLbV12mUcZo9vF+ftDvF5DEhqWssps1N5ScYanL
> FGibVDqWJCHg8krsJvVq0+vTofydYjl8ctZpBZKNjTG52WJC9tN2Q0jF73Jqv98T
> sR7SRc0sxIaO5nUnGMSYOW3e7S+Hxb5plicmCJEWW6ATaVqbM6062Uldr4keQzlP
> EDyCfBDpBXWxSHj4LKYau08ODMqvYtNPEqtx8tHPXN62yT+qJ6DV352HerdmSP6y
> Q4p73oifmG4nJFPMJ4BKo1GMJXqmusNn8LVe5wGiU+iPR6+LjciA86Oi4ORa7msl
> o/TRGNV931M7ohc3uZID
> =7aEz
> -----END PGP SIGNATURE-----
>
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [2.23 PATCH] Desupport regexp.h (bug 18681)
2015-08-17 8:50 ` Stefan Liebler
@ 2015-08-17 13:30 ` Zack Weinberg
2015-08-17 13:56 ` Mike Frysinger
0 siblings, 1 reply; 47+ messages in thread
From: Zack Weinberg @ 2015-08-17 13:30 UTC (permalink / raw)
To: libc-alpha
On 08/17/2015 04:50 AM, Stefan Liebler wrote:
> Hi,
>
> i get the following warning while compiling misc/regexp.c:
> gcc regexp.c -c -Wall -Werror -Wno-error=undef -Wundef
> ...
> In file included from regexp.c:28:0:
> ../include/shlib-compat.h:45:10: warning: "ABI_libc_GLIBC_2_23" is not
> defined [-Wundef]
...
>
> The generated abi-versions.h file does not contain a define for
> ABI_libc_GLIBC_2_23.
What architecture? abi-versions.h does contain that define for me:
$ grep libc_GLIBC_2_23 abi-versions.h
#define ABI_libc_GLIBC_2_23 25 /* support GLIBC_2.23 */
#define VERSION_libc_GLIBC_2_23 GLIBC_2.23
$ ../glibc/scripts/config.guess
x86_64-unknown-linux-gnu
zw
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [2.23 PATCH] Desupport regexp.h (bug 18681)
2015-08-17 13:30 ` Zack Weinberg
@ 2015-08-17 13:56 ` Mike Frysinger
2015-08-17 14:37 ` Zack Weinberg
2015-08-17 16:26 ` Carlos O'Donell
0 siblings, 2 replies; 47+ messages in thread
From: Mike Frysinger @ 2015-08-17 13:56 UTC (permalink / raw)
To: Zack Weinberg; +Cc: libc-alpha
[-- Attachment #1: Type: text/plain, Size: 922 bytes --]
On 17 Aug 2015 09:30, Zack Weinberg wrote:
> On 08/17/2015 04:50 AM, Stefan Liebler wrote:
> > i get the following warning while compiling misc/regexp.c:
> > gcc regexp.c -c -Wall -Werror -Wno-error=undef -Wundef
> > ...
> > In file included from regexp.c:28:0:
> > ../include/shlib-compat.h:45:10: warning: "ABI_libc_GLIBC_2_23" is not
> > defined [-Wundef]
> ...
> >
> > The generated abi-versions.h file does not contain a define for
> > ABI_libc_GLIBC_2_23.
>
> What architecture? abi-versions.h does contain that define for me:
>
> $ grep libc_GLIBC_2_23 abi-versions.h
> #define ABI_libc_GLIBC_2_23 25 /* support GLIBC_2.23 */
> #define VERSION_libc_GLIBC_2_23 GLIBC_2.23
>
> $ ../glibc/scripts/config.guess
> x86_64-unknown-linux-gnu
i think each subdir Versions file has to be consistent with the code in it.
since misc/ was updated, misc/Versions has to cover it explicitly.
-mike
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [2.23 PATCH] Desupport regexp.h (bug 18681)
2015-08-17 13:56 ` Mike Frysinger
@ 2015-08-17 14:37 ` Zack Weinberg
2015-08-17 14:52 ` Andreas Schwab
2015-08-17 16:26 ` Carlos O'Donell
1 sibling, 1 reply; 47+ messages in thread
From: Zack Weinberg @ 2015-08-17 14:37 UTC (permalink / raw)
To: GNU C Library
Do you mean like this? I can't test it as the problem is invisible to me.
diff --git a/misc/Versions b/misc/Versions
index 534d1a3..178bb76 100644
--- a/misc/Versions
+++ b/misc/Versions
@@ -149,6 +149,9 @@ libc {
GLIBC_2.16 {
__getauxval; getauxval;
}
+ GLIBC_2.23 {
+ # stub for SHLIB_COMPAT(GLIBC_2_0, GLIBC_2_23) in regexp.c
+ }
GLIBC_PRIVATE {
__madvise;
__mktemp;
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [2.23 PATCH] Desupport regexp.h (bug 18681)
2015-08-17 14:37 ` Zack Weinberg
@ 2015-08-17 14:52 ` Andreas Schwab
2015-08-17 15:08 ` Zack Weinberg
0 siblings, 1 reply; 47+ messages in thread
From: Andreas Schwab @ 2015-08-17 14:52 UTC (permalink / raw)
To: Zack Weinberg; +Cc: GNU C Library
Zack Weinberg <zackw@panix.com> writes:
> Do you mean like this? I can't test it as the problem is invisible to me.
Are you building from a clean tree?
Andreas.
--
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [2.23 PATCH] Desupport regexp.h (bug 18681)
2015-08-17 14:52 ` Andreas Schwab
@ 2015-08-17 15:08 ` Zack Weinberg
2015-08-17 15:28 ` Zack Weinberg
0 siblings, 1 reply; 47+ messages in thread
From: Zack Weinberg @ 2015-08-17 15:08 UTC (permalink / raw)
To: Andreas Schwab; +Cc: GNU C Library
On Mon, Aug 17, 2015 at 10:51 AM, Andreas Schwab <schwab@suse.de> wrote:
> Zack Weinberg <zackw@panix.com> writes:
>
>> Do you mean like this? I can't test it as the problem is invisible to me.
>
> Are you building from a clean tree?
Yes, I have erased the entire build directory and re-run configure
several times during testing of this patch. It didn't compile till
Carlos cut the 2.22 branch but then it magically started working, so I
assumed that the release process did whatever was necessary.
Just now I did this again and also ran `git clean -dxf` in the source
tree (which deleted only editor backups) and -- this is a little weird
-- it compiles without complaint, but the VERSION_libc_GLIBC_2_xx
#defines in abi-versions.h only go up to 2_22.
I'm using gcc 5.2 (because Debian's 4.9 refused to compile the library
last month, with errors I didn't bother digging into), is that
possibly relevant?
zw
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [2.23 PATCH] Desupport regexp.h (bug 18681)
2015-08-17 15:08 ` Zack Weinberg
@ 2015-08-17 15:28 ` Zack Weinberg
2015-08-18 7:28 ` Stefan Liebler
2015-08-18 13:29 ` Mike Frysinger
0 siblings, 2 replies; 47+ messages in thread
From: Zack Weinberg @ 2015-08-17 15:28 UTC (permalink / raw)
To: Andreas Schwab; +Cc: GNU C Library
[-- Attachment #1: Type: text/plain, Size: 585 bytes --]
On Mon, Aug 17, 2015 at 11:08 AM, Zack Weinberg <zackw@panix.com> wrote:
> Just now I did this again and also ran `git clean -dxf` in the source
> tree (which deleted only editor backups) and -- this is a little weird
> -- it compiles without complaint, but the VERSION_libc_GLIBC_2_xx
> #defines in abi-versions.h only go up to 2_22.
I take that back. I *am* getting the same warning as Stefan, it just
didn't cause a build failure and scrolled off the top of my terminal.
The misc/Versions change suggested by Mike does cure the problem, so
here is a properly formatted patch.
zw
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-misc-Versions-Add-empty-GLIBC_2.23-stanza-to-prevent.patch --]
[-- Type: text/x-patch; name="0001-misc-Versions-Add-empty-GLIBC_2.23-stanza-to-prevent.patch", Size: 515 bytes --]
* misc/Versions: Add empty GLIBC_2.23 stanza, to prevent
undefined macro warnings in regexp.c.
---
misc/Versions | 3 +++
1 file changed, 3 insertions(+)
diff --git a/misc/Versions b/misc/Versions
index 534d1a3..671f487 100644
--- a/misc/Versions
+++ b/misc/Versions
@@ -149,6 +149,9 @@ libc {
GLIBC_2.16 {
__getauxval; getauxval;
}
+ GLIBC_2.23 {
+ # SHLIB_COMPAT(GLIBC_2_0, GLIBC_2_23) used in regexp.c
+ }
GLIBC_PRIVATE {
__madvise;
__mktemp;
--
2.5.0
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [2.23 PATCH] Desupport regexp.h (bug 18681)
2015-08-16 14:45 ` Andreas Schwab
2015-08-16 15:19 ` Zack Weinberg
@ 2015-08-17 16:22 ` Carlos O'Donell
1 sibling, 0 replies; 47+ messages in thread
From: Carlos O'Donell @ 2015-08-17 16:22 UTC (permalink / raw)
To: Andreas Schwab, Zack Weinberg; +Cc: libc-alpha
On 08/16/2015 10:45 AM, Andreas Schwab wrote:
> Zack Weinberg <zackw@panix.com> writes:
>
>> * misc/regexp.h: This interface is no longer supported.
>> Remove all contents, leaving only an #error directive.
>> * misc/regexp.c (loc1, loc2, locs, step, advance):
>> Demote to compatibility symbols.
>
> Ok.
>
> Andreas.
Thanks for committing this Andreas.
Cheers,
Carlos.
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [2.23 PATCH] Desupport regexp.h (bug 18681)
2015-08-17 13:56 ` Mike Frysinger
2015-08-17 14:37 ` Zack Weinberg
@ 2015-08-17 16:26 ` Carlos O'Donell
2015-08-17 16:53 ` Joseph Myers
1 sibling, 1 reply; 47+ messages in thread
From: Carlos O'Donell @ 2015-08-17 16:26 UTC (permalink / raw)
To: Zack Weinberg, libc-alpha
On 08/17/2015 09:56 AM, Mike Frysinger wrote:
> On 17 Aug 2015 09:30, Zack Weinberg wrote:
>> On 08/17/2015 04:50 AM, Stefan Liebler wrote:
>>> i get the following warning while compiling misc/regexp.c:
>>> gcc regexp.c -c -Wall -Werror -Wno-error=undef -Wundef
>>> ...
>>> In file included from regexp.c:28:0:
>>> ../include/shlib-compat.h:45:10: warning: "ABI_libc_GLIBC_2_23" is not
>>> defined [-Wundef]
>> ...
>>>
>>> The generated abi-versions.h file does not contain a define for
>>> ABI_libc_GLIBC_2_23.
>>
>> What architecture? abi-versions.h does contain that define for me:
>>
>> $ grep libc_GLIBC_2_23 abi-versions.h
>> #define ABI_libc_GLIBC_2_23 25 /* support GLIBC_2.23 */
>> #define VERSION_libc_GLIBC_2_23 GLIBC_2.23
>>
>> $ ../glibc/scripts/config.guess
>> x86_64-unknown-linux-gnu
>
> i think each subdir Versions file has to be consistent with the code in it.
> since misc/ was updated, misc/Versions has to cover it explicitly.
> -mike
>
One of the big benefits of -Wundef -Werror was to prevent this kind
of error from happening. We made the build use -Wundef, and that way
if you failed to define the right things in Versions it would fail
the build (see the problem we had with librt symbols in 2.18 that
prompted the entire -Wundef work).
How was Zack able to build glibc at all?
c.
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [2.23 PATCH] Desupport regexp.h (bug 18681)
2015-08-17 16:26 ` Carlos O'Donell
@ 2015-08-17 16:53 ` Joseph Myers
2015-08-17 17:07 ` Carlos O'Donell
0 siblings, 1 reply; 47+ messages in thread
From: Joseph Myers @ 2015-08-17 16:53 UTC (permalink / raw)
To: Carlos O'Donell; +Cc: Zack Weinberg, libc-alpha
On Mon, 17 Aug 2015, Carlos O'Donell wrote:
> One of the big benefits of -Wundef -Werror was to prevent this kind
> of error from happening. We made the build use -Wundef, and that way
> if you failed to define the right things in Versions it would fail
> the build (see the problem we had with librt symbols in 2.18 that
> prompted the entire -Wundef work).
>
> How was Zack able to build glibc at all?
We never removed -Wno-error=undef, because while we got the glibc build
itself clean from -Wundef warnings, we didn't achieve that for the
testsuite.
--
Joseph S. Myers
joseph@codesourcery.com
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [2.23 PATCH] Desupport regexp.h (bug 18681)
2015-08-17 16:53 ` Joseph Myers
@ 2015-08-17 17:07 ` Carlos O'Donell
2015-08-17 17:19 ` Joseph Myers
0 siblings, 1 reply; 47+ messages in thread
From: Carlos O'Donell @ 2015-08-17 17:07 UTC (permalink / raw)
To: Joseph Myers; +Cc: Zack Weinberg, libc-alpha
On 08/17/2015 12:53 PM, Joseph Myers wrote:
> On Mon, 17 Aug 2015, Carlos O'Donell wrote:
>
>> One of the big benefits of -Wundef -Werror was to prevent this kind
>> of error from happening. We made the build use -Wundef, and that way
>> if you failed to define the right things in Versions it would fail
>> the build (see the problem we had with librt symbols in 2.18 that
>> prompted the entire -Wundef work).
>>
>> How was Zack able to build glibc at all?
>
> We never removed -Wno-error=undef, because while we got the glibc build
> itself clean from -Wundef warnings, we didn't achieve that for the
> testsuite.
>
Dag nabit. OK, I guess I know what I'm doing for 2.23.
c.
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [2.23 PATCH] Desupport regexp.h (bug 18681)
2015-08-17 17:07 ` Carlos O'Donell
@ 2015-08-17 17:19 ` Joseph Myers
0 siblings, 0 replies; 47+ messages in thread
From: Joseph Myers @ 2015-08-17 17:19 UTC (permalink / raw)
To: Carlos O'Donell; +Cc: Zack Weinberg, libc-alpha
On Mon, 17 Aug 2015, Carlos O'Donell wrote:
> On 08/17/2015 12:53 PM, Joseph Myers wrote:
> > On Mon, 17 Aug 2015, Carlos O'Donell wrote:
> >
> >> One of the big benefits of -Wundef -Werror was to prevent this kind
> >> of error from happening. We made the build use -Wundef, and that way
> >> if you failed to define the right things in Versions it would fail
> >> the build (see the problem we had with librt symbols in 2.18 that
> >> prompted the entire -Wundef work).
> >>
> >> How was Zack able to build glibc at all?
> >
> > We never removed -Wno-error=undef, because while we got the glibc build
> > itself clean from -Wundef warnings, we didn't achieve that for the
> > testsuite.
> >
>
> Dag nabit. OK, I guess I know what I'm doing for 2.23.
I think Zack's misc/Versions patch plus my two testsuite patches are
sufficient to eliminate -Wundef warnings on x86_64 and x86 (though I
haven't done a build with -Wno-error=undef removed to make sure).
--
Joseph S. Myers
joseph@codesourcery.com
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [2.23 PATCH] Desupport regexp.h (bug 18681)
2015-08-17 15:28 ` Zack Weinberg
@ 2015-08-18 7:28 ` Stefan Liebler
2015-08-18 13:29 ` Mike Frysinger
1 sibling, 0 replies; 47+ messages in thread
From: Stefan Liebler @ 2015-08-18 7:28 UTC (permalink / raw)
To: libc-alpha
On 08/17/2015 05:28 PM, Zack Weinberg wrote:
> On Mon, Aug 17, 2015 at 11:08 AM, Zack Weinberg <zackw@panix.com> wrote:
>> Just now I did this again and also ran `git clean -dxf` in the source
>> tree (which deleted only editor backups) and -- this is a little weird
>> -- it compiles without complaint, but the VERSION_libc_GLIBC_2_xx
>> #defines in abi-versions.h only go up to 2_22.
>
> I take that back. I *am* getting the same warning as Stefan, it just
> didn't cause a build failure and scrolled off the top of my terminal.
> The misc/Versions change suggested by Mike does cure the problem, so
> here is a properly formatted patch.
>
> zw
>
For information: the testet architectures were s390x and x86_64.
VERSION_libc_GLIBC_2_23 is defined with this patch and the warning does
not occur anymore. Verified on both architectures.
Bye
Stefan
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [2.23 PATCH] Desupport regexp.h (bug 18681)
2015-08-17 15:28 ` Zack Weinberg
2015-08-18 7:28 ` Stefan Liebler
@ 2015-08-18 13:29 ` Mike Frysinger
2015-08-18 14:51 ` Carlos O'Donell
1 sibling, 1 reply; 47+ messages in thread
From: Mike Frysinger @ 2015-08-18 13:29 UTC (permalink / raw)
To: Zack Weinberg; +Cc: Andreas Schwab, GNU C Library
[-- Attachment #1: Type: text/plain, Size: 684 bytes --]
On 17 Aug 2015 11:28, Zack Weinberg wrote:
> On Mon, Aug 17, 2015 at 11:08 AM, Zack Weinberg <zackw@panix.com> wrote:
> > Just now I did this again and also ran `git clean -dxf` in the source
> > tree (which deleted only editor backups) and -- this is a little weird
> > -- it compiles without complaint, but the VERSION_libc_GLIBC_2_xx
> > #defines in abi-versions.h only go up to 2_22.
>
> I take that back. I *am* getting the same warning as Stefan, it just
> didn't cause a build failure and scrolled off the top of my terminal.
> The misc/Versions change suggested by Mike does cure the problem, so
> here is a properly formatted patch.
thanks, merged now
-mike
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [2.23 PATCH] Desupport regexp.h (bug 18681)
2015-08-18 13:29 ` Mike Frysinger
@ 2015-08-18 14:51 ` Carlos O'Donell
2015-08-18 16:37 ` Zack Weinberg
0 siblings, 1 reply; 47+ messages in thread
From: Carlos O'Donell @ 2015-08-18 14:51 UTC (permalink / raw)
To: Zack Weinberg, Andreas Schwab, GNU C Library
On 08/18/2015 09:29 AM, Mike Frysinger wrote:
> On 17 Aug 2015 11:28, Zack Weinberg wrote:
>> On Mon, Aug 17, 2015 at 11:08 AM, Zack Weinberg <zackw@panix.com> wrote:
>>> Just now I did this again and also ran `git clean -dxf` in the source
>>> tree (which deleted only editor backups) and -- this is a little weird
>>> -- it compiles without complaint, but the VERSION_libc_GLIBC_2_xx
>>> #defines in abi-versions.h only go up to 2_22.
>>
>> I take that back. I *am* getting the same warning as Stefan, it just
>> didn't cause a build failure and scrolled off the top of my terminal.
>> The misc/Versions change suggested by Mike does cure the problem, so
>> here is a properly formatted patch.
>
> thanks, merged now
> -mike
Mike, Zack,
Could one of you please update "Packaging Changes" for 2.23 to indicate
exactly what happens if you use the header and how distributions should
change their packages? The more detail the better, but if all we can say
is "You need to from this API to that API," that's fine also. Some record
of this requirement is important.
https://sourceware.org/glibc/wiki/Release/2.23#Packaging_Changes
Cheers,
Carlos.
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [2.23 PATCH] Desupport regexp.h (bug 18681)
2015-08-18 14:51 ` Carlos O'Donell
@ 2015-08-18 16:37 ` Zack Weinberg
2015-08-18 18:55 ` Carlos O'Donell
0 siblings, 1 reply; 47+ messages in thread
From: Zack Weinberg @ 2015-08-18 16:37 UTC (permalink / raw)
To: Carlos O'Donell; +Cc: Andreas Schwab, GNU C Library
On Tue, Aug 18, 2015 at 10:51 AM, Carlos O'Donell <carlos@redhat.com> wrote:
>
> Could one of you please update "Packaging Changes" for 2.23 to indicate
> exactly what happens if you use the header and how distributions should
> change their packages? The more detail the better, but if all we can say
> is "You need to from this API to that API," that's fine also. Some record
> of this requirement is important.
Here's suggested text. If you grant wiki account 'ZackWeinberg'
permission to edit, I can take care of formatting and stuff.
zw
* The header file `regexp.h` (not to be confused with `regex.h`) is
no longer supported. (This header was formerly part of SUS, but was
deprecated in 1994 and removed from the standard in 2001; moreover,
the glibc implementation suffered from memory leaks which were
impractical to fix. See
https://sourceware.org/bugzilla/show_bug.cgi?id=18681 for more
information.)
Binary backward compatibility is preserved, and glibc still
installs a header file with this name, but it contains only an
`#error` directive. Therefore, no packaging changes are required, but
application developers and distribution maintainers should be aware
that formerly-working programs may fail to compile as a result of this
change. Such programs should be updated to use `regex.h` instead.
`regcomp` is the replacement for the `compile` function and its
associated macros, and `regexec` is the replacement for the `step` and
`advance` functions and their associated global variables. [link each
function name to its documentation]
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [2.23 PATCH] Desupport regexp.h (bug 18681)
2015-08-18 16:37 ` Zack Weinberg
@ 2015-08-18 18:55 ` Carlos O'Donell
2015-08-18 19:21 ` Zack Weinberg
0 siblings, 1 reply; 47+ messages in thread
From: Carlos O'Donell @ 2015-08-18 18:55 UTC (permalink / raw)
To: Zack Weinberg; +Cc: Andreas Schwab, GNU C Library
On 08/18/2015 12:37 PM, Zack Weinberg wrote:
> On Tue, Aug 18, 2015 at 10:51 AM, Carlos O'Donell <carlos@redhat.com> wrote:
>>
>> Could one of you please update "Packaging Changes" for 2.23 to indicate
>> exactly what happens if you use the header and how distributions should
>> change their packages? The more detail the better, but if all we can say
>> is "You need to from this API to that API," that's fine also. Some record
>> of this requirement is important.
>
> Here's suggested text. If you grant wiki account 'ZackWeinberg'
> permission to edit, I can take care of formatting and stuff.
Done. You're in the EditorGroup now.
> zw
>
> * The header file `regexp.h` (not to be confused with `regex.h`) is
> no longer supported. (This header was formerly part of SUS, but was
> deprecated in 1994 and removed from the standard in 2001; moreover,
> the glibc implementation suffered from memory leaks which were
> impractical to fix. See
> https://sourceware.org/bugzilla/show_bug.cgi?id=18681 for more
> information.)
>
> Binary backward compatibility is preserved, and glibc still
> installs a header file with this name, but it contains only an
> `#error` directive. Therefore, no packaging changes are required, but
> application developers and distribution maintainers should be aware
> that formerly-working programs may fail to compile as a result of this
> change. Such programs should be updated to use `regex.h` instead.
> `regcomp` is the replacement for the `compile` function and its
> associated macros, and `regexec` is the replacement for the `step` and
> `advance` functions and their associated global variables. [link each
> function name to its documentation]
>
Looks good to me. I know we have distro people watching our release
pages and they look for guidance from us here, so I'll point any package
fails in Fedora to this note.
c.
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [2.23 PATCH] Desupport regexp.h (bug 18681)
2015-08-18 18:55 ` Carlos O'Donell
@ 2015-08-18 19:21 ` Zack Weinberg
2015-08-18 19:42 ` Carlos O'Donell
0 siblings, 1 reply; 47+ messages in thread
From: Zack Weinberg @ 2015-08-18 19:21 UTC (permalink / raw)
To: Carlos O'Donell; +Cc: Andreas Schwab, GNU C Library
OK, I have added the text with some slight revisions. I could not
figure out how to put monospace text inside a hyperlink so the
formatting is slightly inconsistent.
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [2.23 PATCH] Desupport regexp.h (bug 18681)
2015-08-18 19:21 ` Zack Weinberg
@ 2015-08-18 19:42 ` Carlos O'Donell
0 siblings, 0 replies; 47+ messages in thread
From: Carlos O'Donell @ 2015-08-18 19:42 UTC (permalink / raw)
To: Zack Weinberg; +Cc: Andreas Schwab, GNU C Library
On 08/18/2015 03:20 PM, Zack Weinberg wrote:
> OK, I have added the text with some slight revisions. I could not
> figure out how to put monospace text inside a hyperlink so the
> formatting is slightly inconsistent.
I have never tried hard to make it work. I would be tempted to do:
`regcomp`[''''''[[https://www.gnu.org/software/libc/manual/html_node/POSIX-Regexp-Compilation.html|1]]'''''']
...
[1] https://www.gnu.org/software/libc/manual/html_node/POSIX-Regexp-Compilation.html
Note: The use of '''''' (SixQuotes) causes the parser to reset and allow you to surround
a square bracket quote with more square brackets.
c.
^ permalink raw reply [flat|nested] 47+ messages in thread
end of thread, other threads:[~2015-08-18 19:42 UTC | newest]
Thread overview: 47+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-12 19:55 [PATCH] Kill regexp.h Zack Weinberg
2015-07-12 20:46 ` Andreas Schwab
2015-07-12 21:58 ` Zack Weinberg
2015-07-13 5:30 ` Kalle Olavi Niemitalo
2015-07-14 21:21 ` Carlos O'Donell
2015-07-15 0:20 ` Zack Weinberg
2015-07-15 13:12 ` Carlos O'Donell
2015-07-15 13:56 ` Zack Weinberg
2015-07-21 18:09 ` Zack Weinberg
2015-07-21 23:59 ` Mike Frysinger
2015-07-25 3:45 ` Carlos O'Donell
2015-07-25 3:59 ` Carlos O'Donell
2015-07-25 14:42 ` Zack Weinberg
2015-07-27 15:07 ` Joseph Myers
2015-07-27 15:28 ` Zack Weinberg
2015-07-27 15:45 ` Joseph Myers
2015-07-15 4:01 ` Mike Frysinger
2015-07-15 13:15 ` Zack Weinberg
2015-08-05 15:21 ` [2.23 PATCH] Desupport regexp.h (bug 18681) Zack Weinberg
2015-08-06 2:40 ` Mike Frysinger
2015-08-07 1:16 ` Zack Weinberg
2015-08-07 2:14 ` Mike Frysinger
2015-08-14 13:48 ` Zack Weinberg
2015-08-16 14:20 ` Zack Weinberg
2015-08-16 14:45 ` Andreas Schwab
2015-08-16 15:19 ` Zack Weinberg
2015-08-17 16:22 ` Carlos O'Donell
2015-08-17 8:50 ` Stefan Liebler
2015-08-17 13:30 ` Zack Weinberg
2015-08-17 13:56 ` Mike Frysinger
2015-08-17 14:37 ` Zack Weinberg
2015-08-17 14:52 ` Andreas Schwab
2015-08-17 15:08 ` Zack Weinberg
2015-08-17 15:28 ` Zack Weinberg
2015-08-18 7:28 ` Stefan Liebler
2015-08-18 13:29 ` Mike Frysinger
2015-08-18 14:51 ` Carlos O'Donell
2015-08-18 16:37 ` Zack Weinberg
2015-08-18 18:55 ` Carlos O'Donell
2015-08-18 19:21 ` Zack Weinberg
2015-08-18 19:42 ` Carlos O'Donell
2015-08-17 16:26 ` Carlos O'Donell
2015-08-17 16:53 ` Joseph Myers
2015-08-17 17:07 ` Carlos O'Donell
2015-08-17 17:19 ` Joseph Myers
2015-08-05 15:21 ` [2.22 PATCH] Correct comments about the history of <regexp.h> Zack Weinberg
2015-08-06 2:37 ` Mike Frysinger
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).