FS#74486 - do not overwrite files if stripping fails
Attached to Project:
Pacman
Opened by Ting-Wei Lan (lantw44) - Sunday, 17 April 2022, 15:44 GMT
Last edited by Allan McRae (Allan) - Tuesday, 02 August 2022, 01:07 GMT
Opened by Ting-Wei Lan (lantw44) - Sunday, 17 April 2022, 15:44 GMT
Last edited by Allan McRae (Allan) - Tuesday, 02 August 2022, 01:07 GMT
|
Details
Description:
gnutls package has Guile bindings enabled, but all .go files it installs are empty. This causes my guix package (https://aur.archlinux.org/packages/guix#comment-861221) to fail to build because of broken Guile bindings. Additional info: gnutls 3.7.4-1 Steps to reproduce: $ find /usr/lib/guile/2.2/site-ccache/gnutls* -ls 3420447 4 drwxr-xr-x 2 root root 4096 Apr 11 19:19 /usr/lib/guile/2.2/site-ccache/gnutls 3420448 0 -rw-r--r-- 1 root root 0 Mar 17 19:25 /usr/lib/guile/2.2/site-ccache/gnutls/extra.go 3420449 0 -rw-r--r-- 1 root root 0 Mar 17 19:25 /usr/lib/guile/2.2/site-ccache/gnutls.go |
This task depends upon
Closed by Allan McRae (Allan)
Tuesday, 02 August 2022, 01:07 GMT
Reason for closing: Fixed
Additional comments about closing: git commit 18152a211aeee07e655c2cc4438c25e558e3b8aa
Tuesday, 02 August 2022, 01:07 GMT
Reason for closing: Fixed
Additional comments about closing: git commit 18152a211aeee07e655c2cc4438c25e558e3b8aa
objcopy: Unable to recognise the format of the input file `./usr/lib/guile/2.2/site-ccache/gnutls.go'
objcopy: Unable to recognise the format of the input file `./usr/lib/guile/2.2/site-ccache/gnutls.go'
cat: ./usr/lib/guile/2.2/site-ccache/gnutls.go.Spj00D: No such file or directory
rm: cannot remove './usr/lib/guile/2.2/site-ccache/gnutls.go.Spj00D': No such file or directory
ln: failed to access '/build/gnutls/pkg/gnutls-debug/usr/lib/debug/./usr/lib/guile/2.2/site-ccache/gnutls.go.debug': No such file or directory
$ find /usr/lib/guile/2.2/site-ccache/gnutls* -ls
3420447 4 drwxr-xr-x 2 root root 4096 Apr 24 03:37 /usr/lib/guile/2.2/site-ccache/gnutls
3566673 72 -rw-r--r-- 1 root root 72261 Apr 24 03:06 /usr/lib/guile/2.2/site-ccache/gnutls/extra.go
3566643 192 -rw-r--r-- 1 root root 195765 Apr 24 03:06 /usr/lib/guile/2.2/site-ccache/gnutls.go
$ find /usr/lib/guile/2.2/site-ccache/gnutls* -exec file '{}' +
/usr/lib/guile/2.2/site-ccache/gnutls: directory
/usr/lib/guile/2.2/site-ccache/gnutls/extra.go: ELF 64-bit LSB shared object, no machine, version 1 (embedded), dynamically linked, with debug_info, not stripped
/usr/lib/guile/2.2/site-ccache/gnutls.go: ELF 64-bit LSB shared object, no machine, version 1 (embedded), dynamically linked, with debug_info, not stripped
@dvzrv: Any idea if this can be caused by our way creating the build package? It seems Debian/Fedora/Gentoo build guile extension without this issue.
Feel free to report it upstream if you think it should be fixed there:
https://gitlab.com/gnutls/gnutls/-/issues
objcopy --only-keep-debug "$binary" "$dbgdir/$binary.debug"
local tempfile=$(mktemp "$binary.XXXXXX")
objcopy --add-gnu-debuglink="$dbgdir/${binary#/}.debug" "$binary" "$tempfile"
cat "$tempfile" > "$binary"
rm "$tempfile"
If objcopy fails to process the file, 'tempfile' won't exist. Therefore, the cat command will break 'binary' by truncating it to zero size.
I think makepkg shouldn't break an ELF file it can't strip. It should check if objcopy succeeds before replacing the file.