GNU bug report logs - #12714
[PATCH] build: do not redefine _FORTIFY_SOURCE

Previous Next

Package: coreutils;

Reported by: Mike Frysinger <vapier <at> gentoo.org>

Date: Tue, 23 Oct 2012 19:23:01 UTC

Severity: normal

Tags: patch

Done: Jim Meyering <jim <at> meyering.net>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 12714 in the body.
You can then email your comments to 12714 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-coreutils <at> gnu.org:
bug#12714; Package coreutils. (Tue, 23 Oct 2012 19:23:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Mike Frysinger <vapier <at> gentoo.org>:
New bug report received and forwarded. Copy sent to bug-coreutils <at> gnu.org. (Tue, 23 Oct 2012 19:23:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Mike Frysinger <vapier <at> gentoo.org>
To: bug-coreutils <at> gnu.org
Subject: [PATCH] build: do not redefine _FORTIFY_SOURCE
Date: Tue, 23 Oct 2012 15:20:07 -0400
If the active compiler or flags have already defined _FORTIFY_SOURCE,
don't go overriding that.  Otherwise we get a lot of spew about the
flag being redefined.

* configure.ac (FORTIFY_SOURCE): Check if _FORTIFY_SOURCE is defined.
---
 configure.ac | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index e5e05be..6504144 100644
--- a/configure.ac
+++ b/configure.ac
@@ -170,7 +170,7 @@ if test "$gl_gcc_warnings" = yes; then
   AH_VERBATIM([FORTIFY_SOURCE],
   [/* Enable compile-time and run-time bounds-checking, and some warnings,
       without upsetting glibc 2.15+. */
-   #if defined __OPTIMIZE__ && __OPTIMIZE__
+   #if !defined _FORTIFY_SOURCE && defined __OPTIMIZE__ && __OPTIMIZE__
    # define _FORTIFY_SOURCE 2
    #endif
   ])
-- 
1.7.12





Information forwarded to bug-coreutils <at> gnu.org:
bug#12714; Package coreutils. (Tue, 23 Oct 2012 19:29:02 GMT) Full text and rfc822 format available.

Message #8 received at 12714 <at> debbugs.gnu.org (full text, mbox):

From: Jim Meyering <jim <at> meyering.net>
To: Mike Frysinger <vapier <at> gentoo.org>
Cc: 12714 <at> debbugs.gnu.org
Subject: Re: bug#12714: [PATCH] build: do not redefine _FORTIFY_SOURCE
Date: Tue, 23 Oct 2012 21:26:14 +0200
Mike Frysinger wrote:
> If the active compiler or flags have already defined _FORTIFY_SOURCE,
> don't go overriding that.  Otherwise we get a lot of spew about the
> flag being redefined.
>
> * configure.ac (FORTIFY_SOURCE): Check if _FORTIFY_SOURCE is defined.
> ---
>  configure.ac | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/configure.ac b/configure.ac
> index e5e05be..6504144 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -170,7 +170,7 @@ if test "$gl_gcc_warnings" = yes; then
>    AH_VERBATIM([FORTIFY_SOURCE],
>    [/* Enable compile-time and run-time bounds-checking, and some warnings,
>        without upsetting glibc 2.15+. */
> -   #if defined __OPTIMIZE__ && __OPTIMIZE__
> +   #if !defined _FORTIFY_SOURCE && defined __OPTIMIZE__ && __OPTIMIZE__
>     # define _FORTIFY_SOURCE 2
>     #endif
>    ])

Thanks.  Please adjust the log (or just tell us and we'll adjust it)
so that we know which compiler motivates this change.




Information forwarded to bug-coreutils <at> gnu.org:
bug#12714; Package coreutils. (Tue, 23 Oct 2012 19:53:02 GMT) Full text and rfc822 format available.

Message #11 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Mike Frysinger <vapier <at> gentoo.org>
To: bug-coreutils <at> gnu.org
Cc: 12714 <at> debbugs.gnu.org, Jim Meyering <jim <at> meyering.net>
Subject: Re: bug#12714: [PATCH] build: do not redefine _FORTIFY_SOURCE
Date: Tue, 23 Oct 2012 15:50:42 -0400
[Message part 1 (text/plain, inline)]
On Tuesday 23 October 2012 15:26:14 Jim Meyering wrote:
> Mike Frysinger wrote:
> > If the active compiler or flags have already defined _FORTIFY_SOURCE,
> > don't go overriding that.  Otherwise we get a lot of spew about the
> > flag being redefined.
> > 
> > * configure.ac (FORTIFY_SOURCE): Check if _FORTIFY_SOURCE is defined.
> > ---
> > 
> >  configure.ac | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/configure.ac b/configure.ac
> > index e5e05be..6504144 100644
> > --- a/configure.ac
> > +++ b/configure.ac
> > @@ -170,7 +170,7 @@ if test "$gl_gcc_warnings" = yes; then
> > 
> >    AH_VERBATIM([FORTIFY_SOURCE],
> >    [/* Enable compile-time and run-time bounds-checking, and some
> >    warnings,
> >    
> >        without upsetting glibc 2.15+. */
> > 
> > -   #if defined __OPTIMIZE__ && __OPTIMIZE__
> > +   #if !defined _FORTIFY_SOURCE && defined __OPTIMIZE__ && __OPTIMIZE__
> > 
> >     # define _FORTIFY_SOURCE 2
> >     #endif
> >    
> >    ])
> 
> Thanks.  Please adjust the log (or just tell us and we'll adjust it)
> so that we know which compiler motivates this change.

Ubuntu will enable _FORTIFY_SOURCE by default.  not sure about Debian.  Gentoo 
has been doing it for a while.

in the past, we could just default it to 2 (in which case this wouldn't 
normally trigger a warning), but as the comment states here, newer glibc is 
picky and will error out if you have -D_FORTIFY_SOURCE=2 -O0.  so we had to 
update the default to read:
	_FORTIFY_SOURCE=((defined __OPTIMIZE__ && __OPTIMIZE__ > 0) ? 2 : 0)

in which case this code triggers lots of false warnings.

however, that isn't the only way to trigger this.  if the user themselves do:
	CPPFLAGS=-D_FORTIFY_SOURCE=1 ./configure
it'll cause warnings.
-mike
[signature.asc (application/pgp-signature, inline)]

Information forwarded to bug-coreutils <at> gnu.org:
bug#12714; Package coreutils. (Tue, 23 Oct 2012 19:53:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-coreutils <at> gnu.org:
bug#12714; Package coreutils. (Tue, 23 Oct 2012 20:00:02 GMT) Full text and rfc822 format available.

Message #17 received at 12714 <at> debbugs.gnu.org (full text, mbox):

From: Eric Blake <eblake <at> redhat.com>
To: Mike Frysinger <vapier <at> gentoo.org>
Cc: 12714 <at> debbugs.gnu.org, jim <at> meyering.net
Subject: Re: bug#12714: [PATCH] build: do not redefine _FORTIFY_SOURCE
Date: Tue, 23 Oct 2012 13:57:11 -0600
[Message part 1 (text/plain, inline)]
On 10/23/2012 01:50 PM, Mike Frysinger wrote:
> On Tuesday 23 October 2012 15:26:14 Jim Meyering wrote:
>> Mike Frysinger wrote:
>>> If the active compiler or flags have already defined _FORTIFY_SOURCE,
>>> don't go overriding that.  Otherwise we get a lot of spew about the
>>> flag being redefined.
>>>
>>> * configure.ac (FORTIFY_SOURCE): Check if _FORTIFY_SOURCE is defined.

>>>
>>> -   #if defined __OPTIMIZE__ && __OPTIMIZE__
>>> +   #if !defined _FORTIFY_SOURCE && defined __OPTIMIZE__ && __OPTIMIZE__

Coreutils copied this line from libvirt, and I know that other packages
have also copied this line.  You will probably have several bug reports
to file, as you track down where this has spread.

I really dislike what glibc did to us by issuing a warning about an
ignored macro.

-- 
Eric Blake   eblake <at> redhat.com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

[signature.asc (application/pgp-signature, attachment)]

Information forwarded to bug-coreutils <at> gnu.org:
bug#12714; Package coreutils. (Wed, 24 Oct 2012 16:12:01 GMT) Full text and rfc822 format available.

Message #20 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Jim Meyering <jim <at> meyering.net>
To: Mike Frysinger <vapier <at> gentoo.org>
Cc: 12714-done <at> debbugs.gnu.org, bug-coreutils <at> gnu.org
Subject: Re: bug#12714: [PATCH] build: do not redefine _FORTIFY_SOURCE
Date: Wed, 24 Oct 2012 18:09:27 +0200
Mike Frysinger wrote:

> On Tuesday 23 October 2012 15:26:14 Jim Meyering wrote:
>> Mike Frysinger wrote:
>> > If the active compiler or flags have already defined _FORTIFY_SOURCE,
>> > don't go overriding that.  Otherwise we get a lot of spew about the
>> > flag being redefined.
>> >
>> > * configure.ac (FORTIFY_SOURCE): Check if _FORTIFY_SOURCE is defined.
>> > ---
...
>> Thanks.  Please adjust the log (or just tell us and we'll adjust it)
>> so that we know which compiler motivates this change.
>
> Ubuntu will enable _FORTIFY_SOURCE by default.  not sure about Debian.  Gentoo
> has been doing it for a while.

Thanks.  I've adjusted the log.
Ok with you?

From 9517680ed3d4d7baff8a842a052ad405f9e9049f Mon Sep 17 00:00:00 2001
From: Mike Frysinger <vapier <at> gentoo.org>
Date: Tue, 23 Oct 2012 15:20:07 -0400
Subject: [PATCH] build: do not redefine _FORTIFY_SOURCE

When _FORTIFY_SOURCE is defined by the compiler or via flags, as
it is on Gentoo, do not override it.  Otherwise we get many
redefinition warnings.

* configure.ac (FORTIFY_SOURCE): Check if _FORTIFY_SOURCE is defined.
This addresses http://bugs.gnu.org/12714
---
 configure.ac | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index e5e05be..6504144 100644
--- a/configure.ac
+++ b/configure.ac
@@ -170,7 +170,7 @@ if test "$gl_gcc_warnings" = yes; then
   AH_VERBATIM([FORTIFY_SOURCE],
   [/* Enable compile-time and run-time bounds-checking, and some warnings,
       without upsetting glibc 2.15+. */
-   #if defined __OPTIMIZE__ && __OPTIMIZE__
+   #if !defined _FORTIFY_SOURCE && defined __OPTIMIZE__ && __OPTIMIZE__
    # define _FORTIFY_SOURCE 2
    #endif
   ])
--
1.8.0




Reply sent to Jim Meyering <jim <at> meyering.net>:
You have taken responsibility. (Wed, 24 Oct 2012 16:12:02 GMT) Full text and rfc822 format available.

Notification sent to Mike Frysinger <vapier <at> gentoo.org>:
bug acknowledged by developer. (Wed, 24 Oct 2012 16:12:03 GMT) Full text and rfc822 format available.

Information forwarded to bug-coreutils <at> gnu.org:
bug#12714; Package coreutils. (Wed, 24 Oct 2012 17:48:01 GMT) Full text and rfc822 format available.

Message #28 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Mike Frysinger <vapier <at> gentoo.org>
To: Jim Meyering <jim <at> meyering.net>
Cc: 12714-done <at> debbugs.gnu.org, bug-coreutils <at> gnu.org
Subject: Re: bug#12714: [PATCH] build: do not redefine _FORTIFY_SOURCE
Date: Wed, 24 Oct 2012 13:45:23 -0400
[Message part 1 (text/plain, inline)]
On Wednesday 24 October 2012 12:09:27 Jim Meyering wrote:
> Mike Frysinger wrote:
> > On Tuesday 23 October 2012 15:26:14 Jim Meyering wrote:
> >> Mike Frysinger wrote:
> >> > If the active compiler or flags have already defined _FORTIFY_SOURCE,
> >> > don't go overriding that.  Otherwise we get a lot of spew about the
> >> > flag being redefined.
> >> > 
> >> > * configure.ac (FORTIFY_SOURCE): Check if _FORTIFY_SOURCE is defined.
> >> > ---
> 
> ...
> 
> >> Thanks.  Please adjust the log (or just tell us and we'll adjust it)
> >> so that we know which compiler motivates this change.
> > 
> > Ubuntu will enable _FORTIFY_SOURCE by default.  not sure about Debian. 
> > Gentoo has been doing it for a while.
> 
> Thanks.  I've adjusted the log.
> Ok with you?

looks fine, thanks
-mike
[signature.asc (application/pgp-signature, inline)]

Information forwarded to bug-coreutils <at> gnu.org:
bug#12714; Package coreutils. (Wed, 24 Oct 2012 17:48:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 22 Nov 2012 12:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 11 years and 158 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.