Subject: Re: [bug#72395] [PATCH] syscalls: Support musl libc in openpty and login-tty

From: Sören Tempel <[email-masked]>
Date: Fri, 03 Aug 2024 12:38:36 +0200

Hi!

Z572 <[email-masked]> wrote:
> In my understanding, when we can't find libutil, will try to find it in
> libc. Do you have any problems using it?

Yea, for example consider the invocation `guix import pypi cart`.
Without this patch, this emits the following error message for me
on Alpine Linux Edge (a musl-based Linux distribution):

	guix import: error: no source release for pypi package cart 1.2.2

	hint: Backtrace:
	In ice-9/boot-9.scm:
	  1685:16 19 (raise-exception _ #:continuable? _)
	In guix/ui.scm:
	   867:16 18 (_ _)
	   340:43 17 (display-hint "This indicates that the\npackage is aâ€¦" . #)
	In ice-9/boot-9.scm:
	  1747:15 16 (with-exception-handler #<procedure 7f8c8f9b2660 at icâ€¦> â€¦)
	  3474:28 15 (_)
	  3327:17 14 (resolve-interface (guix build syscalls) #:select _ # _ â€¦)
	In ice-9/threads.scm:
	    390:8 13 (_ _)
	In ice-9/boot-9.scm:
	  3253:13 12 (_)
	In ice-9/threads.scm:
	    390:8 11 (_ _)
	In ice-9/boot-9.scm:
	  3544:20 10 (_)
	   2836:4  9 (save-module-excursion #<procedure 7f8c8f9b2600 at ice-â€¦>)
	  3564:26  8 (_)
	In unknown file:
		   7 (primitive-load-path "guix/build/syscalls" #<procedure â€¦>)
	In guix/build/syscalls.scm:
	  2385:14  6 (_)
	In ice-9/boot-9.scm:
	  1747:15  5 (with-exception-handler #<procedure 7f8c8fa3b270 at icâ€¦> â€¦)
	In guix/build/syscalls.scm:
	   456:39  4 (_)
	In ice-9/boot-9.scm:
	  1747:15  3 (with-exception-handler #<procedure 7f8c8fa3b240 at icâ€¦> â€¦)
	In unknown file:
		   2 (dynamic-link "libutil")
	In system/foreign-library.scm:
	   190:25  1 (load-foreign-library _ #:extensions _ # _ #:search-path â€¦)
	In unknown file:
		   0 (dlopen "libutil.so" 1)

	ERROR: In procedure dlopen:
	In procedure dlopen: file "libutil.so", message "libutil.so: cannot open shared object file: No such file or directory"

With this patch applied, I instead get:

	guix import: error: no source release for pypi package cart 1.2.2

	hint: This indicates that the package is available on PyPI, but only as a "wheel" containing
	binaries, not source.  To build it from source, refer to the upstream repository at
	`https://github.com/CybercentreCanada/cart'.

I assume the fallback code in syscall->procedure does not work correctly
then and the "correct fix" would be to fix this fallback code?

Greetings,
Sören