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

Attachments

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

Replies