public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Thomas Schwinge <thomas@codesourcery.com>
To: Janne Blomqvist <blomqvist.janne@gmail.com>
Cc: Fortran List <fortran@gcc.gnu.org>,
	GCC Patches <gcc-patches@gcc.gnu.org>,
	Jerry DeLisle <jvdelisle@charter.net>
Subject: Re: [PATCH] Don't assume __secure_getenv is available
Date: Fri, 12 May 2017 08:14:00 -0000	[thread overview]
Message-ID: <87r2zu33ks.fsf@hertz.schwinge.homeip.net> (raw)
In-Reply-To: <CAO9iq9EuWUuSDvUy=xfqyjAqXwpXF7-C1OuitLof2DQ6RH6Znw@mail.gmail.com>

Hi!

On Fri, 12 May 2017 10:26:59 +0300, Janne Blomqvist <blomqvist.janne@gmail.com> wrote:
> On Fri, May 12, 2017 at 10:23 AM, Thomas Schwinge
> <thomas@codesourcery.com> wrote:
> > On Thu, 27 Apr 2017 21:50:51 +0300, Janne Blomqvist <blomqvist.janne@gmail.com> 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"?  ;-)
> 
> Oops. I'm not at my gcc development box now, please consider a patch
> to fix this pre-approved.
> 
> 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 <tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4>
Date:   Fri May 12 07:56:41 2017 +0000

    Typo fixes for "Don't assume __secure_getenv is available"
    
            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.
    
    git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@247952 138bc75d-0d04-0410-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  <thomas@codesourcery.com>
+
+	* 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  <jb@gcc.gnu.org>
 
 	* 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
 
 #if SUPPORTS_WEAKREF && defined(HAVE___SECURE_GETENV)
 static char* weak_secure_getenv (const char*)
-  __attribute__((__weakref__("__secure_gettime")));
+  __attribute__((__weakref__("__secure_getenv")));
 #endif
 
 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üße
 Thomas

  reply	other threads:[~2017-05-12  8:02 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-27 13:15 [PATCH] Don't check for __secure_getenv Janne Blomqvist
2017-04-27 13:24 ` Jakub Jelinek
2017-04-27 19:27   ` [PATCH] Don't assume __secure_getenv is available Janne Blomqvist
2017-04-27 19:33     ` Janne Blomqvist
2017-05-08  6:37       ` Janne Blomqvist via gcc-patches
2017-05-08 17:37         ` Jerry DeLisle
2017-05-12  7:24     ` Thomas Schwinge
2017-05-12  7:32       ` Janne Blomqvist
2017-05-12  8:14         ` Thomas Schwinge [this message]
2017-05-12  8:16           ` Janne Blomqvist

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87r2zu33ks.fsf@hertz.schwinge.homeip.net \
    --to=thomas@codesourcery.com \
    --cc=blomqvist.janne@gmail.com \
    --cc=fortran@gcc.gnu.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jvdelisle@charter.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).