Gentoo Archives: gentoo-portage-dev

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

Attachments

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

Replies