GNU bug report logs - #72395
[PATCH] syscalls: Support musl libc in openpty and login-tty

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: guix-patches; Reported by: soeren@HIDDEN; Keywords: patch; dated Wed, 31 Jul 2024 09:44:02 UTC; Maintainer for guix-patches is guix-patches@HIDDEN.

Message received at 72395 <at> debbugs.gnu.org:


Received: (at 72395) by debbugs.gnu.org; 3 Aug 2024 10:39:38 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Aug 03 06:39:38 2024
Received: from localhost ([127.0.0.1]:54109 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1saCAj-0000b7-Rl
	for submit <at> debbugs.gnu.org; Sat, 03 Aug 2024 06:39:38 -0400
Received: from magnesium.8pit.net ([45.76.88.171]:48981)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <soeren@HIDDEN>) id 1saCAh-0000ay-Cx
 for 72395 <at> debbugs.gnu.org; Sat, 03 Aug 2024 06:39:37 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=opensmtpd; bh=AEaPH6bF
 2QQsiIqILSYkg9tQVMaz7m1AsAQsT+f8414=;
 h=in-reply-to:references:from:
 subject:cc:to:date; d=soeren-tempel.net; b=q+zFQ21FYo8DpFcZwEXszW4GuUc
 N83bw7ifS/TL37S62gYaTUS5OI6UUTO7G4dRzt9QzpO/01y5ycFuZ0xHleL0cz3lLcUNwo
 Hn8oH8QA1XFILaY9RmpNN6O163gHC6HSnW23nMEZY13W9THYn+AfFoY96cdKlfREGJsnq3
 ZB+4=
Received: from localhost (dynamic-176-005-138-179.176.5.pool.telefonica.de
 [176.5.138.179])
 by magnesium.8pit.net (OpenSMTPD) with ESMTPSA id 08430758
 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:YES); 
 Sat, 3 Aug 2024 12:39:11 +0200 (CEST)
Date: Fri, 03 Aug 2024 12:38:36 +0200
To: Z572 <zhengjunjie@HIDDEN>
Subject: Re: [bug#72395] [PATCH] syscalls: Support musl libc in openpty and
 login-tty
From: =?UTF-8?Q?S=C3=B6ren?= Tempel <soeren@HIDDEN>
References: <ecdbe1915ce12e411816a7da2b59d48a6619630d.1722418917.git.soeren@HIDDEN>
 <87h6c4w7qm.fsf@HIDDEN>
In-Reply-To: <87h6c4w7qm.fsf@HIDDEN>
Message-Id: <2LJ9T2UGSZRU4.2KSFZPMA47XMM@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 72395
Cc: dev@HIDDEN, me@HIDDEN, zimon.toutoune@HIDDEN, othacehe@HIDDEN,
 ludo@HIDDEN, 72395 <at> debbugs.gnu.org, guix@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Hi!

Z572 <zhengjunjie@HIDDEN> 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=C3=A2=
=E2=82=AC=C2=A6" . #)
	In ice-9/boot-9.scm:
	  1747:15 16 (with-exception-handler #<procedure 7f8c8f9b2660 at ic=C3=A2=
=E2=82=AC=C2=A6> =C3=A2=E2=82=AC=C2=A6)
	  3474:28 15 (_)
	  3327:17 14 (resolve-interface (guix build syscalls) #:select _ # _ =C3=A2=
=E2=82=AC=C2=A6)
	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-=C3=A2=
=E2=82=AC=C2=A6>)
	  3564:26  8 (_)
	In unknown file:
		   7 (primitive-load-path "guix/build/syscalls" #<procedure =C3=A2=E2=82=AC=
=C2=A6>)
	In guix/build/syscalls.scm:
	  2385:14  6 (_)
	In ice-9/boot-9.scm:
	  1747:15  5 (with-exception-handler #<procedure 7f8c8fa3b270 at ic=C3=A2=
=E2=82=AC=C2=A6> =C3=A2=E2=82=AC=C2=A6)
	In guix/build/syscalls.scm:
	   456:39  4 (_)
	In ice-9/boot-9.scm:
	  1747:15  3 (with-exception-handler #<procedure 7f8c8fa3b240 at ic=C3=A2=
=E2=82=AC=C2=A6> =C3=A2=E2=82=AC=C2=A6)
	In unknown file:
		   2 (dynamic-link "libutil")
	In system/foreign-library.scm:
	   190:25  1 (load-foreign-library _ #:extensions _ # _ #:search-path =C3=A2=
=E2=82=AC=C2=A6)
	In unknown file:
		   0 (dlopen "libutil.so" 1)

	ERROR: In procedure dlopen:
	In procedure dlopen: file "libutil.so", message "libutil.so: cannot open s=
hared 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 repo=
sitory 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=C3=B6ren




Information forwarded to guix-patches@HIDDEN:
bug#72395; Package guix-patches. Full text available.

Message received at 72395 <at> debbugs.gnu.org:


Received: (at 72395) by debbugs.gnu.org; 1 Aug 2024 16:04:32 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Aug 01 12:04:32 2024
Received: from localhost ([127.0.0.1]:51861 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1sZYI4-0000bP-DV
	for submit <at> debbugs.gnu.org; Thu, 01 Aug 2024 12:04:32 -0400
Received: from smtp21.cstnet.cn ([159.226.251.21]:44984 helo=cstnet.cn)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <zhengjunjie@HIDDEN>) id 1sZYI1-0000az-BG
 for 72395 <at> debbugs.gnu.org; Thu, 01 Aug 2024 12:04:30 -0400
Received: from m (unknown [107.174.64.25])
 by APP-01 (Coremail) with SMTP id qwCowACHjEjasatm+r_UAg--.45400S2;
 Fri, 02 Aug 2024 00:03:55 +0800 (CST)
From: Z572 <zhengjunjie@HIDDEN>
To: soeren@HIDDEN
Subject: Re: [bug#72395] [PATCH] syscalls: Support musl libc in openpty and
 login-tty
In-Reply-To: <ecdbe1915ce12e411816a7da2b59d48a6619630d.1722418917.git.soeren@HIDDEN>
 (soeren@HIDDEN's message of "Wed, 31 Jul 2024 11:41:58 +0200")
References: <ecdbe1915ce12e411816a7da2b59d48a6619630d.1722418917.git.soeren@HIDDEN>
Date: Fri, 02 Aug 2024 00:03:29 +0800
Message-ID: <87h6c4w7qm.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/signed; boundary="=-=-=";
 micalg=pgp-sha512; protocol="application/pgp-signature"
X-CM-TRANSID: qwCowACHjEjasatm+r_UAg--.45400S2
X-Coremail-Antispam: 1UD129KBjvJXoWxXF1UGryUCr45ZFWkXrWfGrg_yoW5AryrpF
 1Y9ayDJw48Gr4xAa47Xr1fWryS9F4fXrn8Jw4xG348Zr98JFn5WrWayay3Gw13Gw4SkFW5
 Xr40vay5uFnrZ3DanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2
 9KBjDU0xBIdaVrnRJUUU9lb7Iv0xC_Kw4lb4IE77IF4wAFF20E14v26r4j6ryUM7CY07I2
 0VC2zVCF04k26cxKx2IYs7xG6rWj6s0DM7CIcVAFz4kK6r1j6r18M28lY4IEw2IIxxk0rw
 A2F7IY1VAKz4vEj48ve4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_JFI_Gr1l84ACjcxK6xII
 jxv20xvEc7CjxVAFwI0_Gr0_Cr1l84ACjcxK6I8E87Iv67AKxVWUJVW8JwA2z4x0Y4vEx4
 A2jsIEc7CjxVAFwI0_Jr0_Gr1lnx0Ee4C267I2x7xF54xIwI0E7I0Y6sxI4wAS0I0E0xvY
 zxvE52x082IY62kv0487M2AExVA0xI801c8C04v7Mc02F40EFcxC0VAKzVAqx4xG6I80ew
 Av7VC0I7IYx2IY67AKxVWUAVWUtwAv7VC2z280aVAFwI0_Jr0_Gr1lOx8S6xCaFVCjc4AY
 6r1j6r4UM4x0Y48IcVAKI48JMxkF7I0En4kS14v26r126r1DMxAIw28IcxkI7VAKI48JMx
 C20s026xCaFVCjc4AY6r1j6r4UMI8I3I0E5I8CrVAFwI0_Jr0_Jr4lx2IqxVCjr7xvwVAF
 wI0_JrI_JrWlx4CE17CEb7AF67AKxVWUtVW8ZwCIc40Y0x0EwIxGrwCI42IY6xIIjxv20x
 vE14v26r1I6r4UMIIF0xvE2Ix0cI8IcVCY1x0267AKxVW8JVWxJwCI42IY6xAIw20EY4v2
 0xvaj40_Jr0_JF4lIxAIcVC2z280aVAFwI0_Jr0_Gr1lIxAIcVC2z280aVCY1x0267AKxV
 WUJVW8JbIYCTnIWIevJa73UjIFyTuYvjxUhksgUUUUU
X-Originating-IP: [107.174.64.25]
X-CM-SenderInfo: x2kh0wxmxqyx3h6l2u1dvotugofq/
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 72395
Cc: dev@HIDDEN, me@HIDDEN, zimon.toutoune@HIDDEN, othacehe@HIDDEN,
 ludo@HIDDEN, 72395 <at> debbugs.gnu.org, guix@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

--=-=-=
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

soeren@HIDDEN writes:

> From: S=C3=B6ren Tempel <soeren@HIDDEN>
>
> Contrary to glibc, musl does not define the openpty and login-tty
> function in libutil.so. In fact, libutil.so does not exist on musl-based
> Linux distributions.  Therefore, on musl-based systems we don't have
> to pass any #:library keyword argument to syscall->procedure.
> ---
>  guix/build/syscalls.scm | 12 ++++++++----
>  1 file changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/guix/build/syscalls.scm b/guix/build/syscalls.scm
> index 39bcffd516..b92b6955a4 100644
> --- a/guix/build/syscalls.scm
> +++ b/guix/build/syscalls.scm
> @@ -2382,8 +2382,10 @@ (define terminal-string-width
>          string-length)))                      ;using a statically-linked=
 Guile
>=20=20
>  (define openpty
> -  (let ((proc (syscall->procedure int "openpty" '(* * * * *)
> -                                  #:library "libutil")))
> +  (let ((proc (if musl-libc?
> +                (syscall->procedure int "openpty" '(* * * * *)
> +                                    #:library "libutil")
> +                (syscall->procedure int "openpty" '(* * * * *)))))
>      (lambda ()
>        "Return two file descriptors: one for the pseudo-terminal control =
side,
>  and one for the controlled side."
> @@ -2404,8 +2406,10 @@ (define openpty
>            (values (* head) (* inferior)))))))
>=20=20
>  (define login-tty
> -  (let* ((proc (syscall->procedure int "login_tty" (list int)
> -                                   #:library "libutil")))
> +  (let* ((proc (if musl-libc?
> +                 (syscall->procedure int "login_tty" (list int)
> +                                     #:library "libutil")
> +                 (syscall->procedure int "login_tty" (list int)))))
>      (lambda (fd)
>        "Make FD the controlling terminal of the current process (with the
>  TIOCSCTTY ioctl), redirect standard input, standard output and standard =
error
>
> base-commit: 01d4363168ed10ea223047f7a7b83201f161ec0b

see syscall->procedure definition:

```
(define* (syscall->procedure return-type name argument-types
                             #:key library)
  "Return a procedure that wraps the C function NAME using the dynamic FFI,
and that returns two values: NAME's return value, and errno.  When LIBRARY =
is
specified, look up NAME in that library rather than in the global symbol na=
me
space.

If an error occurs while creating the binding, defer the error report until
the returned procedure is called."
  (catch #t
    (lambda ()
      ;; Note: When #:library is set, try it first and fall back to libc
      ;; proper.  This is because libraries like libutil.so have been subsu=
med
      ;; by libc.so with glibc >=3D 2.34.
      (let ((ptr (dynamic-func name
                               (if library
                                   (or (false-if-exception
                                        (dynamic-link library))
                                       (dynamic-link))
                                   (dynamic-link)))))
        ;; The #:return-errno? facility was introduced in Guile 2.0.12.
        (pointer->procedure return-type ptr argument-types
                            #:return-errno? #t)))
    (lambda args
      (lambda _
        (throw 'system-error name  "~A" (list (strerror ENOSYS))
               (list ENOSYS))))))
```

In my understanding, when we can't find libutil, will try to find it in
libc. Do you have any problems using it?

--=-=-=
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEEfr6klGDOXiwIdX/bO1qpk+Gi3/AFAmarsdEACgkQO1qpk+Gi
3/CvHRAAoJgg6EQZg5bWbEgoMwm9Kk5pQX9AAlvNtDlrtr81SpzrLtdH6M8RNGdG
PluLjMHApbMVrBXowHS7aUdEc4yP+cX1J4Zo+90YxxrJigmCE+YWFS3fbTJxSBJ9
ZSfa6aPHSH8YcgcrUnHJEDhyOr/FRuArOq2NYZtVOz2jV2z/VEdWdM6HQ/2tiGPh
pRceK0IDS25Q6VqgzLHZtnLaNpVrzwciU1m4CHfAZs+aUsVT/IvxTJUlrbW23Jzz
SU0J1dr+Nltxw6r6Ogx3nu592bP8PHCpDPOJSnoGhWqOU3vAhDJ7MlBb9K4xsT4w
MHNxiQDWXOsl72LbhjHdu/2p/7f8w/lG9Q4KrL9o1STP2/smR2cn+cYgACUKua4e
M5Qgq/9vJNUPEFmckP6Y60NNIm2FODn93F+Ovs5DhZHWuz3sy3htM1yMPm5JU5sy
MBrBml18qkvoIfqOPQRb5tZKuU2Oo8Rgvt65QbobX9IX+zgEMcMsT4/TKsJ+q+W5
54rp94JaD8SdWTqCVIq4IXfvIuh29IaVv1qXXTxpAabXUD5xRaiDjLlZvBY0TM6E
TfxH5+Xd5pB6vDcnV7COfpe7UWZIVeBgwKWW/2jGP/Mgk7z74pwksIh5afBfqW9m
MfzPsQGHVCk8I4SdkwmrquU06uzEKf9Xh12zxgfXr3C5ZueZ//k=
=ySI7
-----END PGP SIGNATURE-----
--=-=-=--





Information forwarded to guix-patches@HIDDEN:
bug#72395; Package guix-patches. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 31 Jul 2024 09:43:39 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Jul 31 05:43:39 2024
Received: from localhost ([127.0.0.1]:49193 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1sZ5rv-0002ni-Ex
	for submit <at> debbugs.gnu.org; Wed, 31 Jul 2024 05:43:39 -0400
Received: from lists.gnu.org ([209.51.188.17]:42392)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <soeren@HIDDEN>) id 1sZ5rt-0002na-Fk
 for submit <at> debbugs.gnu.org; Wed, 31 Jul 2024 05:43:38 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <soeren@HIDDEN>)
 id 1sZ5rc-0004Po-Uv
 for guix-patches@HIDDEN; Wed, 31 Jul 2024 05:43:21 -0400
Received: from magnesium.8pit.net ([45.76.88.171])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <soeren@HIDDEN>)
 id 1sZ5ra-00068o-CN; Wed, 31 Jul 2024 05:43:20 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=opensmtpd; bh=So7R5nKH
 idEJp6BgWBDPZDoSYhh9fabrUwa606vLPOQ=; h=date:subject:to:from; 
 d=soeren-tempel.net;
 b=UL47aNt44wgOYlgCl9jooPz6LAe93i2RHiveDCycNL25hUr
 9TVbGEWETrRMpJBL2fT/UYJd4dPdCC9Eam3+rrbL/8LWvx76iZx4fJbXJEgElXtqAEt10k
 eMNgmwoI0xo8f2W32qthQ1oxsK4WeJ0dCx1tJuEHYMjnvtD86wo53A=
Received: from localhost (dynamic-176-005-136-001.176.5.pool.telefonica.de
 [176.5.136.1])
 by magnesium.8pit.net (OpenSMTPD) with ESMTPSA id d1828c5f
 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:YES); 
 Wed, 31 Jul 2024 11:43:14 +0200 (CEST)
From: soeren@HIDDEN
To: guix-patches@HIDDEN
Subject: [PATCH] syscalls: Support musl libc in openpty and login-tty
Date: Wed, 31 Jul 2024 11:41:58 +0200
Message-ID: <ecdbe1915ce12e411816a7da2b59d48a6619630d.1722418917.git.soeren@HIDDEN>
X-Mailer: git-send-email 2.45.2
MIME-Version: 1.0
X-Debbugs-Cc: guix@HIDDEN, dev@HIDDEN, ludo@HIDDEN, othacehe@HIDDEN,
 zimon.toutoune@HIDDEN, me@HIDDEN
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Received-SPF: pass client-ip=45.76.88.171;
 envelope-from=soeren@HIDDEN; helo=magnesium.8pit.net
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.4 (-)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.4 (--)

From: Sören Tempel <soeren@HIDDEN>

Contrary to glibc, musl does not define the openpty and login-tty
function in libutil.so. In fact, libutil.so does not exist on musl-based
Linux distributions.  Therefore, on musl-based systems we don't have
to pass any #:library keyword argument to syscall->procedure.
---
 guix/build/syscalls.scm | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/guix/build/syscalls.scm b/guix/build/syscalls.scm
index 39bcffd516..b92b6955a4 100644
--- a/guix/build/syscalls.scm
+++ b/guix/build/syscalls.scm
@@ -2382,8 +2382,10 @@ (define terminal-string-width
         string-length)))                      ;using a statically-linked Guile
 
 (define openpty
-  (let ((proc (syscall->procedure int "openpty" '(* * * * *)
-                                  #:library "libutil")))
+  (let ((proc (if musl-libc?
+                (syscall->procedure int "openpty" '(* * * * *)
+                                    #:library "libutil")
+                (syscall->procedure int "openpty" '(* * * * *)))))
     (lambda ()
       "Return two file descriptors: one for the pseudo-terminal control side,
 and one for the controlled side."
@@ -2404,8 +2406,10 @@ (define openpty
           (values (* head) (* inferior)))))))
 
 (define login-tty
-  (let* ((proc (syscall->procedure int "login_tty" (list int)
-                                   #:library "libutil")))
+  (let* ((proc (if musl-libc?
+                 (syscall->procedure int "login_tty" (list int)
+                                     #:library "libutil")
+                 (syscall->procedure int "login_tty" (list int)))))
     (lambda (fd)
       "Make FD the controlling terminal of the current process (with the
 TIOCSCTTY ioctl), redirect standard input, standard output and standard error

base-commit: 01d4363168ed10ea223047f7a7b83201f161ec0b




Acknowledgement sent to soeren@HIDDEN:
New bug report received and forwarded. Copy sent to guix@HIDDEN, dev@HIDDEN, ludo@HIDDEN, othacehe@HIDDEN, zimon.toutoune@HIDDEN, me@HIDDEN, guix-patches@HIDDEN. Full text available.
Report forwarded to guix@HIDDEN, dev@HIDDEN, ludo@HIDDEN, othacehe@HIDDEN, zimon.toutoune@HIDDEN, me@HIDDEN, guix-patches@HIDDEN:
bug#72395; Package guix-patches. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Sun, 12 Jan 2025 05:45:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.