Gentoo Archives: gentoo-dev

From: Markos Chandras <hwoarang@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] epatch: reject patches with relative paths
Date: Fri, 31 Dec 2010 02:03:50
Message-Id: 20101231020148.GA26165@Mystical
In Reply to: Re: [gentoo-dev] epatch: reject patches with relative paths by Mike Frysinger
1 On Thu, Dec 30, 2010 at 08:28:42PM -0500, Mike Frysinger wrote:
2 > On Thursday, December 30, 2010 19:42:35 Robin H. Johnson wrote:
3 > > On Thu, Dec 30, 2010 at 07:04:25PM -0500, Mike Frysinger wrote:
4 > > > epatch was changed to auto-skip the first path element when it is
5 > > > absolute (starts with a slash). the reason was to avoid issues with
6 > > > patches touching files outside of $PWD (which is bad if sandbox is
7 > > > disabled).
8 > >
9 > > +1 from me, but can we have a QA prefix on the ewarn output?
10 >
11 > --- eutils.eclass 22 Nov 2010 00:31:03 -0000 1.352
12 > +++ eutils.eclass 31 Dec 2010 01:28:37 -0000
13 > @@ -360,6 +360,13 @@ epatch() {
14 > count=1
15 > printf "NOTE: skipping -p0 due to absolute paths in patch:\n%s\n" "${abs_paths}" >> "${STDERR_TARGET}"
16 > fi
17 > + # Similar reason, but with relative paths.
18 > + local rel_paths=$(egrep -n '^[-+]{3} [^ ]*[.][.]/' "${PATCH_TARGET}")
19 > + if [[ -n ${rel_paths} ]] ; then
20 > + eqawarn "QA Notice: Your patch has relative paths."
21 > + eqawarn " In the future this will cause a failure."
22 > + eqawarn "${rel_paths}"
23 > + fi
24 >
25 > # Dynamically detect the correct -p# ... i'm lazy, so shoot me :/
26 > while [[ ${count} -lt 5 ]] ; do
27 > -mike
28
29 Mike,
30
31 Maybe we should open a tracker to identify which packages use relative paths
32 in their patches before making this control check fatal.
33
34 Regards,
35 --
36 Markos Chandras (hwoarang)
37 Gentoo Linux Developer
38 Web: http://hwoarang.silverarrow.org
39 Key ID: 441AC410
40 Key FP: AAD0 8591 E3CD 445D 6411 3477 F7F7 1E8E 441A C410

Replies

Subject Author
Re: [gentoo-dev] epatch: reject patches with relative paths Mike Frysinger <vapier@g.o>