Gentoo ebuild issues

From: Marti Raudsepp <marti_X_at_X_juffo.org>
Date: Sun, 18 Nov 2007 23:45:56 +0200
To: "cpushare-devel list" <cpushare-devel_X_at_X_cpushare.com>
Hi,

The current ebuild for cpushare is somewhat flawed, because you're
creating the cpushare user and group in pkg_preinst, but the user is
already referenced back in src_install (as the owner of
/var/log/cpushare and /etc/cpushare).

The purpose of src_install is to copy binaries from the build
directory to the image directory -- it does not directly install the
files into the live system.

The alternative described in the Gentoo Development Guide [1] suggests
creating users in pkg_setup, but that will break with binary packages,
because the UID/GID will likely differ between the compile host and
other hosts.

[1] http://devmanual.gentoo.org/ebuild-writing/users-and-groups/index.html

The best way to do it is to both create the user and assign ownership
in pkg_postinst, which gets invoked on binary package installations as
well (after the package has been merged into the file system tree).
[2]

[2] http://devmanual.gentoo.org/ebuild-writing/functions/index.html

Another change I did was to change the permissions of
/var/log/cpushare -- you most likely don't want random users to read
cpushare log files, as they might leak important information.

And there are a two other issues I'm unsure about:

1. As far as I can tell, cpushare is still running as root when it's
reading the /etc/cpushare files and opening logfiles, so I don't think
those directories should even be owned by cpushare -- running fowners
on the cache directory alone should be sufficient?

2. Creating a cache directory within /var/log/cpushare is an abuse of
Unix file hierarchy; distro maintainers aren't going to like this.

Here's the patch; I'll submit this to the Gentoo bugzilla as well:

--- cpushare-0.46.ebuild	2007-11-18 21:39:32.000000000 +0200
+++ cpushare-0.46-r1.ebuild	2007-11-18 23:31:08.000000000 +0200
_X_at_X_@ -25,7 +25,2 @@

-pkg_preinst() {
-	enewgroup cpushare
-	enewuser cpushare -1 -1 /dev/null cpushare
-}
-
 src_compile() {
_X_at_X_@ -47,4 +42,3 @@
 	dodir /var/log/cpushare /etc/cpushare
-	fperms 700 /etc/cpushare
-	fowners cpushare:cpushare /var/log/cpushare /etc/cpushare
+	fperms 700 /etc/cpushare /var/log/cpushare
 }
_X_at_X_@ -67,2 +61,7 @@
 pkg_postinst() {
+	enewgroup cpushare
+	enewuser cpushare -1 -1 /dev/null cpushare
+
+	fowners cpushare:cpushare /var/log/cpushare /etc/cpushare
+
 	distutils_pkg_postinst

Regards,
Marti Raudsepp
-- 
cpushare-devel_X_at_X_cpushare.com mailing list - http://www.cpushare.com/
To unsubscribe, send mail to cpushare-devel-unsubscribe_X_at_X_cpushare.com
Received on 2007-11-18 22:46:11

Click here to return to to homepage.

Search CPUShare Devel

Disclaimer: the messages posted here are under the sole responsibility of the poster: cpushare.com is publishing mailing list messages in real time while storing safely all the logs containing the relevant IP addresses, timings and mail hops. If you find anything not appropriate in these messages please send a notification through this form. Thank You.

CPUShare Devel has been converted to html using hypermail 2.2.0.