[pacman-dev,v2] libmakepkg: when stripping split debug symbols, warn on duplicate paths

Message ID 20191007012951.321229-1-eschwartz@archlinux.org
State Changes Requested
Headers show
Series
  • [pacman-dev,v2] libmakepkg: when stripping split debug symbols, warn on duplicate paths
Related show

Commit Message

Eli Schwartz Oct. 7, 2019, 1:29 a.m. UTC
Trying to strip multiple files installed to the same filepath (in
different components of a split package) can produce surprising results
if those files are built using different options. Per FS#63356 this is
not a supported PKGBUILD configuration. Instead, warn about such cases
when producing debug packages.

Fixes FS#63366

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
---

v2: fix leading "./" in reported paths

 scripts/libmakepkg/tidy/strip.sh.in | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

Comments

Allan McRae Oct. 7, 2019, 2:04 a.m. UTC | #1
On 7/10/19 11:29 am, Eli Schwartz wrote:
> Trying to strip multiple files installed to the same filepath (in
> different components of a split package) can produce surprising results
> if those files are built using different options. Per FS#63356 this is
> not a supported PKGBUILD configuration. Instead, warn about such cases
> when producing debug packages.
> 
> Fixes FS#63366
> 
> Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
> ---
> 
> v2: fix leading "./" in reported paths
> 
>  scripts/libmakepkg/tidy/strip.sh.in | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/scripts/libmakepkg/tidy/strip.sh.in b/scripts/libmakepkg/tidy/strip.sh.in
> index 5bc0a842..892daf49 100644
> --- a/scripts/libmakepkg/tidy/strip.sh.in
> +++ b/scripts/libmakepkg/tidy/strip.sh.in
> @@ -46,7 +46,13 @@ strip_file() {
>  	if check_option "debug" "y"; then
>  		local bid=$(build_id "$binary")
>  
> -		# has this file already been stripped
> +		# has this filepath been stripped before under a different Build Id
> +		if [[ -f "$dbgdir/$binary.debug" ]]; then
> +			if [[ -n $bid && $bid != $(build_id "$dbgdir/$binary.debug") ]]; then
> +				warning "Split package with multiple copies of the file '%s' have different Build Ids" "${binary#./}"

I suggest adding a consequence line after.  e.g.

warning "Debug symbols are included for the first copy only"

> +			fi
> +		fi
> +		# has this file's hardlink already been stripped
>  		if [[ -n "$bid" ]]; then
>  			if [[ -f "$dbgdir/.build-id/${bid:0:2}/${bid:2}.debug" ]]; then
>  				return
>

Patch

diff --git a/scripts/libmakepkg/tidy/strip.sh.in b/scripts/libmakepkg/tidy/strip.sh.in
index 5bc0a842..892daf49 100644
--- a/scripts/libmakepkg/tidy/strip.sh.in
+++ b/scripts/libmakepkg/tidy/strip.sh.in
@@ -46,7 +46,13 @@  strip_file() {
 	if check_option "debug" "y"; then
 		local bid=$(build_id "$binary")
 
-		# has this file already been stripped
+		# has this filepath been stripped before under a different Build Id
+		if [[ -f "$dbgdir/$binary.debug" ]]; then
+			if [[ -n $bid && $bid != $(build_id "$dbgdir/$binary.debug") ]]; then
+				warning "Split package with multiple copies of the file '%s' have different Build Ids" "${binary#./}"
+			fi
+		fi
+		# has this file's hardlink already been stripped
 		if [[ -n "$bid" ]]; then
 			if [[ -f "$dbgdir/.build-id/${bid:0:2}/${bid:2}.debug" ]]; then
 				return