1 |
On 09/25/2018 12:18 PM, Michał Górny wrote: |
2 |
> Fix crash due to race condition in handling the same file being present |
3 |
> both in compressed and uncompressed variants. If that is the case, |
4 |
> just queue the uncompressed variant for compression, and ignore |
5 |
> the other compressed variants. |
6 |
> |
7 |
> Bug: https://bugs.gentoo.org/667072 |
8 |
> Signed-off-by: Michał Górny <mgorny@g.o> |
9 |
> --- |
10 |
> bin/ecompress | 7 +++++++ |
11 |
> 1 file changed, 7 insertions(+) |
12 |
> |
13 |
> diff --git a/bin/ecompress b/bin/ecompress |
14 |
> index 36bdb585b..d5ff3796c 100755 |
15 |
> --- a/bin/ecompress |
16 |
> +++ b/bin/ecompress |
17 |
> @@ -49,6 +49,13 @@ while [[ $# -gt 0 ]] ; do |
18 |
> find_args+=( -size "+${PORTAGE_DOCOMPRESS_SIZE_LIMIT}c" ) |
19 |
> |
20 |
> while IFS= read -d '' -r path; do |
21 |
> + # if both compressed and uncompressed variant exists, |
22 |
> + # skip the compressed variants (bug #667072) |
23 |
> + case ${path} in |
24 |
> + *.Z|*.gz|*.bz2|*.lzma|*.xz) |
25 |
> + [[ -s ${path%.*} ]] && continue |
26 |
> + ;; |
27 |
> + esac |
28 |
|
29 |
In theory, we'd still have a problem if the file existed with muliple |
30 |
compressions, right? Maybe a good solution is to strip the compression |
31 |
extension here, and then have ecompress-file check for duplicates? |
32 |
|
33 |
> >> "${path}.ecompress" || die |
34 |
> done < <(find "${find_args[@]}" -print0 || die) |
35 |
> fi |
36 |
> |
37 |
|
38 |
|
39 |
-- |
40 |
Thanks, |
41 |
Zac |