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 |