Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 752486 - [Future EAPI] Default src_prepare should not accept options in PATCHES
Summary: [Future EAPI] Default src_prepare should not accept options in PATCHES
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Hosted Projects
Classification: Unclassified
Component: PMS/EAPI (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: PMS/EAPI
URL:
Whiteboard: in-eapi-8
Keywords:
Depends on:
Blocks: future-eapi
  Show dependency tree
 
Reported: 2020-11-03 10:36 UTC by Ulrich Müller
Modified: 2021-06-13 20:36 UTC (History)
2 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 Ulrich Müller gentoo-dev 2020-11-03 10:36:21 UTC
As discussed in #gentoo-qa, the current implementation allows "clever" uses like PATCHES=( -p0 foo.patch bar.patch ). AFAICS this isn't used in the tree, but has been seen in at least one user-contributed ebuild.

The proposal is to add -- as eapply's first parameter which would allow only file arguments in PATCHES.

src_prepare() {
    if [[ $(declare -p PATCHES 2>/dev/null) == "declare -a"* ]]; then
        [[ -n ${PATCHES[@]} ]] && eapply -- "${PATCHES[@]}"
    else
        [[ -n ${PATCHES} ]] && eapply -- ${PATCHES}
    fi
    eapply_user
}
Comment 1 Larry the Git Cow gentoo-dev 2021-05-24 04:55:32 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/portage.git/commit/?id=23727e2b902b2352aeed3ded659f19d5aa65898a

commit 23727e2b902b2352aeed3ded659f19d5aa65898a
Author:     Michał Górny <mgorny@gentoo.org>
AuthorDate: 2021-05-12 16:21:33 +0000
Commit:     Zac Medico <zmedico@gentoo.org>
CommitDate: 2021-05-24 04:47:49 +0000

    Disallow options in PATCHES in EAPI 8
    
    Bug: https://bugs.gentoo.org/752486
    Signed-off-by: Michał Górny <mgorny@gentoo.org>
    Signed-off-by: Zac Medico <zmedico@gentoo.org>

 bin/phase-functions.sh |  6 ++++++
 bin/phase-helpers.sh   | 11 +++++++++++
 2 files changed, 17 insertions(+)
Comment 2 Larry the Git Cow gentoo-dev 2021-06-13 19:18:53 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/pms.git/commit/?id=a3693aec2011a666a437e3cea777012ac26fa1b2

commit a3693aec2011a666a437e3cea777012ac26fa1b2
Author:     Ulrich Müller <ulm@gentoo.org>
AuthorDate: 2021-05-16 19:06:02 +0000
Commit:     Ulrich Müller <ulm@gentoo.org>
CommitDate: 2021-06-05 08:55:37 +0000

    EAPI 8: Default src_prepare doesn't accept options in PATCHES
    
    Also simplify array detection by using the @a operator in parameter
    expansion. This feature was introduced in bash-4.4.
    
    Bug: https://bugs.gentoo.org/752486
    Signed-off-by: Ulrich Müller <ulm@gentoo.org>

 eapi-differences.tex |  3 ++-
 ebuild-functions.tex | 21 ++++++++++++++++++---
 2 files changed, 20 insertions(+), 4 deletions(-)