On 09/28/2018 12:55 AM, Michał Górny wrote:
> Whenever the install directory contains files that would collide upon
> (re)compressing, report them explicitly and fail.  This indicates
> a serious problem in ebuild and since we don't know which of the files
> is correct, we should not attempt to choose between them.
> 
> To reduce performance impact, the check is only done whenever compressed
> files are found.  This is sufficient since for issue to occur there must
> be at least one compressed variant.
> 
> Bug: https://bugs.gentoo.org/667072
> Signed-off-by: Michał Górny <mgo...@gentoo.org>
> ---
>  bin/ecompress | 24 ++++++++++++++++++++++++
>  1 file changed, 24 insertions(+)
> 
> diff --git a/bin/ecompress b/bin/ecompress
> index 36bdb585b..bc1f5e08a 100755
> --- a/bin/ecompress
> +++ b/bin/ecompress
> @@ -49,6 +49,30 @@ while [[ $# -gt 0 ]] ; do
>                               find_args+=( -size 
> "+${PORTAGE_DOCOMPRESS_SIZE_LIMIT}c" )
>  
>                       while IFS= read -d '' -r path; do
> +                             # detect the horrible posibility of the ebuild 
> installing
> +                             # colliding compressed and/or uncompressed 
> variants
> +                             # and fail hard (bug #667072)
> +                             #
> +                             # note: to save time, we need to do this only 
> if there's
> +                             # at least one compressed file
> +                             case ${path} in
> +                                     *.Z|*.gz|*.bz2|*.lzma|*.xz)
> +                                             vpath=${path%.*}
> +                                             for comp in '' .Z .gz .bz2 
> .lzma .xz; do
> +                                                     if [[ ${vpath}${comp} 
> != ${path} && \
> +                                                                     -e 
> ${vpath}${comp} ]]; then
> +                                                             eerror 
> "Colliding files found for ecompress:"
> +                                                             eerror
> +                                                             eerror "  
> ${path#${D%/}}"
> +                                                             eerror "  
> ${vpath#${D%/}}${comp}"
> +                                                             eerror
> +                                                             eerror "Please 
> remove the incorrect of those files."
> +                                                             die "Aborting 
> due to colliding compressed files."
> +                                                     fi
> +                                             done
> +                                             ;;
> +                             esac
> +
>                               >> "${path}.ecompress" || die
>                       done < <(find "${find_args[@]}" -print0 || die)
>               fi
> 

This breaks compatibility, so let's use eqawarn and simply leave the
compressed files in place for now, then make it die in the next EAPI.
-- 
Thanks,
Zac

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to