From patchwork Wed Jul 15 13:56:06 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zack Weinberg X-Patchwork-Id: 495852 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3235D1402A8 for ; Wed, 15 Jul 2015 23:56:26 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b=tpbb1a2W; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:message-id:date:from:mime-version:to:cc :subject:references:in-reply-to:content-type; q=dns; s=default; b= E4ZHzYE1/aa05x/EO/w31qoswzdVy4aC7WJRTHsAE6JLuLAHvYKli1/Sl6N+qPI3 gIlYNAm3C3wnR0sdIrkkNLujhCCe0PePI+PNMzNs1OAwY4F1dHdFCSr+cL19Oc/h zaVTj85xde20OQdTf0Dsbws0TrRBBgGcjXtYdclaPrg= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:message-id:date:from:mime-version:to:cc :subject:references:in-reply-to:content-type; s=default; bh=Hfvr tzROpeElMmxU+Kl8P4zzJHM=; b=tpbb1a2WRwiIfc2yWXvNQrhVuW3cwnhxndUC 4WCGeGqfr3QQ0ZsRefGYe7Bq+5CH18mOv7rkpoIVG+MHPjVBMPDLcetkWnXFoPI2 VpKWssnWmusXmdRPFxcm9eB/Z1ygzrnlLYxqQdgnQo+XDWwn6Jb3smsyYxC6lTSz V7oaTdM= Received: (qmail 122075 invoked by alias); 15 Jul 2015 13:56:21 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 121431 invoked by uid 89); 15 Jul 2015 13:56:20 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-qg0-f47.google.com X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type; bh=XHpWZCDUztexJ7V+ER0w7GPw4Y0NtSQSDXE/vN4kS00=; b=HKi3KO6oSsuuNXPfI8nq0Oo7vHVcWuGKohFuWqW8bVl/DyV33R3nBsqlHYPFY5rvZp JvGza7jXdB285M5nGUsa8uodAvcmCWIsi4eOb8290alZ266XW5KCI9JAlPff5DghIUUk vs8+nxP00Y84rWDoIzoEsBNYeod/evHMWJyqjWj3sX11EbfheZ+ITcQORRYwLp+xW2KM 1r9BRqV6Y+S1ScN4wy28WVRq4TbtMZoxZ1+tI/psZDeoipKIqP+go3hzRSpRtYWXs5Uf WoxB0PZvmIXwDekEV7Sotz/7aNptaS7UEdlzxPSBG5piXevN/F1/evw7KwLNOrLRWR8l 4HxQ== X-Received: by 10.140.238.146 with SMTP id j140mr1681618qhc.3.1436968575437; Wed, 15 Jul 2015 06:56:15 -0700 (PDT) Message-ID: <55A66676.7070500@panix.com> Date: Wed, 15 Jul 2015 09:56:06 -0400 From: Zack Weinberg User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.7.0 MIME-Version: 1.0 To: Carlos O'Donell CC: libc-alpha@sourceware.org Subject: Re: [PATCH] Kill regexp.h References: <20150712195501.D8E5C14B9A@panix1.panix.com> <55A57D59.4090104@redhat.com> <55A65C27.2020808@redhat.com> In-Reply-To: <55A65C27.2020808@redhat.com> 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(-) #include @@ -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); 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 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 instead. 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 . */ -#define __DO_NOT_DEFINE_COMPILE -#include +/* We don't include regexp.h here because of the macros it requires, and + because it now contains an unconditional #warning. */ + +#include /* 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 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 + 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