Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 646012 - app-admin/mongo-tools: CFLAGS are ignored
Summary: app-admin/mongo-tools: CFLAGS are ignored
Status: CONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Ultrabug
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: qa-cflags
  Show dependency tree
 
Reported: 2018-01-29 00:58 UTC by Thomas Deutschmann
Modified: 2018-01-30 10:58 UTC (History)
3 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Deutschmann gentoo-dev Security 2018-01-29 00:58:14 UTC
* QA Notice: Files built without respecting CFLAGS have been detected
 *  Please include the following list of files in your report:
 * /usr/bin/bsondump
 * /usr/bin/mongofiles
 * /usr/bin/mongotop
 * /usr/bin/mongorestore
 * /usr/bin/mongoexport
 * /usr/bin/mongoimport
 * /usr/bin/mongodump
 * /usr/bin/mongoreplay
 * /usr/bin/mongostat
Comment 1 Tomáš Mózes 2018-01-29 11:05:31 UTC
I cannot reproduce, can you please @ultrabug?
Comment 2 Tomáš Mózes 2018-01-29 11:14:28 UTC
Thanks @whissy for pointing this out (https://github.com/gentoo/portage/blob/master/bin/install-qa-check.d/10ignored-flags#L24)

https://wiki.gentoo.org/wiki/Package_testing

# CFLAGS should be reasonable
CFLAGS="-march=native -O2 -pipe -frecord-gcc-switches"
CXXFLAGS="${CFLAGS}"

# Defining all four *FLAGS variables enables a portage QA check reporting when these variables are not respected
FFLAGS="${CFLAGS}"
FCFLAGS="${CFLAGS}"

emerge =app-admin/mongo-tools-3.6.2:
 * QA Notice: Files built without respecting CFLAGS have been detected
...
Comment 3 Tomáš Mózes 2018-01-30 08:33:25 UTC
Since mongo-tools is written in Go (cannot find any CGO) imho we cannot pass any CFLAGS to it since they are C specific. Let's see why this message was printed:

++ rm -f /var/tmp/portage/app-admin/mongo-tools-3.6.2-r1/temp/scanelf-ignored-CFLAGS.log
+++ scanelf -qyRF '#k%p' -k '!.GCC.command.line' /var/tmp/portage/app-admin/mongo-tools-3.6.2-r1/image/
++ for x in $(scanelf -qyRF '#k%p' -k '!.GCC.command.line' "${ED}")
+++ file usr/bin/mongofiles
++ f='usr/bin/mongofiles: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, with 
...
++ [[ -f /var/tmp/portage/app-admin/mongo-tools-3.6.2-r1/temp/scanelf-ignored-CFLAGS.log ]]
++ '[' unset = unset ']'
++ sed -e 's#^usr/lib/debug/.*##' -e '/^$/d' -e 's#^#/#' -i /var/tmp/portage/app-admin/mongo-tools-3.6.2-r1/temp/scanelf-ignored-CFLAGS.log
++ [[ -n /usr/bin/mongofiles
/usr/bin/mongofiles

So the mongo binaries got into the scanelf-ignored-CFLAGS.log because `file` printed "ELF 64-bit LSB shared object". I think this is a false alarm, but I'm free to suggestions how to fix this if it's really a problem. Thank you.
Comment 4 Thomas Deutschmann gentoo-dev Security 2018-01-30 08:49:31 UTC
I am not a Go expert.

This is the first time that I have seen non-statically linked Go binaries, linked with non-Go libraries:

> # file /usr/bin/mongodump
> /usr/bin/mongodump: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, stripped

> # lddtree /usr/bin/mongodump
> /usr/bin/mongodump (interpreter => /lib64/ld-linux-x86-64.so.2)
>     libssl.so.1.0.0 => /usr/lib64/libssl.so.1.0.0
>     libcrypto.so.1.0.0 => /usr/lib64/libcrypto.so.1.0.0
>         libdl.so.2 => /lib64/libdl.so.2
>         libz.so.1 => /lib64/libz.so.1
>     libpthread.so.0 => /lib64/libpthread.so.0
>     libc.so.6 => /lib64/libc.so.6

I agree that the QA check will produce false-positives on normal Go binaries. I _guess_ that this is happening here as well.

However, I don't see this ebuild linked to Go. I.e. a dev-lang/go update won't trigger a rebuild. I think this should be fixed.

And while you are there, make the build process verbose.
Comment 5 Tomáš Mózes 2018-01-30 08:52:47 UTC
(In reply to Thomas Deutschmann from comment #4)
> However, I don't see this ebuild linked to Go. I.e. a dev-lang/go update
> won't trigger a rebuild. I think this should be fixed.

We have go in DEPEND (dev-lang/go:=):
https://github.com/gentoo/gentoo/blob/master/app-admin/mongo-tools/mongo-tools-3.6.2.ebuild#L20

> And while you are there, make the build process verbose.

Good point, I'll look into it, thanks.
Comment 6 Thomas Deutschmann gentoo-dev Security 2018-01-30 08:54:05 UTC
Sorry, yes. I mixed RDEPEND/DEPEND.
Comment 7 Tomáš Mózes 2018-01-30 10:58:23 UTC
(In reply to Thomas Deutschmann from comment #6)
> Sorry, yes. I mixed RDEPEND/DEPEND.

No problem :)