[pacman-dev] [PATCH] libmakepkg/tidy: fix debug sources not being properly detected sometimes

Eli Schwartz eschwartz at archlinux.org
Tue Jun 19 16:00:35 UTC 2018


On 06/12/2018 09:17 PM, Eli Schwartz wrote:
> DW_AT_comp_dir is meant to contain the directory in which the compiler
> was run
> 
> DW_AT_name contains the source file the compiler was told to use.
> 
> In the event that DW_AT_name is an absolute path, it is (obviously) not
> meant to be computed relative to DW_AT_comp_dir. However, we did not
> handle this correctly, and as a result tried to copy source files using
> doubled-up filepaths.
> 
> The correct approach should be to use DW_AT_name on its own, in the
> event that it is an absolute path.

Finish this paragraph with "See
http://wiki.dwarfstd.org/index.php?title=Best_Practices"

Thanks Allan for finding this documented somewhere.

> This fixes debug package generation for many packages that use absolute
> paths in their build systems... like CMake.
> 
> Reported-by: Jagannathan Tiruvallur Eachambadi <jagannathante at gmail.com>
> Signed-off-by: Eli Schwartz <eschwartz at archlinux.org>
> ---
>  scripts/libmakepkg/tidy/strip.sh.in | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/scripts/libmakepkg/tidy/strip.sh.in b/scripts/libmakepkg/tidy/strip.sh.in
> index 36d1b89e..5937e13c 100644
> --- a/scripts/libmakepkg/tidy/strip.sh.in
> +++ b/scripts/libmakepkg/tidy/strip.sh.in
> @@ -37,7 +37,7 @@ build_id() {
>  
>  source_files() {
>  	LANG=C readelf "$1" --debug-dump | \
> -		awk '/DW_AT_name +:/{name=$8}/DW_AT_comp_dir +:/{print $8 "/" name}'
> +		awk '/DW_AT_name +:/{name=$8}/DW_AT_comp_dir +:/{{if (name !~ /^\//) {printf "%s/", $8}}{print name}}'
>  }
>  
>  strip_file() {
> 


-- 
Eli Schwartz
Bug Wrangler and Trusted User

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <https://lists.archlinux.org/pipermail/pacman-dev/attachments/20180619/a0c9835f/attachment.asc>


More information about the pacman-dev mailing list