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 1/3] ecompress: Fix crash on duplicate compressed & uncompressed files
Date: Tue, 25 Sep 2018 20:29:07
Message-Id: 2b6a3171-c33a-9d56-e22f-4c34263a7f81@gentoo.org
In Reply to: Re: [gentoo-portage-dev] [PATCH 1/3] ecompress: Fix crash on duplicate compressed & uncompressed files by "Michał Górny"
1 On 09/25/2018 01:07 PM, Michał Górny wrote:
2 > On Tue, 2018-09-25 at 12:58 -0700, Zac Medico wrote:
3 >> On 09/25/2018 12:55 PM, Zac Medico wrote:
4 >>> On 09/25/2018 12:18 PM, Michał Górny wrote:
5 >>>> Fix crash due to race condition in handling the same file being present
6 >>>> both in compressed and uncompressed variants. If that is the case,
7 >>>> just queue the uncompressed variant for compression, and ignore
8 >>>> the other compressed variants.
9 >>>>
10 >>>> Bug: https://bugs.gentoo.org/667072
11 >>>> Signed-off-by: Michał Górny <mgorny@g.o>
12 >>>> ---
13 >>>> bin/ecompress | 7 +++++++
14 >>>> 1 file changed, 7 insertions(+)
15 >>>>
16 >>>> diff --git a/bin/ecompress b/bin/ecompress
17 >>>> index 36bdb585b..d5ff3796c 100755
18 >>>> --- a/bin/ecompress
19 >>>> +++ b/bin/ecompress
20 >>>> @@ -49,6 +49,13 @@ while [[ $# -gt 0 ]] ; do
21 >>>> find_args+=( -size "+${PORTAGE_DOCOMPRESS_SIZE_LIMIT}c" )
22 >>>>
23 >>>> while IFS= read -d '' -r path; do
24 >>>> + # if both compressed and uncompressed variant exists,
25 >>>> + # skip the compressed variants (bug #667072)
26 >>>> + case ${path} in
27 >>>> + *.Z|*.gz|*.bz2|*.lzma|*.xz)
28 >>>> + [[ -s ${path%.*} ]] && continue
29 >>>> + ;;
30 >>>> + esac
31 >>>
32 >>> In theory, we'd still have a problem if the file existed with muliple
33 >>> compressions, right? Maybe a good solution is to strip the compression
34 >>> extension here, and then have ecompress-file check for duplicates?
35 >>
36 >> Alternatively, we could uncompress the pre-compressed files right here.
37 >
38 > That would cause them to be decompressed even if the path is eventually
39 > exclude via 'docompress -x'.
40
41 I suppose we could record the extensions in a shared .ecompress file,
42 and then ecompress-file could read the existing extensions from that file.
43 --
44 Thanks,
45 Zac

Attachments

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

Replies