Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 287722 - sys-apps/dbus should not be unsafe if compiled with FEATURES="test"
Summary: sys-apps/dbus should not be unsafe if compiled with FEATURES="test"
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Freedesktop bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-10-05 07:37 UTC by Xake
Modified: 2009-11-01 22:48 UTC (History)
3 users (show)

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


Attachments
Build tests in ${T}/tests (dbus_out_of_tree_tests.patch,2.60 KB, patch)
2009-10-18 12:34 UTC, Nirbheek Chauhan (RETIRED)
Details | Diff
dbus-1.3.0.ebuild-tests.patch (dbus-1.3.0.ebuild-tests.patch,3.10 KB, patch)
2009-10-20 14:52 UTC, Peter Volkov (RETIRED)
Details | Diff
dbus-1.3.0.ebuild-tests.patch (dbus-1.3.0.ebuild-tests.patch,3.27 KB, patch)
2009-10-20 18:42 UTC, Peter Volkov (RETIRED)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Xake 2009-10-05 07:37:07 UTC
This is more or less a bug about the problem dbus will become if FEATURES="test" would become default in any profile, devel as well as regular.
Posted after dirtyepic told me to on gentoo-dev@l.g.o.

The problem is that if dbus is compiled with FEATURES="test" then there is a lot of functions enabled in the bins/libs that are meant for unittesting and only unittesting, which renders the library more unstable and more insecure. Therefore it is not advised to use it wth FEATURES="test", only test it and then recompile.
The problem is that if FEATURES="test" would become default for any profile is pretty obvious.

So how we should handle this is an interesting question, since in another bug it was mentioned that these tests are good for ATs.
So anuther test-useflag like USE="unsafetests" or something more obscure to solve this?
And a policy to handle these kinds of packages, if more packages then dbus has these kinds of problems?
Comment 1 Gilles Dartiguelongue (RETIRED) gentoo-dev 2009-10-05 11:50:57 UTC
Please start a discussion about this on the mailing list, this is likely something that other packages might do.
Comment 2 Ryan Hill (RETIRED) gentoo-dev 2009-10-06 06:20:30 UTC
i'm planning on bringing it up soon.
Comment 3 Peter Volkov (RETIRED) gentoo-dev 2009-10-18 10:44:04 UTC
I think general policy for packages should be -- do not install broken packages in case user did not requested that. FEATURES=test looks like 'safe' as it was just request to test our package... So I think best solution for this bug (as Jeroen suggested on gentoo-dev and since out-of-sources build is possible here) is to build dbus twice with and without tests enabled.

http://archives.gentoo.org/gentoo-dev/msg_fc8d40428c73b510a429467569b28ec8.xml
Comment 4 Gilles Dartiguelongue (RETIRED) gentoo-dev 2009-10-18 10:45:50 UTC
I agree it is a reasonable solution here, anyone mind providing a patch ?
Comment 5 Nirbheek Chauhan (RETIRED) gentoo-dev 2009-10-18 12:34:41 UTC
Created attachment 207478 [details, diff]
Build tests in ${T}/tests

Here's a patch that copies the prepared sources into ${T}/tests and then runs configure/make/make check in src_test.

--enable-tests need to be passed to configure, and hence out-of-tree builds can't be done (afaik, they're done at the `make` level).

The big chunk of changes to econf args are just removal of the '\' at the end. The only change is unconditional --disable-tests
Comment 6 Gilles Dartiguelongue (RETIRED) gentoo-dev 2009-10-18 13:22:11 UTC
it sounds wrong to not respect phases even for something specific like this.
Comment 7 Nirbheek Chauhan (RETIRED) gentoo-dev 2009-10-18 13:26:14 UTC
(In reply to comment #6)
> it sounds wrong to not respect phases even for something specific like this.
> 

But since we definitely have to run ./configure again (but in a separate place); do we have a choice?

We could make it transparent to the user by sending all output from econf and emake in src_test to /dev/null ~ it'll certainly reduce noise.
Comment 8 Pacho Ramos gentoo-dev 2009-10-18 18:32:28 UTC
Why not move:
+	# We need to build in a separate tree for the tests because 
+	# having unit tests enabled results in an insecure library
+	cd "${T}/tests" || die "cd tests failed"
+
+	einfo "Configuring a separate tree for building tests"
+	econf ${ECONF} \
+		$(use_enable test tests) \
+		$(use_enable test asserts) \
+		|| die "test econf failed"
+
+	einfo "Building tests"
+	emake || die "test make failed"

to src_compile phase running it only when USE=test?

I mean, src_compile could run econf&&emake for normal build and, after that, if use=test, go to "${T}/tests" and run econf&&emake for tests. Then, when reaching src_test phase, it would simply run "DBUS_VERBOSE=1 make check" under "${T}/tests"
Comment 9 Peter Volkov (RETIRED) gentoo-dev 2009-10-20 14:52:31 UTC
Created attachment 207676 [details, diff]
dbus-1.3.0.ebuild-tests.patch

This patch works here. It uses 2 directories for build: $BD aka build directory - for normal build, $TBD aka tests build directory - build dbus for tests. All other modifications jump around this change.
Comment 10 Gilles Dartiguelongue (RETIRED) gentoo-dev 2009-10-20 15:19:15 UTC
I like this patch. Any objections from other fdo guys ?
Comment 11 Nirbheek Chauhan (RETIRED) gentoo-dev 2009-10-20 15:40:37 UTC
a) I thought dbus is not EAPI=2 for a reason (maybe system-package logic?)
b) Aren't the regenerated html docs with USE=doc going to waste here? I think the cd ${BD} followed by emake install should be done at the beginning of src_install; not the end
Comment 12 Gilles Dartiguelongue (RETIRED) gentoo-dev 2009-10-20 15:52:19 UTC
(In reply to comment #11)
> a) I thought dbus is not EAPI=2 for a reason (maybe system-package logic?)

not that I know, python, bash and everything that revolves around portage would match that, but certainly not dbus.

> b) Aren't the regenerated html docs with USE=doc going to waste here?

depends on if there is a make check for docs
Comment 13 Peter Volkov (RETIRED) gentoo-dev 2009-10-20 18:42:12 UTC
Created attachment 207705 [details, diff]
dbus-1.3.0.ebuild-tests.patch

(In reply to comment #12)
> (In reply to comment #11)
> > b) Aren't the regenerated html docs with USE=doc going to waste here?
> 
> depends on if there is a make check for docs

Hm, as I see doc USE flag does not work in original ebuild too. At least I see:
!!! dohtml: doc/*html does not exist

and checking sources reveals that --enable-doxygen just defines conditional:

AM_CONDITIONAL(DBUS_DOXYGEN_DOCS_ENABLED, test x$enable_doxygen_docs = xyes)

and this conditional is not used anywhere outside configure...

The patch in attachement fixes this and drops unused doxygen dep.
Comment 14 Gilles Dartiguelongue (RETIRED) gentoo-dev 2009-11-01 22:48:53 UTC
Should be fixed in 1.3.0-r1. Feel free to reopen if it's still causing you problems.
Thanks all for your contributions.