Created attachment 434282 [details, diff] Detect if CONFIG_PROC_PAGE_MONITOR is set The test suite of sys-process/procps fails: Running ./pmap.test/pmap.exp ... FAIL: pmap extended output (header) FAIL: pmap extra extended output (header) FAIL: pmap double extra extended output (header) FAIL: pmap X with unreachable process FAIL: pmap XX with unreachable process Affected versions are procps-3.3.9-r2 procps-3.3.10-r1 procps-3.3.11-r3 (currently masked) More precisely, If pmap is given the option '-X', then it tries to read the file /proc/self/smaps. If this file is not present, pmap fails. The tests mentioned above call pmap with '-X' and therefore fail. The file /proc/<pid>/smaps is (on a Linux system) only present if the kernel is configured with the option CONFIG_PROC_PAGE_MONITOR (see man page proc(5)). The distribution of pmap nor its bundled test suite make any attempt to check if the kernel is configured with that option and fail with the above error leaving the user in the dark what is wrong. A related discussion took place in bug #404389. Which also tackeled other issues, therefore a new bug report. The ebuild should therefore check (as far as possible) whether the test suite can theoretically pass and act upon it (suggestions see below). Note that the detection if CONFIG_PROC_PAGE_MONITOR is enabled can only be done if the kernel exports its config file via /proc/config.gz. There are three cases the ebuild has to handle 1. option is enabled 2. option is disabled 3. unable to determine if the kernel has the option enabled/disabled In the 1. case, we should run the test suite. It is, however, unclear what to do in the second and third case. Possible options are: - only warn - abort - running the test partially Below is a patch checking for the option via linux-info.eclass. (Note we do not use 'CONFIG_CHECK' or 'linux_chkconfig_present', because this checks /usr/src/linux/.config before /proc/config.gz and therefore is irrelevant for the currently running kernel.) Caveats to watch out in the patch: - Unclear if we can call 'use test' because 'test' is a feature special USE flag. - check is performed in pkg_pretend, maybe move to src_test - does not handle BSD kernels - dies if the option is disabled, instead of disabling the tests diff -u a/procps-3.3.11-r3.ebuild b/procps-3.3.11-r3.ebuild --- a/procps-3.3.11-r3.ebuild +++ b/procps-3.3.11-r3.ebuild @@ -4,7 +4,7 @@ -inherit eutils toolchain-funcs flag-o-matic +inherit eutils toolchain-funcs flag-o-matic linux-info DESCRIPTION="standard informational utilities and process-handling tools" # http://packages.debian.org/sid/procps @@ -36,6 +36,31 @@ S="${WORKDIR}/${PN}-ng-${PV}" +pkg_pretend() { + if use test; then + # linux_config_bin_exists must be called before getfilevar_noexec. + if linux_config_bin_exists; then + if [[ $(getfilevar_noexec CONFIG_PROC_PAGE_MONITOR /proc/config.gz) == [my] ]]; then + einfo "Kernel is configured with option CONFIG_PROC_PAGE_MONITOR enabled." + else + eerror "Currently running kernel is configured with the option" + eerror "CONFIG_PROC_PAGE_MONITOR disabled." + eerror "However, some tests of ${PN}, e.g. for pmap, require" + eerror "CONFIG_PROC_PAGE_MONITOR to be set, otherwise they will fail." + die "Kernel option CONFIG_PROC_PAGE_MONITOR disabled." + fi + else + ewarn "Unable to determine if the currently running kernel is configured" + ewarn "with option CONFIG_PROC_PAGE_MONITOR enabled." + ewarn "Some tests of ${PN}, e.g. for pmap, require" + ewarn "CONFIG_PROC_PAGE_MONITOR to be set, otherwise they will fail." + ewarn + ewarn "If the test suite fails make sure you have enabled the above option" + ewarn "before filing a bug report." + fi + fi +} + #src_unpack() { # unpack ${A} # mv ${WORKDIR}/${PN}-v${PV}-* ${WORKDIR}/${P} || die
Comment on attachment 434282 [details, diff] Detect if CONFIG_PROC_PAGE_MONITOR is set would be better to skip the specific tests when the option isn't enabled instead of failing the build
Created attachment 435284 [details, diff] Patch for disabling the offending tests This is a patch disabling all tests calling pmap with either -X, -x, or -c. These options instruct pmap to read /proc/<pid>/smaps.
(In reply to gentoo_usr from comment #2) can you tweak the code to check /proc to see if the required files are in there, and if not, then skip the tests ? this patch still requires the ebuild to do testing itself to see whether to apply it.
Created attachment 435366 [details, diff] Disable tests which require /proc/<pid>/smaps Here is a modified version of the patch. It checks for /proc/self/smaps.
thanks, that patch looks good. feel like sending it upstream ? you can just e-mail it to procps@freelists.org. that way you get credit for finding+fixing.
I send the patch upstream twice (in June and September 2016). No response to either of those mails. If anyone wants to try it again to get the patch upstream, go ahead. Maybe they are more responsible to a package maintainer of a distribution.
(In reply to gentoo_usr from comment #6) that's fine -- we just want to see it sent upstream. if they don't respond, there's only so much we can do. i've added your patch to the tree now: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c66fba6a50fc550918df1804ef4afc90613ec28f