1 |
On Tue, 2018-09-25 at 13:29 -0700, Zac Medico wrote: |
2 |
> On 09/25/2018 01:07 PM, Michał Górny wrote: |
3 |
> > On Tue, 2018-09-25 at 12:58 -0700, Zac Medico wrote: |
4 |
> > > On 09/25/2018 12:55 PM, Zac Medico wrote: |
5 |
> > > > On 09/25/2018 12:18 PM, Michał Górny wrote: |
6 |
> > > > > Fix crash due to race condition in handling the same file being present |
7 |
> > > > > both in compressed and uncompressed variants. If that is the case, |
8 |
> > > > > just queue the uncompressed variant for compression, and ignore |
9 |
> > > > > the other compressed variants. |
10 |
> > > > > |
11 |
> > > > > Bug: https://bugs.gentoo.org/667072 |
12 |
> > > > > Signed-off-by: Michał Górny <mgorny@g.o> |
13 |
> > > > > --- |
14 |
> > > > > bin/ecompress | 7 +++++++ |
15 |
> > > > > 1 file changed, 7 insertions(+) |
16 |
> > > > > |
17 |
> > > > > diff --git a/bin/ecompress b/bin/ecompress |
18 |
> > > > > index 36bdb585b..d5ff3796c 100755 |
19 |
> > > > > --- a/bin/ecompress |
20 |
> > > > > +++ b/bin/ecompress |
21 |
> > > > > @@ -49,6 +49,13 @@ while [[ $# -gt 0 ]] ; do |
22 |
> > > > > find_args+=( -size "+${PORTAGE_DOCOMPRESS_SIZE_LIMIT}c" ) |
23 |
> > > > > |
24 |
> > > > > while IFS= read -d '' -r path; do |
25 |
> > > > > + # if both compressed and uncompressed variant exists, |
26 |
> > > > > + # skip the compressed variants (bug #667072) |
27 |
> > > > > + case ${path} in |
28 |
> > > > > + *.Z|*.gz|*.bz2|*.lzma|*.xz) |
29 |
> > > > > + [[ -s ${path%.*} ]] && continue |
30 |
> > > > > + ;; |
31 |
> > > > > + esac |
32 |
> > > > |
33 |
> > > > In theory, we'd still have a problem if the file existed with muliple |
34 |
> > > > compressions, right? Maybe a good solution is to strip the compression |
35 |
> > > > extension here, and then have ecompress-file check for duplicates? |
36 |
> > > |
37 |
> > > Alternatively, we could uncompress the pre-compressed files right here. |
38 |
> > |
39 |
> > That would cause them to be decompressed even if the path is eventually |
40 |
> > exclude via 'docompress -x'. |
41 |
> |
42 |
> I suppose we could record the extensions in a shared .ecompress file, |
43 |
> and then ecompress-file could read the existing extensions from that file. |
44 |
|
45 |
Could we please solve the problem here instead of inventing super- |
46 |
complex solutions to a non-existing theoretical problem that are |
47 |
eventually going to cause more issues than real gain? Just like this |
48 |
problem wouldn't have occurred if we haven't added entirely pointless |
49 |
parallel compression of tiny files. |
50 |
|
51 |
-- |
52 |
Best regards, |
53 |
Michał Górny |