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 v2 3/4] ecompress: Detect and report colliding (un)compressed files
Date: Fri, 28 Sep 2018 20:24:09
Message-Id: 5e1cb9f1-e43b-9620-a62f-72de39cdae34@gentoo.org
In Reply to: [gentoo-portage-dev] [PATCH v2 3/4] ecompress: Detect and report colliding (un)compressed files by "Michał Górny"
1 On 09/28/2018 12:51 PM, Michał Górny wrote:
2 > Whenever the install directory contains files that would collide upon
3 > (re)compressing, report them explicitly and skip decompressing.
4 >
5 > To reduce performance impact, the check is only done whenever compressed
6 > files are found. This is sufficient since for issue to occur there must
7 > be at least one compressed variant.
8 >
9 > Bug: https://bugs.gentoo.org/667072
10 > Signed-off-by: Michał Górny <mgorny@g.o>
11 >
12 > fixup
13 > ---
14 > bin/ecompress | 32 ++++++++++++++++++++++++++++++++
15 > 1 file changed, 32 insertions(+)
16 >
17 > diff --git a/bin/ecompress b/bin/ecompress
18 > index 36bdb585b..635073b5f 100755
19 > --- a/bin/ecompress
20 > +++ b/bin/ecompress
21 > @@ -48,9 +48,41 @@ while [[ $# -gt 0 ]] ; do
22 > [[ -n ${PORTAGE_DOCOMPRESS_SIZE_LIMIT} ]] &&
23 > find_args+=( -size "+${PORTAGE_DOCOMPRESS_SIZE_LIMIT}c" )
24 >
25 > + declare -A collisions
26 > while IFS= read -d '' -r path; do
27 > + # detect the horrible posibility of the ebuild installing
28 > + # colliding compressed and/or uncompressed variants
29 > + # and fail hard (bug #667072)
30 > + #
31 > + # note: to save time, we need to do this only if there's
32 > + # at least one compressed file
33 > + case ${path} in
34 > + *.Z|*.gz|*.bz2|*.lzma|*.xz)
35 > + vpath=${path%.*}
36 > + for comp in '' .Z .gz .bz2 .lzma .xz; do
37 > + if [[ ${vpath}${comp} != ${path} && \
38 > + -e ${vpath}${comp} ]]; then
39 > + collisions[${path}]=1
40 > + collisions[${vpath}]=1
41 > + # ignore compressed variants in that case
42 > + continue 2
43 > + fi
44 > + done
45 > + ;;
46 > + esac
47 > +
48 > >> "${path}.ecompress" || die
49 > done < <(find "${find_args[@]}" -print0 || die)
50 > +
51 > + if [[ ${#collisions[@]} -gt 0 ]]; then
52 > + eqawarn "Colliding files found by ecompress:"
53 > + eqawarn
54 > + for x in "${!collisions[@]}"; do
55 > + eqawarn " ${x}"
56 > + done
57 > + eqawarn
58 > + eqawarn "Please remove the extraneous compressed variants."
59 > + fi
60 > fi
61 >
62 > exit 0
63 >
64
65 The whole series looks good to me now. Thanks! Please merge.
66 --
67 Thanks,
68 Zac

Attachments

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