From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 33432 invoked by alias); 12 May 2017 08:02:58 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 33361 invoked by uid 89); 12 May 2017 08:02:57 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.4 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE,SPF_PASS,URIBL_RED autolearn=ham version=3.3.2 spammy= X-Spam-User: qpsmtpd, 2 recipients X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 12 May 2017 08:02:55 +0000 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=svr-ies-mbx-01.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1d95XK-0000ZX-P5 from Thomas_Schwinge@mentor.com ; Fri, 12 May 2017 01:02:54 -0700 Received: from hertz.schwinge.homeip.net (137.202.0.87) by svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) with Microsoft SMTP Server (TLS) id 15.0.1210.3; Fri, 12 May 2017 09:02:51 +0100 From: Thomas Schwinge To: Janne Blomqvist CC: Fortran List , GCC Patches , Jerry DeLisle Subject: Re: [PATCH] Don't assume __secure_getenv is available In-Reply-To: References: <20170427125804.GZ1809@tucnak> <1493319051-25795-1-git-send-email-blomqvist.janne@gmail.com> <877f1mzggt.fsf@euler.schwinge.homeip.net> User-Agent: Notmuch/0.9-101-g81dad07 (http://notmuchmail.org) Emacs/24.5.1 (x86_64-pc-linux-gnu) Date: Fri, 12 May 2017 08:14:00 -0000 Message-ID: <87r2zu33ks.fsf@hertz.schwinge.homeip.net> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) To svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) X-SW-Source: 2017-05/txt/msg00991.txt.bz2 Hi! On Fri, 12 May 2017 10:26:59 +0300, Janne Blomqvist wrote: > On Fri, May 12, 2017 at 10:23 AM, Thomas Schwinge > wrote: > > On Thu, 27 Apr 2017 21:50:51 +0300, Janne Blomqvist wrote: > >> [...], retain the support for __secure_getenv but call it only via a > >> weak reference. > >> > >> Regtested on x86_64-pc-linux-gnu, Ok for trunk, 7.x when it reopens, > >> 6, 5? > > > > Hmm, how has this been tested? Because: > > > >> --- a/libgfortran/runtime/environ.c > >> +++ b/libgfortran/runtime/environ.c > > > >> #ifdef FALLBACK_SECURE_GETENV > >> + > >> +#if SUPPORTS_WEAKREF && defined(HAVE___SECURE_GETENV) > >> +static char* weak_secure_getenv (const char*) > >> + __attribute__((__weakref__("__secure_gettime"))); > >> +#endif > > > > "gettime" vs. "getenv"? ;-) >=20 > Oops. I'm not at my gcc development box now, please consider a patch > to fix this pre-approved. >=20 > As for testing, I regtested, but my gcc development machine has glibc > 2.23 which has secure_getenv so it doesn't exercise the fallback > path.. Then, that clearly isn't an appropriate testing methodology? What I do in such cases is manually induce the expected environment (for example, here I'd probably try hacking out "HAVE_SECURE_GETENV" and "HAVE___SECURE_GETENV" from the generated "config.h" or even "libgfortran/configure"), and then manually run something that is expected to behave differently in an environment relevant to "secure_getenv" -- I doubt that such a thing is being (or, can really be) included in the GCC testsuite? Still untested -- ;-) -- but including another typo fix, committed to trunk in r247952: commit bc9457364b4b9a847c91e35a0aa5fc3b73df53a0 Author: tschwinge Date: Fri May 12 07:56:41 2017 +0000 Typo fixes for "Don't assume __secure_getenv is available" =20=20=20=20 libgfortran/ * runtime/environ.c (weak_secure_getenv): Fix "__secure_gettime" vs. "__secure_getenv" typo. (secure_getenv): Fix "HAVE__SECURE_GETENV" vs. "HAVE___SECURE_GETENV" typo. =20=20=20=20 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@247952 138bc75d-0d04-04= 10-961f-82ee72b054a4 --- libgfortran/ChangeLog | 7 +++++++ libgfortran/runtime/environ.c | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git libgfortran/ChangeLog libgfortran/ChangeLog index 337daaf..6b7da0a 100644 --- libgfortran/ChangeLog +++ libgfortran/ChangeLog @@ -1,3 +1,10 @@ +2017-05-12 Thomas Schwinge + + * runtime/environ.c (weak_secure_getenv): Fix "__secure_gettime" + vs. "__secure_getenv" typo. + (secure_getenv): Fix "HAVE__SECURE_GETENV" + vs. "HAVE___SECURE_GETENV" typo. + 2017-05-11 Janne Blomqvist =20 * libgfortran.h: HAVE_SECURE_GETENV: Don't check diff --git libgfortran/runtime/environ.c libgfortran/runtime/environ.c index 969dcdf..f0a593e 100644 --- libgfortran/runtime/environ.c +++ libgfortran/runtime/environ.c @@ -40,13 +40,13 @@ see the files COPYING3 and COPYING.RUNTIME respectively= . If not, see =20 #if SUPPORTS_WEAKREF && defined(HAVE___SECURE_GETENV) static char* weak_secure_getenv (const char*) - __attribute__((__weakref__("__secure_gettime"))); + __attribute__((__weakref__("__secure_getenv"))); #endif =20 char * secure_getenv (const char *name) { -#if SUPPORTS_WEAKREF && defined(HAVE__SECURE_GETENV) +#if SUPPORTS_WEAKREF && defined(HAVE___SECURE_GETENV) if (weak_secure_getenv) return weak_secure_getenv (name); #endif Gr=C3=BC=C3=9Fe Thomas