Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 542810 - sys-kernel/gentoo-sources-3.19.1[experimental] fails at cpu optimization patch
Summary: sys-kernel/gentoo-sources-3.19.1[experimental] fails at cpu optimization patch
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Kernel Bug Wranglers and Kernel Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-03-10 11:59 UTC by Erik Zeek
Modified: 2015-03-20 20:39 UTC (History)
1 user (show)

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


Attachments
5010_enable-additional-cpu-optimizations-for-gcc-4.9.err (5010_enable-additional-cpu-optimizations-for-gcc-4.9.err,14.19 KB, text/plain)
2015-03-10 11:59 UTC, Erik Zeek
Details
emerge --info (emerge-info.txt,14.62 KB, text/plain)
2015-03-10 12:01 UTC, Erik Zeek
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Erik Zeek 2015-03-10 11:59:19 UTC
Created attachment 398592 [details]
5010_enable-additional-cpu-optimizations-for-gcc-4.9.err

ebuild /gentoo/portage/sys-kernel/gentoo-sources/gentoo-sources-3.19.1.ebuild unpack                                                                                                                                   
>>> Existing ${T}/environment for 'gentoo-sources-3.19.1' will be sourced.
>>> Run 'clean' to start with a fresh environment.
>>> Not marked as unpacked; recreating WORKDIR...
 * linux-3.19.tar.xz SHA256 SHA512 WHIRLPOOL size ;-) ...                                                                                                                                                         [ ok ]
 * genpatches-3.19-2.base.tar.xz SHA256 SHA512 WHIRLPOOL size ;-) ...                                                                                                                                             [ ok ]
 * genpatches-3.19-2.extras.tar.xz SHA256 SHA512 WHIRLPOOL size ;-) ...                                                                                                                                           [ ok ]
 * genpatches-3.19-2.experimental.tar.xz SHA256 SHA512 WHIRLPOOL size ;-) ...                                                                                                                                     [ ok ]
 * checking ebuild checksums ;-) ...                                                                                                                                                                              [ ok ]
 * checking miscfile checksums ;-) ...                                                                                                                                                                            [ ok ]
>>> Preparing to unpack ...
>>> Unpacking source...
>>> Unpacking linux-3.19.tar.xz to /gentoo/tmp/portage/sys-kernel/gentoo-sources-3.19.1/work
>>> Unpacking genpatches-3.19-2.base.tar.xz to /gentoo/tmp/portage/sys-kernel/gentoo-sources-3.19.1/work/patches
>>> Unpacking genpatches-3.19-2.extras.tar.xz to /gentoo/tmp/portage/sys-kernel/gentoo-sources-3.19.1/work/patches
>>> Unpacking genpatches-3.19-2.experimental.tar.xz to /gentoo/tmp/portage/sys-kernel/gentoo-sources-3.19.1/work/patches
 * Excluding Patch #BFQ ...                                                                                                                                                                                       [ ok ]
 * Applying 1000_linux-3.19.1.patch (-p1) ...                                                                                                                                                                     [ ok ]
 * Applying 1500_XATTR_USER_PREFIX.patch (-p1) ...                                                                                                                                                                [ ok ]
 * Applying 1510_fs-enable-link-security-restrictions-by-default.patch (-p1) ...                                                                                                                                  [ ok ]
 * Applying 2700_ThinkPad-30-brightness-control-fix.patch (-p1) ...                                                                                                                                               [ ok ]
 * Applying 2900_dev-root-proc-mount-fix.patch (-p1) ...                                                                                                                                                          [ ok ]
 * Applying 2905_2disk-resume-image-fix.patch (-p1) ...                                                                                                                                                           [ ok ]
 * Applying 4200_fbcondecor-3.19.patch (-p1) ...                                                                                                                                                                  [ ok ]
 * Applying 4567_distro-Gentoo-Kconfig.patch (-p1) ...                                                                                                                                                            [ ok ]
 * Applying 5000_enable-additional-cpu-optimizations-for-gcc.patch (-p1) ...                                                                                                                                      [ ok ]
 * Applying 5001_block-cgroups-kconfig-build-bits-for-BFQ-v7r7-3.19.patch (-p1) ...                                                                                                                               [ ok ]
 * Applying 5002_block-introduce-the-BFQ-v7r7-I-O-sched-for-3.19.patch1 (-p1) ...                                                                                                                                 [ ok ]
 * Applying 5003_block-bfq-add-Early-Queue-Merge-EQM-to-BFQ-v7r7-for-3.19.0.patch (-p1) ...                                                                                                                       [ ok ]
 * Failed to dry-run patch 5010_enable-additional-cpu-optimizations-for-gcc-4.9.patch
 * Please attach /gentoo/tmp/portage/sys-kernel/gentoo-sources-3.19.1/temp/5010_enable-additional-cpu-optimizations-for-gcc-4.9.err to any bug you may post.
 * ERROR: sys-kernel/gentoo-sources-3.19.1::gentoo failed (unpack phase):
 *   Unable to dry-run patch on any patch depth lower than 5.
 * 
 * Call stack:
 *     ebuild.sh, line   93:  Called src_unpack
 *   environment, line 3598:  Called kernel-2_src_unpack
 *   environment, line 1983:  Called unipatch '  /gentoo/tmp/portage/sys-kernel/gentoo-sources-3.19.1/distdir/genpatches-3.19-2.base.tar.xz /gentoo/tmp/portage/sys-kernel/gentoo-sources-3.19.1/distdir/genpatches-3.19-2.extras.tar.xz /gentoo/tmp/portage/sys-kernel/gentoo-sources-3.19.1/distdir/genpatches-3.19-2.experimental.tar.xz '
 *   environment, line 4271:  Called die
 * The specific snippet of code:
 *                   die "Unable to dry-run patch on any patch depth lower than 5.";
 * 
 * If you need support, post the output of `emerge --info '=sys-kernel/gentoo-sources-3.19.1::gentoo'`,
 * the complete build log and the output of `emerge -pqv '=sys-kernel/gentoo-sources-3.19.1::gentoo'`.
 * The complete build log is located at '/var/log/portage/sys-kernel:gentoo-sources-3.19.1:20150310-115358.log.gz'.
 * For convenience, a symlink to the build log is located at '/gentoo/tmp/portage/sys-kernel/gentoo-sources-3.19.1/temp/build.log.gz'.
 * The ebuild environment file is located at '/gentoo/tmp/portage/sys-kernel/gentoo-sources-3.19.1/temp/environment'.
 * Working directory: '/gentoo/tmp/portage/sys-kernel/gentoo-sources-3.19.1/work/linux-3.19.1-gentoo'
 * S: '/gentoo/tmp/portage/sys-kernel/gentoo-sources-3.19.1/work/linux-3.19.1-gentoo'
Comment 1 Erik Zeek 2015-03-10 12:01:14 UTC
Created attachment 398594 [details]
emerge --info
Comment 2 Mike Pagano gentoo-dev 2015-03-12 19:35:20 UTC
I can't reproduce this. Can you tell me your 'patch' version?
Comment 3 Erik Zeek 2015-03-12 23:10:27 UTC
(In reply to Mike Pagano from comment #2)
> I can't reproduce this. Can you tell me your 'patch' version?

patch --version
GNU patch 2.7.5
Copyright (C) 2003, 2009-2012 Free Software Foundation, Inc.
Copyright (C) 1988 Larry Wall

License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Larry Wall and Paul Eggert
Comment 4 Erik Zeek 2015-03-12 23:33:29 UTC
I'm getting two similar patches applied:
5000_enable-additional-cpu-optimizations-for-gcc.patch
5010_enable-additional-cpu-optimizations-for-gcc-4.9.patch

Is that correct?
Comment 5 Mike Pagano gentoo-dev 2015-03-13 12:53:29 UTC
Ab(In reply to Erik Zeek from comment #4)
> I'm getting two similar patches applied:
> 5000_enable-additional-cpu-optimizations-for-gcc.patch
> 5010_enable-additional-cpu-optimizations-for-gcc-4.9.patch
> 
> Is that correct?

Absolutely not. But this points me at the eclass code and that helps. Thanks, I may have further questions this weekend when I address this.
Comment 6 Erik Zeek 2015-03-13 16:26:03 UTC
I found the problem! I was setting UNIPATCH_EXCLUDE="BFQ" in /etc/portage/env/sys-kernel/gentoo-sources. 

The documentation in the eclass states that UNIPATCH_EXCLUDE is for end users, so shouldn't I be able to set that in an env file?
Comment 7 Mike Pagano gentoo-dev 2015-03-13 17:29:00 UTC
(In reply to Erik Zeek from comment #6)
> I found the problem! I was setting UNIPATCH_EXCLUDE="BFQ" in
> /etc/portage/env/sys-kernel/gentoo-sources. 
> 
> The documentation in the eclass states that UNIPATCH_EXCLUDE is for end
> users, so shouldn't I be able to set that in an env file?

Well done. That's a bug, I'll check it out.
Comment 8 Mike Pagano gentoo-dev 2015-03-15 18:19:07 UTC
For some reason, the check of your gcc in the eclass is not working.
It should notice that you have gcc 4.9.2 installed and not apply adds an option to the Gentoo menu that enables CGROUPS for cgroup, IPC_NS for ipc-sandbox, and NET_NS for network-sandbox.

And since the code has if (exclude one patch) else (exclude another), I'm not sure how this can fail.

Do you have the latest eclass? Are you using an old eclass that hasn't been updated.

Can you check your eclass for these lines at line: 157

if [[ "${i}" == "experimental" && -z ${K_EXP_GENPATCHES_PULL} && -z ${K_EXP_GENPATCHES_NOUSE} ]] ; then
            use_cond_start="experimental? ( "
            use_cond_end=" )"

            if use experimental ; then
                UNIPATCH_LIST_GENPATCHES+=" ${DISTDIR}/${tarball}"
                debug-print "genpatches tarball: $tarball"

                # check gcc version < 4.9.X uses patch 5000 and = 4.9.X uses patch 5010         
                if [[ $(gcc-major-version) -eq 4 ]] && [[ $(gcc-minor-version) -ne 9 ]]; then
                        # drop 5000_enable-additional-cpu-optimizations-for-gcc-4.9.patch
                        UNIPATCH_EXCLUDE+=" 5010_enable-additional-cpu-optimizations-for-gcc-4.9.patch"
                else
                    #drop 5000_enable-additional-cpu-optimizations-for-gcc.patch
                    UNIPATCH_EXCLUDE+=" 5000_enable-additional-cpu-optimizations-for-gcc.patch"
                fi

            fi
        else
            UNIPATCH_LIST_GENPATCHES+=" ${DISTDIR}/${tarball}"
            debug-print "genpatches tarball: $tarball"
        fi
Comment 9 Erik Zeek 2015-03-16 12:23:27 UTC
(In reply to Mike Pagano from comment #8)
> For some reason, the check of your gcc in the eclass is not working.
> It should notice that you have gcc 4.9.2 installed and not apply adds an
> option to the Gentoo menu that enables CGROUPS for cgroup, IPC_NS for
> ipc-sandbox, and NET_NS for network-sandbox.
> 
> And since the code has if (exclude one patch) else (exclude another), I'm
> not sure how this can fail.
> 
> Do you have the latest eclass? Are you using an old eclass that hasn't been
> updated.
> 
> Can you check your eclass for these lines at line: 157
> 
> if [[ "${i}" == "experimental" && -z ${K_EXP_GENPATCHES_PULL} && -z

I've got those lines starting at line 153 and they work correctly. I've put debug statements in there and the correct values get added to UNIPATCH_EXCLUDE.

The problem I'm seeing is that if I set UNIPATCH_EXCLUDE in /etc/portage/env/sys-kernel/gentoo-sources, it gets sourced *between* calling handle_genpatches and src_unpack. (Note: it also get sourced before calling handle_genpatches) This wipes out the work handle_genpatches did adding to UNIPATCH_EXCLUDE.
Comment 10 Mike Pagano gentoo-dev 2015-03-16 16:26:27 UTC
Can you help me reproduce?

gcc version 4.9.2 (Gentoo 4.9.2 p1.1, pie-0.6.2)

#cat /etc/portage/package.env
sys-kernel/gentoo-sources gentoo-sources

cat /etc/portage/env/gentoo-sources
UNIPATCH_EXCLUDE="1500_XATTR_USER_PREFIX.patch"

#USE=experimental ebuild gentoo-sources-3.19.1.ebuild manifest clean unpack install
>>> Creating Manifest for /usr/portage/sys-kernel/gentoo-sources
openpty failed: 'out of pty devices'
 * linux-3.19.tar.xz SHA256 SHA512 WHIRLPOOL size ;-) ...                                                                             [ ok ]
 * genpatches-3.19-2.base.tar.xz SHA256 SHA512 WHIRLPOOL size ;-) ...                                                                 [ ok ]
 * genpatches-3.19-2.extras.tar.xz SHA256 SHA512 WHIRLPOOL size ;-) ...                                                               [ ok ]
 * genpatches-3.19-2.experimental.tar.xz SHA256 SHA512 WHIRLPOOL size ;-) ...                                                         [ ok ]
 * checking ebuild checksums ;-) ...                                                                                                  [ ok ]
 * checking miscfile checksums ;-) ...                                                                                                [ ok ]
>>> Preparing to unpack ...
>>> Unpacking source...
>>> Unpacking linux-3.19.tar.xz to /var/tmp/portage/sys-kernel/gentoo-sources-3.19.1/work
>>> Unpacking genpatches-3.19-2.base.tar.xz to /var/tmp/portage/sys-kernel/gentoo-sources-3.19.1/work/patches
>>> Unpacking genpatches-3.19-2.extras.tar.xz to /var/tmp/portage/sys-kernel/gentoo-sources-3.19.1/work/patches
>>> Unpacking genpatches-3.19-2.experimental.tar.xz to /var/tmp/portage/sys-kernel/gentoo-sources-3.19.1/work/patches
 * Excluding Patch #1500_XATTR_USER_PREFIX.patch ...                                                                                  [ ok ]
 * Excluding Patch #5000_enable-additional-cpu-optimizations-for-gcc.patch ...                                                        [ ok ]
 * Applying 1000_linux-3.19.1.patch (-p1) ...                                                                                         [ ok ]
 * Applying 1510_fs-enable-link-security-restrictions-by-default.patch (-p1) ...                                                      [ ok ]
 * Applying 2700_ThinkPad-30-brightness-control-fix.patch (-p1) ...                                                                   [ ok ]
 * Applying 2900_dev-root-proc-mount-fix.patch (-p1) ...                                                                              [ ok ]
 * Applying 2905_2disk-resume-image-fix.patch (-p1) ...                                                                               [ ok ]
 * Applying 4200_fbcondecor-3.19.patch (-p1) ...                                                                                      [ ok ]
 * Applying 4567_distro-Gentoo-Kconfig.patch (-p1) ...                                                                                [ ok ]
 * Applying 5001_block-cgroups-kconfig-build-bits-for-BFQ-v7r7-3.19.patch (-p1) ...                                                   [ ok ]
 * Applying 5002_block-introduce-the-BFQ-v7r7-I-O-sched-for-3.19.patch1 (-p1) ...                                                     [ ok ]
 * Applying 5003_block-bfq-add-Early-Queue-Merge-EQM-to-BFQ-v7r7-for-3.19.0.patch (-p1) ...                                           [ ok ]
 * Applying 5010_enable-additional-cpu-optimizations-for-gcc-4.9.patch (-p1) ...                                                      [ ok ]
>>> Source unpacked in /var/tmp/portage/sys-kernel/gentoo-sources-3.19.1/work
>>> Checking genpatches-3.19-2.experimental.tar.xz's mtime...
>>> Checking linux-3.19.tar.xz's mtime...
>>> Checking genpatches-3.19-2.extras.tar.xz's mtime...
>>> Checking genpatches-3.19-2.base.tar.xz's mtime...
>>> WORKDIR is up-to-date, keeping...
 * checking ebuild checksums ;-) ...                                                                                                  [ ok ]
 * checking miscfile checksums ;-) ...                                                                                                [ ok ]
>>> It appears that 'pretend' has already executed for 'gentoo-sources-3.19.1'; skipping.
>>> Remove '/var/tmp/portage/sys-kernel/gentoo-sources-3.19.1/.pretended' to force pretend.
>>> It appears that 'setup' has already executed for 'gentoo-sources-3.19.1'; skipping.
>>> Remove '/var/tmp/portage/sys-kernel/gentoo-sources-3.19.1/.setuped' to force setup.
>>> It appears that 'unpack' has already executed for 'gentoo-sources-3.19.1'; skipping.
>>> Remove '/var/tmp/portage/sys-kernel/gentoo-sources-3.19.1/.unpacked' to force unpack.
>>> Preparing source in /var/tmp/portage/sys-kernel/gentoo-sources-3.19.1/work/linux-3.19.1-gentoo ...
>>> Source prepared.
>>> Configuring source in /var/tmp/portage/sys-kernel/gentoo-sources-3.19.1/work/linux-3.19.1-gentoo ...
>>> Source configured.
>>> Compiling source in /var/tmp/portage/sys-kernel/gentoo-sources-3.19.1/work/linux-3.19.1-gentoo ...
>>> Source compiled.
>>> Test phase [not enabled]: sys-kernel/gentoo-sources-3.19.1

>>> Install gentoo-sources-3.19.1 into /var/tmp/portage/sys-kernel/gentoo-sources-3.19.1/image/ category sys-kernel
>>> Copying sources ...
>>> Completed installing gentoo-sources-3.19.1 into /var/tmp/portage/sys-kernel/gentoo-sources-3.19.1/image/

ecompressdir: bzip2 -9 /usr/share/doc
Comment 11 Erik Zeek 2015-03-17 03:27:55 UTC
(In reply to Mike Pagano from comment #10)
> Can you help me reproduce?
> 
> gcc version 4.9.2 (Gentoo 4.9.2 p1.1, pie-0.6.2)
> 
> #cat /etc/portage/package.env
> sys-kernel/gentoo-sources gentoo-sources
> 
> cat /etc/portage/env/gentoo-sources
> UNIPATCH_EXCLUDE="1500_XATTR_USER_PREFIX.patch"
> 
> #USE=experimental ebuild gentoo-sources-3.19.1.ebuild manifest clean unpack
> install

That works.

What doesn't work is if I set UNIPATCH_EXCLUDE in /etc/portage/env/sys-kernel/gentoo-sources:

# cat /etc/portage/env/sys-kernel/gentoo-sources UNIPATCH_EXCLUDE="1500_XATTR_USER_PREFIX.patch"

With that file, unpacking fails.
Comment 12 Mike Pagano gentoo-dev 2015-03-20 00:16:02 UTC
Ok, I think I fixed it.  I just checked in a change to the eclass. Can you please check after you sync up and get the new eclass.

That might take some time through normal emerge.
Comment 13 Erik Zeek 2015-03-20 20:19:43 UTC
(In reply to Mike Pagano from comment #12)
> Ok, I think I fixed it.  I just checked in a change to the eclass. Can you
> please check after you sync up and get the new eclass.
> 
> That might take some time through normal emerge.

It works for me now.

Thanks!
Comment 14 Mike Pagano gentoo-dev 2015-03-20 20:39:09 UTC
Thanks for making it much easier.  Your debugging and working through this made the solve happen much faster.