Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 626438 - sys-process/tini-0.15.0 CFLAGS="-U_FORTIFY_SOURCE" turns into failure during emerge
Summary: sys-process/tini-0.15.0 CFLAGS="-U_FORTIFY_SOURCE" turns into failure during ...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Zac Medico
URL: https://github.com/krallin/tini/pull/...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-07-28 14:04 UTC by Joerg Neikes
Modified: 2018-07-27 16:18 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
emerge-info.txt (emerge-info.txt,18.12 KB, text/plain)
2017-07-28 14:07 UTC, Joerg Neikes
Details
fortify-source-CMakeLists.patch (fortify-source-CMakeLists.patch,524 bytes, patch)
2017-07-28 14:11 UTC, Joerg Neikes
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Joerg Neikes 2017-07-28 14:04:23 UTC
sys-process/tini-0.15.0: does not compile because _FORTIFY_SOURCE is double set.


[ 50%] Building C object CMakeFiles/tini.dir/src/tini.c.o
/usr/lib64/ccache/bin/x86_64-pc-linux-gnu-gcc -D_FORTIFY_SOURCE=2 -I/var/tmp/portage/sys-process/tini-0.15.0/work/tini
-0.15.0_build   -DNDEBUG -march=core2 -O2 -pipe -U_FORTIFY_SOURCE -std=gnu99 -Werror -Wextra -Wall -pedantic-errors -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat   -o CMakeFiles/tini.dir/src/tini.c.o -c /var/tmp/portage/sys-process/tini-0.15.0/work/tini-0.15.0/src/tini.c
<command-line>:0:0: error: "_FORTIFY_SOURCE" redefined
<command-line>:0:0: error: "_FORTIFY_SOURCE" redefined
<built-in>: note: this is the location of the previous definition
<command-line>:0:0: error: "_FORTIFY_SOURCE" redefined
<built-in>: note: this is the location of the previous definition
make[2]: *** [CMakeFiles/tini.dir/build.make:63: CMakeFiles/tini.dir/src/tini.c.o] Error 1
make[2]: Leaving directory '/var/tmp/portage/sys-process/tini-0.15.0/work/tini-0.15.0_build'
make[1]: *** [CMakeFiles/Makefile2:105: CMakeFiles/tini.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
make[2]: *** [CMakeFiles/tini-static.dir/build.make:63: CMakeFiles/tini-static.dir/src/tini.c.o] Error 1
make[2]: Leaving directory '/var/tmp/portage/sys-process/tini-0.15.0/work/tini-0.15.0_build'
make[1]: *** [CMakeFiles/Makefile2:68: CMakeFiles/tini-static.dir/all] Error 2
make[1]: Leaving directory '/var/tmp/portage/sys-process/tini-0.15.0/work/tini-0.15.0_build'
make: *** [Makefile:152: all] Error 2
 * ERROR: sys-process/tini-0.15.0::gentoo failed (compile phase):
 *   emake failed
 * 
 * If you need support, post the output of `emerge --info '=sys-process/tini-0.15.0::gentoo'`,
 * the complete build log and the output of `emerge -pqv '=sys-process/tini-0.15.0::gentoo'`.
 * The complete build log is located at '/var/log/portage/sys-process:tini-0.15.0:20170728-132332.log'.
 * For convenience, a symlink to the build log is located at '/var/tmp/portage/sys-process/tini-0.15.0/temp/build.log'.
 * The ebuild environment file is located at '/var/tmp/portage/sys-process/tini-0.15.0/temp/environment'.
 * Working directory: '/var/tmp/portage/sys-process/tini-0.15.0/work/tini-0.15.0_build'
 * S: '/var/tmp/portage/sys-process/tini-0.15.0/work/tini-0.15.0'


Reproducible: Always

Steps to Reproduce:
1. emerge sys-process/tini
2. fails
3. emerge sys-process/tini
4. fails
Actual Results:  
emerge =sys-process/tini-0.15.0 with -U_FORTIFY_SOURCE in CFLAGS

Expected Results:  
installs

This bug was fixed for Alpine Linux in version 0.83 in 2015.

The Problem is our gcc is not set natively to this, only for packages build by emerge.
Comment 1 Joerg Neikes 2017-07-28 14:07:37 UTC
Created attachment 487060 [details]
emerge-info.txt

emerge --info
Comment 2 Joerg Neikes 2017-07-28 14:11:34 UTC
Created attachment 487062 [details, diff]
fortify-source-CMakeLists.patch

Quick solution:

mkdir /etc/portage/patches/sys-process/tini/ -p

cp fortify-source-CMakeLists.patch /etc/portage/patches/sys-process/tini/

emerge =sys-process/tini-0.15.0

">>> sys-process/tini-0.15.0 merged."
Comment 3 Joerg Neikes 2018-07-25 14:01:45 UTC
This patch works for sys-process/tini-0.18.0 again.
Comment 4 Larry the Git Cow gentoo-dev 2018-07-26 07:32:00 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c03a6d641dd2dce29a98e0cdf6930ab4d3754232

commit c03a6d641dd2dce29a98e0cdf6930ab4d3754232
Author:     Zac Medico <zmedico@gentoo.org>
AuthorDate: 2018-07-26 07:29:11 +0000
Commit:     Zac Medico <zmedico@gentoo.org>
CommitDate: 2018-07-26 07:31:50 +0000

    sys-process/tini: remove -Werror (bug 626438)
    
    Fixes: https://bugs.gentoo.org/626438
    Package-Manager: Portage-2.3.43, Repoman-2.3.10

 sys-process/tini/tini-0.18.0.ebuild | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)
Comment 5 Zac Medico gentoo-dev 2018-07-26 07:37:03 UTC
(In reply to Joerg Neikes from comment #2)
> Created attachment 487062 [details, diff] [details, diff]
> fortify-source-CMakeLists.patch

Some people might like to have _FORTIFY_SOURCE enabled though, so I've patched CMakeLists.txt to make macro redefinition non-fatal, be removing -Werror and -pedantic-errors from the internal CFLAGS setting.
Comment 6 Joerg Neikes 2018-07-27 11:49:13 UTC
(In reply to Zac Medico from comment #5)
> (In reply to Joerg Neikes from comment #2)
> > Created attachment 487062 [details, diff] [details, diff] [details, diff]
> > fortify-source-CMakeLists.patch
> 
> Some people might like to have _FORTIFY_SOURCE enabled though, so I've
> patched CMakeLists.txt to make macro redefinition non-fatal, be removing
> -Werror and -pedantic-errors from the internal CFLAGS setting.

Yes my setting for the whole GCC settings is normaly with _FORTIFY_SOURCE on all systems.

CFLAGS="-O2 -pipe -U_FORTIFY_SOURCE"
CXXFLAGS="${CFLAGS}"

Because of this, FORTIFY_SOURCE would be set twice.

This won't work.
Comment 7 Zac Medico gentoo-dev 2018-07-27 16:18:18 UTC
This test case shows that _FORTIFY_SOURCE is unset, despite the warning that it is redefined:

> $ cat assert_no_fortify.c
> #ifdef _FORTIFY_SOURCE
> #error "defined: _FORTIFY_SOURCE"
> #endif
> int main(void)                                                                                                              {
>   return 0;
> }
> $ gcc -D_FORTIFY_SOURCE=2 assert_no_fortify.c -o /dev/null
> <command-line>:0:0: warning: "_FORTIFY_SOURCE" redefined
> <built-in>: note: this is the location of the previous definition
> assert_no_fortify.c:2:2: error: #error "defined: _FORTIFY_SOURCE"
>  #error "defined: _FORTIFY_SOURCE"
>   ^~~~~
> $ gcc -D_FORTIFY_SOURCE=2 -U_FORTIFY_SOURCE assert_no_fortify.c -o /dev/null
> <command-line>:0:0: warning: "_FORTIFY_SOURCE" redefined
> <built-in>: note: this is the location of the previous definition