Gentoo Archives: gentoo-portage-dev

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

Attachments

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

Replies