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 3/4] ecompress: Detect and report colliding (un)compressed files
Date: Fri, 28 Sep 2018 18:43:46
Message-Id: d0c1f47a-d9ed-8e5a-dc10-c719ccbc7381@gentoo.org
In Reply to: Re: [gentoo-portage-dev] [PATCH 3/4] ecompress: Detect and report colliding (un)compressed files by "Michał Górny"
1 On 09/28/2018 11:25 AM, Michał Górny wrote:
2 > On Fri, 2018-09-28 at 11:01 -0700, Zac Medico wrote:
3 >> On 09/28/2018 12:55 AM, Michał Górny wrote:
4 >>> Whenever the install directory contains files that would collide upon
5 >>> (re)compressing, report them explicitly and fail. This indicates
6 >>> a serious problem in ebuild and since we don't know which of the files
7 >>> is correct, we should not attempt to choose between them.
8 >>>
9 >>> To reduce performance impact, the check is only done whenever compressed
10 >>> files are found. This is sufficient since for issue to occur there must
11 >>> be at least one compressed variant.
12 >>>
13 >>> Bug: https://bugs.gentoo.org/667072
14 >>> Signed-off-by: Michał Górny <mgorny@g.o>
15 >>> ---
16 >>> bin/ecompress | 24 ++++++++++++++++++++++++
17 >>> 1 file changed, 24 insertions(+)
18 >>>
19 >>> diff --git a/bin/ecompress b/bin/ecompress
20 >>> index 36bdb585b..bc1f5e08a 100755
21 >>> --- a/bin/ecompress
22 >>> +++ b/bin/ecompress
23 >>> @@ -49,6 +49,30 @@ while [[ $# -gt 0 ]] ; do
24 >>> find_args+=( -size "+${PORTAGE_DOCOMPRESS_SIZE_LIMIT}c" )
25 >>>
26 >>> while IFS= read -d '' -r path; do
27 >>> + # detect the horrible posibility of the ebuild installing
28 >>> + # colliding compressed and/or uncompressed variants
29 >>> + # and fail hard (bug #667072)
30 >>> + #
31 >>> + # note: to save time, we need to do this only if there's
32 >>> + # at least one compressed file
33 >>> + case ${path} in
34 >>> + *.Z|*.gz|*.bz2|*.lzma|*.xz)
35 >>> + vpath=${path%.*}
36 >>> + for comp in '' .Z .gz .bz2 .lzma .xz; do
37 >>> + if [[ ${vpath}${comp} != ${path} && \
38 >>> + -e ${vpath}${comp} ]]; then
39 >>> + eerror "Colliding files found for ecompress:"
40 >>> + eerror
41 >>> + eerror " ${path#${D%/}}"
42 >>> + eerror " ${vpath#${D%/}}${comp}"
43 >>> + eerror
44 >>> + eerror "Please remove the incorrect of those files."
45 >>> + die "Aborting due to colliding compressed files."
46 >>> + fi
47 >>> + done
48 >>> + ;;
49 >>> + esac
50 >>> +
51 >>> >> "${path}.ecompress" || die
52 >>> done < <(find "${find_args[@]}" -print0 || die)
53 >>> fi
54 >>>
55 >>
56 >> This breaks compatibility, so let's use eqawarn and simply leave the
57 >> compressed files in place for now, then make it die in the next EAPI.
58 >
59 > Compatibility with what? With one ebuild where maintainer failed to
60 > handle recent eqawarn? Given that he couldn't have expected any sane
61 > behavior previously?
62
63 How do you know how many ebuilds are affected, either in the gentoo
64 repository or other repository? Making it die can potentially introduce
65 a burden on users if the ebuilds that they rely on will no longer build.
66 It's much easier for users if the ebuild maintainers have an opportunity
67 to fix issues before the ebuilds begin to die.
68 --
69 Thanks,
70 Zac

Attachments

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