Gentoo Archives: gentoo-portage-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-portage-dev@l.g.o
Subject: Re: [gentoo-portage-dev] [PATCH 3/4] ecompress: Detect and report colliding (un)compressed files
Date: Fri, 28 Sep 2018 18:25:39
Message-Id: 1538159126.1359.0.camel@gentoo.org
In Reply to: Re: [gentoo-portage-dev] [PATCH 3/4] ecompress: Detect and report colliding (un)compressed files by Zac Medico
1 On Fri, 2018-09-28 at 11:01 -0700, Zac Medico wrote:
2 > On 09/28/2018 12:55 AM, Michał Górny wrote:
3 > > Whenever the install directory contains files that would collide upon
4 > > (re)compressing, report them explicitly and fail. This indicates
5 > > a serious problem in ebuild and since we don't know which of the files
6 > > is correct, we should not attempt to choose between them.
7 > >
8 > > To reduce performance impact, the check is only done whenever compressed
9 > > files are found. This is sufficient since for issue to occur there must
10 > > be at least one compressed variant.
11 > >
12 > > Bug: https://bugs.gentoo.org/667072
13 > > Signed-off-by: Michał Górny <mgorny@g.o>
14 > > ---
15 > > bin/ecompress | 24 ++++++++++++++++++++++++
16 > > 1 file changed, 24 insertions(+)
17 > >
18 > > diff --git a/bin/ecompress b/bin/ecompress
19 > > index 36bdb585b..bc1f5e08a 100755
20 > > --- a/bin/ecompress
21 > > +++ b/bin/ecompress
22 > > @@ -49,6 +49,30 @@ while [[ $# -gt 0 ]] ; do
23 > > find_args+=( -size "+${PORTAGE_DOCOMPRESS_SIZE_LIMIT}c" )
24 > >
25 > > while IFS= read -d '' -r path; do
26 > > + # detect the horrible posibility of the ebuild installing
27 > > + # colliding compressed and/or uncompressed variants
28 > > + # and fail hard (bug #667072)
29 > > + #
30 > > + # note: to save time, we need to do this only if there's
31 > > + # at least one compressed file
32 > > + case ${path} in
33 > > + *.Z|*.gz|*.bz2|*.lzma|*.xz)
34 > > + vpath=${path%.*}
35 > > + for comp in '' .Z .gz .bz2 .lzma .xz; do
36 > > + if [[ ${vpath}${comp} != ${path} && \
37 > > + -e ${vpath}${comp} ]]; then
38 > > + eerror "Colliding files found for ecompress:"
39 > > + eerror
40 > > + eerror " ${path#${D%/}}"
41 > > + eerror " ${vpath#${D%/}}${comp}"
42 > > + eerror
43 > > + eerror "Please remove the incorrect of those files."
44 > > + die "Aborting due to colliding compressed files."
45 > > + fi
46 > > + done
47 > > + ;;
48 > > + esac
49 > > +
50 > > >> "${path}.ecompress" || die
51 > > done < <(find "${find_args[@]}" -print0 || die)
52 > > fi
53 > >
54 >
55 > This breaks compatibility, so let's use eqawarn and simply leave the
56 > compressed files in place for now, then make it die in the next EAPI.
57
58 Compatibility with what? With one ebuild where maintainer failed to
59 handle recent eqawarn? Given that he couldn't have expected any sane
60 behavior previously?
61
62 --
63 Best regards,
64 Michał Górny

Attachments

File name MIME type
signature.asc application/pgp-signature

Replies