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