Received: (at 65486) by debbugs.gnu.org; 17 Sep 2023 15:22:22 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sun Sep 17 11:22:22 2023 Received: from localhost ([127.0.0.1]:51173 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1qhtbK-0000f7-FC for submit <at> debbugs.gnu.org; Sun, 17 Sep 2023 11:22:22 -0400 Received: from magnesium.8pit.net ([45.76.88.171]:22415) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <soeren@HIDDEN>) id 1qhtbD-0000eA-P5; Sun, 17 Sep 2023 11:22:17 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; s=opensmtpd; bh=fp6dfzRq/g DQwuotX9I6Gg0Qbx07ZXvPoJC7op9GSNY=; h=references:in-reply-to:date: subject:cc:to:from; d=soeren-tempel.net; b=eRt7HdBoTKhChsmVgUrkYG2FLCx fo5r0JrT79aSqzMf5a9StKHP27qENvNcmOpy+CM+A4ZE5784/vx/soNhWKOmboDlMsHTsq Y/61IGX2Odk+LEu5bOTzFlTj1N2zYZY6/sj7fx3p0L3sdX+dsR01iIE1GmnwRsDGWxfc/K /Nog= Received: from localhost (ip-078-094-021-002.um19.pools.vodafone-ip.de [78.94.21.2]) by magnesium.8pit.net (OpenSMTPD) with ESMTPSA id 64276c78 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:YES); Sun, 17 Sep 2023 17:21:56 +0200 (CEST) From: soeren@HIDDEN To: guix-patches@HIDDEN Subject: [PATCH v3] syscalls: Add support for musl libc Date: Sun, 17 Sep 2023 17:21:49 +0200 Message-ID: <20230917152149.8587-2-soeren@HIDDEN> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20230917152149.8587-1-soeren@HIDDEN> References: <87il89yugy.fsf@HIDDEN> <20230917152149.8587-1-soeren@HIDDEN> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 65486 Cc: 65486 <at> debbugs.gnu.org, ludo@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 (-) From: Sören Tempel <soeren@HIDDEN> This commit allows using Guix on a foreign distro which uses musl libc, for example, Alpine Linux. Usage of musl libc is detected via a new musl-libc? variable using the Guile %host-type. Using the new musl-libc? variable, we can now implement musl-specific quirks. The two compatibility problems I encountered in this regard are that musl dose not export a readdir64 and statfs64 symbol. On musl, these two functions are implemented as CPP macros that expand to readdir/statfs. To workaround that, a case-distinction was added. The existing linux? variable has been modified to return true if the %host-system contains "linux-" in order to ensure it is true for both linux-gnu as well as linux-musl host systems. The patch has been tested on Alpine Linux and is already used for the downstream Guix package shipped in Alpine Linux's package repository. * guix/build/syscalls.scm (musl-libc?): New variable. * guix/build/syscalls.scm (linux?): Truth value on any linux system. * guix/build/syscalls.scm (readdir-procedure): Support musl libc. * guix/build/syscalls.scm (statfs): Support musl libc. Signed-off-by: Sören Tempel <soeren@HIDDEN> --- guix/build/syscalls.scm | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/guix/build/syscalls.scm b/guix/build/syscalls.scm index c9c0bf594d..b845b8aab9 100644 --- a/guix/build/syscalls.scm +++ b/guix/build/syscalls.scm @@ -836,7 +836,8 @@ (define-record-type <file-system> (define-syntax fsword ;fsword_t (identifier-syntax long)) -(define linux? (string-contains %host-type "linux-gnu")) +(define musl-libc? (string-contains %host-type "linux-musl")) +(define linux? (string-contains %host-type "linux-")) (define-syntax define-statfs-flags (syntax-rules (linux hurd) @@ -905,7 +906,7 @@ (define-c-struct %statfs ;<bits/statfs.h> (spare (array fsword 4))) (define statfs - (let ((proc (syscall->procedure int "statfs64" '(* *)))) + (let ((proc (syscall->procedure int (if musl-libc? "statfs" "statfs64") '(* *)))) (lambda (file) "Return a <file-system> data structure describing the file system mounted at FILE." @@ -1232,7 +1233,7 @@ (define closedir* (define (readdir-procedure name-field-offset sizeof-dirent-header read-dirent-header) - (let ((proc (syscall->procedure '* "readdir64" '(*)))) + (let ((proc (syscall->procedure '* (if musl-libc? "readdir" "readdir64") '(*)))) (lambda* (directory #:optional (pointer->string pointer->string/utf-8)) (let ((ptr (proc directory))) (and (not (null-pointer? ptr))
guix-patches@HIDDEN
:bug#65486
; Package guix-patches
.
Full text available.Received: (at 65486) by debbugs.gnu.org; 17 Sep 2023 15:22:18 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sun Sep 17 11:22:18 2023 Received: from localhost ([127.0.0.1]:51169 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1qhtbE-0000eZ-T5 for submit <at> debbugs.gnu.org; Sun, 17 Sep 2023 11:22:18 -0400 Received: from magnesium.8pit.net ([45.76.88.171]:22415) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <soeren@HIDDEN>) id 1qhtb2-0000eA-Uw; Sun, 17 Sep 2023 11:22:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; s=opensmtpd; bh=piq3HuAmYz 0ZSublWNYw+q7hZm+yVf96UF/kswA9A+k=; h=references:in-reply-to:date: subject:cc:to:from; d=soeren-tempel.net; b=s2rWW3nt/RYYNP79ayt2oR/gcWQ erD6Nx5MlmSKJRQoYfygbnQ2tTDccZLTlPT0xtn41KaITl9Mp4h5LP3GQ5UzT9lwUMgP5y 3t+25fe3ZvajH9orhA6V5q4RrmvPv64E/OfZeMUsi/YbTShVI5zSAu3nJWHRQ8RwSmclJE D6Gs= Received: from localhost (ip-078-094-021-002.um19.pools.vodafone-ip.de [78.94.21.2]) by magnesium.8pit.net (OpenSMTPD) with ESMTPSA id 25f1bbec (TLSv1.3:TLS_AES_256_GCM_SHA384:256:YES); Sun, 17 Sep 2023 17:21:55 +0200 (CEST) From: soeren@HIDDEN To: guix-patches@HIDDEN Subject: [PATCH v3] syscalls: Consistently use existing linux? definition Date: Sun, 17 Sep 2023 17:21:48 +0200 Message-ID: <20230917152149.8587-1-soeren@HIDDEN> X-Mailer: git-send-email 2.42.0 In-Reply-To: <87il89yugy.fsf@HIDDEN> References: <87il89yugy.fsf@HIDDEN> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 65486 Cc: 65486 <at> debbugs.gnu.org, ludo@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 (-) From: Sören Tempel <soeren@HIDDEN> Instead of duplicating this existing logic across the source file. This will make it easier to add additional linux targets (e.g. linux-musl) in the future. * guix/build/syscalls.scm (readdir*): Use linux? constant. * guix/build/syscalls.scm (write-socket-address!): Use linux? constant. * guix/build/syscalls.scm (read-socket-address): Use linux? constant. Signed-off-by: Sören Tempel <soeren@HIDDEN> --- guix/build/syscalls.scm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/guix/build/syscalls.scm b/guix/build/syscalls.scm index d947b010d3..c9c0bf594d 100644 --- a/guix/build/syscalls.scm +++ b/guix/build/syscalls.scm @@ -1244,7 +1244,7 @@ (define (readdir-procedure name-field-offset sizeof-dirent-header (define readdir* ;; Decide at run time which one must be used. - (if (string-contains %host-type "linux-gnu") + (if linux? (readdir-procedure (c-struct-field-offset %struct-dirent-header/linux name) sizeof-dirent-header/linux @@ -1664,7 +1664,7 @@ (define (write-socket-address!/hurd sockaddr bv index) (error "unsupported socket address" sockaddr))))) (define write-socket-address! - (if (string-contains %host-type "linux-gnu") + (if linux? write-socket-address!/linux write-socket-address!/hurd)) @@ -1696,7 +1696,7 @@ (define* (read-socket-address/hurd bv #:optional (index 0)) (vector family))))) (define read-socket-address - (if (string-contains %host-type "linux-gnu") + (if linux? read-socket-address/linux read-socket-address/hurd))
guix-patches@HIDDEN
:bug#65486
; Package guix-patches
.
Full text available.Received: (at 65486) by debbugs.gnu.org; 17 Sep 2023 11:40:36 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sun Sep 17 07:40:36 2023 Received: from localhost ([127.0.0.1]:49243 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1qhq8h-0005iL-M6 for submit <at> debbugs.gnu.org; Sun, 17 Sep 2023 07:40:35 -0400 Received: from mira.cbaines.net ([2a01:7e00:e000:2f8:fd4d:b5c7:13fb:3d27]:58847) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <mail@HIDDEN>) id 1qhq8c-0005i5-Tc for 65486 <at> debbugs.gnu.org; Sun, 17 Sep 2023 07:40:34 -0400 Received: from localhost (unknown [217.155.61.229]) by mira.cbaines.net (Postfix) with ESMTPSA id A3F6F27BBE2; Sun, 17 Sep 2023 12:40:20 +0100 (BST) Received: from felis (localhost [127.0.0.1]) by localhost (OpenSMTPD) with ESMTP id 164b9081; Sun, 17 Sep 2023 11:40:19 +0000 (UTC) References: <20230824063303.7928-3-soeren@HIDDEN> <20230909130548.31083-2-soeren@HIDDEN> <87fs3kquwl.fsf_-_@HIDDEN> <3DOVAMAK0VD13.2XDJ9MT35902D@HIDDEN> <87cyylkdt5.fsf@HIDDEN> <3V5VFSTNLLLHJ.3BBPH8V2N2EUI@HIDDEN> <87il89yugy.fsf@HIDDEN> User-agent: mu4e 1.10.5; emacs 28.2 From: Christopher Baines <mail@HIDDEN> To: Ludovic =?utf-8?Q?Court=C3=A8s?= <ludo@HIDDEN> Subject: Re: bug#65486: [PATCH] syscalls: Add support for musl libc Date: Sun, 17 Sep 2023 12:38:19 +0100 In-reply-to: <87il89yugy.fsf@HIDDEN> Message-ID: <87v8c9owny.fsf@HIDDEN> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 65486 Cc: 65486 <at> debbugs.gnu.org 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 (-) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Ludovic Court=C3=A8s <ludo@HIDDEN> writes: > So we need bordeaux.guix to build everything ahead of time. > > To do that, can you resend both syscalls.scm patch (with =E2=80=98git > send-email=E2=80=99) here? Then we=E2=80=99ll check qa.guix to ensure it= builds things. > > Chris, how does that sound? This probably falls under the core team (although ./etc/teams.scm says it doesn't fall under any team), so I'd suggest putting it on a branch. That way, we can collect some other similar changes together before merging. --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQKlBAEBCgCPFiEEPonu50WOcg2XVOCyXiijOwuE9XcFAmUG5aFfFIAAAAAALgAo aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDNF ODlFRUU3NDU4RTcyMEQ5NzU0RTBCMjVFMjhBMzNCMEI4NEY1NzcRHG1haWxAY2Jh aW5lcy5uZXQACgkQXiijOwuE9XdmWA//SWzVcCUO2Rku5GSVYDBynEfFM/X0q4uv 59eu8/urJBIlGFFC/OjzNq5Bst5VIyn7R1PvbH16XDIEee9DNJWPZu9vxKCgisoN F2+fOFnHnRMkWgBOn+/MHHq8It3reyzAVw4euXx9qiORsH5821/tN6YhO+IHifIs ZRTjXfpslDdCOXW/9yDqJHBhIp2ONign0dW/GLA9nT55nD9kv7TVQHofjVebqmFq 2wvdtVL0LJ0mNMr5BnxFQaoE5EhPYutepP1ESjl5wF31HzBqdhiSSmF5AUfE0Op0 6BqS2Pa6tZe+L1ueFmw/QIWAgdqDgtXLHQ6n7pvyJaWQPD/DgAmPxeFScXHrHlbd SvoD/E9yVkATPBUU9423fN7UgF/yC6hmmfHX+jVhmsvCcDEzt0+ObsHM8nGr6U6e ENukix0901sT78Ni/pSuM37ebR0rdpY6c9JDC4Wfo+aQ99dVq2kOzdkNmhcOOkBs LTsgE1CXLhGJ6uSLxc/NdoKsHEETB0WpdOKQehHfmlyWtljrQ8Q9hBCvLMNVKYD6 4zxssA1PNH1CKC7oKfB3Dclziir2nXPM5K0hpYOZXMJEguNU4JvmdaAkdUZ0C9SH B5ZGoFdsm9AU0VklMIVJJc5j12mSRMCxyvoEDuewLIl1eSay0GNZSgOLKfvgnbNW LttvMMjXOOI= =OFyc -----END PGP SIGNATURE----- --=-=-=--
guix-patches@HIDDEN
:bug#65486
; Package guix-patches
.
Full text available.Ludovic Courtès <ludo@HIDDEN>
to control <at> debbugs.gnu.org
.
Full text available.Debbugs Internal Request <help-debbugs@HIDDEN>
to internal_control <at> debbugs.gnu.org
.
Full text available.Received: (at 65486) by debbugs.gnu.org; 17 Sep 2023 10:17:49 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sun Sep 17 06:17:49 2023 Received: from localhost ([127.0.0.1]:49129 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1qhoqb-0003gj-JA for submit <at> debbugs.gnu.org; Sun, 17 Sep 2023 06:17:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41294) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <ludo@HIDDEN>) id 1qhoqa-0003gX-Hf for 65486 <at> debbugs.gnu.org; Sun, 17 Sep 2023 06:17:49 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <ludo@HIDDEN>) id 1qhoqN-0005QD-Ky; Sun, 17 Sep 2023 06:17:35 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To: From; bh=SzsJjHYnH71B1HT2u17psELGAquwT5n5HPK/XA7blWU=; b=ie9CDyh9S8IUSpHHLD10 NFiHN1TDWAZbO0M3qBBy04IOmA6pXgQrV9zm9yR2E/58ivpgS1AkvR+ouCMOOlgO6uBcEn7VtXqqY H6zZU5lsATr3IreB1yxINgFmTGirrONbjuGOOZRtS4FojvMFfBynBjekhuqtUHH2RZNRPk9FIFwoP /PSRWbQbgKo2hx/K6+1pj8ziCV6HnyzopXwvWS0byCoVRYvqImgDhuyI4hrRpbLgNMV/BbnSFSrvV rPLOjcut9+v8EOvATMFP4p4B0Tlj/ADp5MrGpJq9U0TK4STpoYBVFE2PLGsBYnjmv8jYpnWc/LFZs 6L61Mlp/ponHxw==; From: =?utf-8?Q?Ludovic_Court=C3=A8s?= <ludo@HIDDEN> To: =?utf-8?Q?S=C3=B6ren?= Tempel <soeren@HIDDEN> Subject: Re: bug#65486: [PATCH] syscalls: Add support for musl libc References: <20230824063303.7928-3-soeren@HIDDEN> <20230909130548.31083-2-soeren@HIDDEN> <87fs3kquwl.fsf_-_@HIDDEN> <3DOVAMAK0VD13.2XDJ9MT35902D@HIDDEN> <87cyylkdt5.fsf@HIDDEN> <3V5VFSTNLLLHJ.3BBPH8V2N2EUI@HIDDEN> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: Primidi 1 jour =?utf-8?Q?compl=C3=A9mentaire?= an 231 de la =?utf-8?Q?R=C3=A9volution=2C?= jour de la Vertu X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu Date: Sun, 17 Sep 2023 12:17:33 +0200 In-Reply-To: <3V5VFSTNLLLHJ.3BBPH8V2N2EUI@HIDDEN> (=?utf-8?Q?=22S=C3=B6r?= =?utf-8?Q?en?= Tempel"'s message of "Fri, 15 Sep 2023 12:57:29 +0200") Message-ID: <87il89yugy.fsf@HIDDEN> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 65486 Cc: 65486 <at> debbugs.gnu.org, Christopher Baines <mail@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 (---) Oooh, now I remember why I ended up not applying the previous syscalls.scm patch: OpenJDK and a bunch of other things depend on it, so changing syscalls.scm entails lots of rebuilds. (Really, they shouldn=E2= =80=99t depend on it in the first place, IMO.) So we need bordeaux.guix to build everything ahead of time. To do that, can you resend both syscalls.scm patch (with =E2=80=98git send-email=E2=80=99) here? Then we=E2=80=99ll check qa.guix to ensure it b= uilds things. Chris, how does that sound? Ludo=E2=80=99.
guix-patches@HIDDEN
:bug#65486
; Package guix-patches
.
Full text available.Received: (at 65486-done) by debbugs.gnu.org; 17 Sep 2023 10:14:24 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sun Sep 17 06:14:23 2023 Received: from localhost ([127.0.0.1]:49117 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1qhonH-0003av-Ix for submit <at> debbugs.gnu.org; Sun, 17 Sep 2023 06:14:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54294) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <ludo@HIDDEN>) id 1qhonF-0003ai-56 for 65486-done <at> debbugs.gnu.org; Sun, 17 Sep 2023 06:14:22 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <ludo@HIDDEN>) id 1qhon1-0004v3-CY; Sun, 17 Sep 2023 06:14:07 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To: From; bh=ULcANklD/UzTQSr7d+fuCcTHFzxd9T9bqib8LlJk6xY=; b=BAmq9rwPWa5Y4x69w1tH WHbAfQm+8FJpyNafCqDVXyieUAcFkoBAIipqguLT2BJx3ntmPr2Zu/zBV/B33V6AIcVv2vcIARo7f NcC+kLHi0dUShTvL8NXydo1ecdKNYj7JLGW0S7yNQ3E/Nf0Opjz1pOQhd8KJJLQamoid4w0YQspkP jSn6dAnBVdxUOtfDc/lCFTQ784wwB64iGiE1/A59OC/gIp5AAYd7OUTUgGlg7F06f3MnHDSkZe04Z TyDgrjEb+3NXRXNiGG6rZWtsHWg0OMcopGTjabdJOw/qMka7h6cEyL+Y5iNnhr9ioW/w71Fvue6Ib tXpw90owvSoXKQ==; From: =?utf-8?Q?Ludovic_Court=C3=A8s?= <ludo@HIDDEN> To: =?utf-8?Q?S=C3=B6ren?= Tempel <soeren@HIDDEN> Subject: Re: bug#65486: [PATCH] syscalls: Add support for musl libc References: <20230824063303.7928-3-soeren@HIDDEN> <20230909130548.31083-2-soeren@HIDDEN> <87fs3kquwl.fsf_-_@HIDDEN> <3DOVAMAK0VD13.2XDJ9MT35902D@HIDDEN> <87cyylkdt5.fsf@HIDDEN> <3V5VFSTNLLLHJ.3BBPH8V2N2EUI@HIDDEN> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: Primidi 1 jour =?utf-8?Q?compl=C3=A9mentaire?= an 231 de la =?utf-8?Q?R=C3=A9volution=2C?= jour de la Vertu X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu Date: Sun, 17 Sep 2023 12:14:05 +0200 In-Reply-To: <3V5VFSTNLLLHJ.3BBPH8V2N2EUI@HIDDEN> (=?utf-8?Q?=22S=C3=B6r?= =?utf-8?Q?en?= Tempel"'s message of "Fri, 15 Sep 2023 12:57:29 +0200") Message-ID: <87o7i1yumq.fsf@HIDDEN> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 65486-done Cc: 65486-done <at> debbugs.gnu.org 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 (---) Hi, S=C3=B6ren Tempel <soeren@HIDDEN> skribis: > From b1d478defc7f3e794974be2b9665cd4a58030569 Mon Sep 17 00:00:00 2001 > From: =3D?UTF-8?q?S=3DC3=3DB6ren=3D20Tempel?=3D <soeren+git@soeren-tempel= .net> > Date: Thu, 14 Sep 2023 12:35:38 +0000 > Subject: [PATCH] syscalls: Add support for musl libc > > This commit allows using Guix on a foreign distro which uses musl libc, > for example, Alpine Linux. Usage of musl libc is detected via a new > musl-libc? variable using the Guile %host-type. > > Using the new musl-libc? variable, we can now implement musl-specific > quirks. The two compatibility problems I encountered in this regard are > that musl dose not export a readdir64 and statfs64 symbol. On musl, > these two functions are implemented as CPP macros that expand to > readdir/statfs. To workaround that, a case-distinction was added. > > The existing linux? variable has been modified to return true if the > %host-system contains "linux-" in order to ensure it is true for both > linux-gnu as well as linux-musl host systems. > > The patch has been tested on Alpine Linux and is already used for the > downstream Guix package shipped in Alpine Linux's package repository. > > * guix/build/syscalls.scm (musl-libc?): New variable. > * guix/build/syscalls.scm (linux?): Truth value on any linux system. > * guix/build/syscalls.scm (readdir-procedure): Support musl libc. > * guix/build/syscalls.scm (statfs): Support musl libc. This version LGTM. Applied, thanks! Ludo=E2=80=99.
soeren@HIDDEN
:Ludovic Courtès <ludo@HIDDEN>
:Received: (at 65486) by debbugs.gnu.org; 15 Sep 2023 10:57:47 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Fri Sep 15 06:57:47 2023 Received: from localhost ([127.0.0.1]:42241 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1qh6WB-0004VF-7b for submit <at> debbugs.gnu.org; Fri, 15 Sep 2023 06:57:47 -0400 Received: from magnesium.8pit.net ([45.76.88.171]:24337) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <soeren@HIDDEN>) id 1qh6W8-0004V3-E9 for 65486 <at> debbugs.gnu.org; Fri, 15 Sep 2023 06:57:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; s=opensmtpd; bh=/k1F3e2979 uofnMFoW8fNmXr0Fq1YFLseHixwvDlunA=; h=in-reply-to:references:from: subject:cc:to:date; d=soeren-tempel.net; b=qBcox/3jN621/2zGgMeEvjmTZM5 EG7VaahJhHNC56KPfcRh10OHsKY/x9xrJyh2i0cyToLhQ+fnqG49xb30dB2AegpvlKjYEE TzOQ2HwcoLtRdq2M4gys/bWFokOO/2TstdEm+p2u/IdPjeCOgOi/aXv1sBGWUAq8wyPFT/ r3dU= Received: from localhost (dynamic-002-247-251-213.2.247.pool.telefonica.de [2.247.251.213]) by magnesium.8pit.net (OpenSMTPD) with ESMTPSA id 139f614c (TLSv1.3:TLS_AES_256_GCM_SHA384:256:YES); Fri, 15 Sep 2023 12:57:35 +0200 (CEST) Date: Fri, 15 Sep 2023 12:57:29 +0200 To: Ludovic =?UTF-8?Q?Court=C3=A8s?= <ludo@HIDDEN> Subject: Re: bug#65486: [PATCH] syscalls: Add support for musl libc From: =?UTF-8?Q?S=C3=B6ren?= Tempel <soeren@HIDDEN> References: <20230824063303.7928-3-soeren@HIDDEN> <20230909130548.31083-2-soeren@HIDDEN> <87fs3kquwl.fsf_-_@HIDDEN> <3DOVAMAK0VD13.2XDJ9MT35902D@HIDDEN> <87cyylkdt5.fsf@HIDDEN> In-Reply-To: <87cyylkdt5.fsf@HIDDEN> Message-Id: <3V5VFSTNLLLHJ.3BBPH8V2N2EUI@HIDDEN> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----_=_58a1976d5c5e54cf7f90ab59_=_" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 65486 Cc: 65486 <at> debbugs.gnu.org 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 (-) This is a multipart message in MIME format. ------_=_58a1976d5c5e54cf7f90ab59_=_ Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi Ludovic, Ludovic Court=C3=A8s <ludo@HIDDEN> wrote: > You could call it =E2=80=98musl?=E2=80=99 instead, to (hopefully) convey = we=E2=80=99re > interested in the C library specifically. I used musl-libc? instead to make it more clear that we are interested in the C library for this case-distinction. This is implemented in the attached git-format-patch(1). Would that be suitable for inclusion in Guix? > No no, I meant something like: >=20 > (or (false-if-exception (dynamic-func "readdir64" (dynamic-link))) > (dynamic-func "readdir" (dynamic-link))) >=20 > Of course, it=E2=80=99s not as simple as this because we=E2=80=99d rather= have it > integrated with =E2=80=98syscall->procedure=E2=80=99 (maybe by adding an > #:alternative-name argument for the Musl name?), but you get the idea. Also this check doesn't ensure struct layout compatibility, e.g. if readdir uses 32-bit types so not sure if this is necessarily better than the musl libc check I proposed above. Let me know what you think. Greetings S=C3=B6ren ------_=_58a1976d5c5e54cf7f90ab59_=_ Content-Disposition: attachment; filename*0*=UTF-8''0002-syscalls-Add-support-for-musl-libc.patch Content-Type: text/plain Content-Transfer-Encoding: quoted-printable =46rom b1d478defc7f3e794974be2b9665cd4a58030569 Mon Sep 17 00:00:00 2001 =46rom: =3D?UTF-8?q?S=3DC3=3DB6ren=3D20Tempel?=3D <soeren+git@soeren-tempel= =2Enet> =44ate: Thu, 14 Sep 2023 12:35:38 +0000 =53ubject: [PATCH] syscalls: Add support for musl libc =0AThis commit allows using Guix on a foreign distro which uses musl libc, =66or example, Alpine Linux. Usage of musl libc is detected via a new =6Dusl-libc? variable using the Guile %host-type. =0AUsing the new musl-libc? variable, we can now implement musl-specific =71uirks. The two compatibility problems I encountered in this regard are =74hat musl dose not export a readdir64 and statfs64 symbol. On musl, =74hese two functions are implemented as CPP macros that expand to =72eaddir/statfs. To workaround that, a case-distinction was added. =0AThe existing linux? variable has been modified to return true if the =25host-system contains "linux-" in order to ensure it is true for both =6Cinux-gnu as well as linux-musl host systems. =0AThe patch has been tested on Alpine Linux and is already used for the =64ownstream Guix package shipped in Alpine Linux's package repository. =0A* guix/build/syscalls.scm (musl-libc?): New variable. =2A guix/build/syscalls.scm (linux?): Truth value on any linux system. =2A guix/build/syscalls.scm (readdir-procedure): Support musl libc. =2A guix/build/syscalls.scm (statfs): Support musl libc. =2D-- =20guix/build/syscalls.scm | 7 ++++--- =201 file changed, 4 insertions(+), 3 deletions(-) =0Adiff --git a/guix/build/syscalls.scm b/guix/build/syscalls.scm =69ndex c9c0bf594d..b845b8aab9 100644 =2D-- a/guix/build/syscalls.scm =2B++ b/guix/build/syscalls.scm =40@ -836,7 +836,8 @@ (define-record-type <file-system> =20(define-syntax fsword ;fsword_t =20 (identifier-syntax long)) =20= =2D(define linux? (string-contains %host-type "linux-gnu")) =2B(define musl-libc? (string-contains %host-type "linux-musl")) =2B(define linux? (string-contains %host-type "linux-")) =20= =20(define-syntax define-statfs-flags =20 (syntax-rules (linux hurd) =40@ -905,7 +906,7 @@ (define-c-struct %statfs ;<b= =69ts/statfs.h> =20 (spare (array fsword 4))) =20= =20(define statfs =2D (let ((proc (syscall->procedure int "statfs64" '(* *)))) =2B (let ((proc (syscall->procedure int (if musl-libc? "statfs" "statfs64"= =29 '(* *)))) =20 (lambda (file) =20 "Return a <file-system> data structure describing the file system =20mounted at FILE." =40@ -1232,7 +1233,7 @@ (define closedir* =20= =20(define (readdir-procedure name-field-offset sizeof-dirent-header =20 read-dirent-header) =2D (let ((proc (syscall->procedure '* "readdir64" '(*)))) =2B (let ((proc (syscall->procedure '* (if musl-libc? "readdir" "readdir64= =22) '(*)))) =20 (lambda* (directory #:optional (pointer->string pointer->string/utf-= =38)) =20 (let ((ptr (proc directory))) =20 (and (not (null-pointer? ptr)) ------_=_58a1976d5c5e54cf7f90ab59_=_--
guix-patches@HIDDEN
:bug#65486
; Package guix-patches
.
Full text available.Received: (at 65486) by debbugs.gnu.org; 13 Sep 2023 20:40:08 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Wed Sep 13 16:40:08 2023 Received: from localhost ([127.0.0.1]:36188 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1qgWed-0007h5-EV for submit <at> debbugs.gnu.org; Wed, 13 Sep 2023 16:40:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51886) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <ludo@HIDDEN>) id 1qgWea-0007gU-Me for 65486 <at> debbugs.gnu.org; Wed, 13 Sep 2023 16:40:05 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <ludo@HIDDEN>) id 1qgWeO-0005xp-2D; Wed, 13 Sep 2023 16:39:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To: From; bh=rSzoXrW8NxNmcoJtC6Oout15roBu3yiJOPi/IwVxezM=; b=m3I7bmwRB6ATp6gUPqeM W6j2MCAxhmRx1pqU5ceozVpJ/Kc4G5N+aS83A91XfJwvHblBo0LEPTuKQBwRevGVLO7jtHnuLd9oN DkC+r6gvC3cWYlAnxImNL15+brn2F7h2W+Kl9eufvVkagYee+bK/qdXvfFVe0s91cukCZZFspXtEL eDI7szDvlY+SD3HcOjI423Q6rbjw7L8MolX97MEJpqgP0dP1n1OO4XGXn4Z1iJqsu+Ygcuf97tfxu 71tpNfcK6EMaxTlNAe0/pAYbkRftkYWS4W1bdP6ZbkjbBdUv6ilOAbLW4HoBso/qBbKexa+PMMm4R RitNCqMh9v/uuA==; From: =?utf-8?Q?Ludovic_Court=C3=A8s?= <ludo@HIDDEN> To: =?utf-8?Q?S=C3=B6ren?= Tempel <tempel@HIDDEN> Subject: Re: bug#65486: [PATCH] syscalls: Add support for musl libc References: <20230824063303.7928-3-soeren@HIDDEN> <20230909130548.31083-2-soeren@HIDDEN> <87fs3kquwl.fsf_-_@HIDDEN> <3DOVAMAK0VD13.2XDJ9MT35902D@HIDDEN> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: Septidi 27 Fructidor an 231 de la =?utf-8?Q?R=C3=A9v?= =?utf-8?Q?olution=2C?= jour de la Verge-d'or X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu Date: Wed, 13 Sep 2023 22:39:50 +0200 In-Reply-To: <3DOVAMAK0VD13.2XDJ9MT35902D@HIDDEN> (=?utf-8?Q?=22S=C3=B6r?= =?utf-8?Q?en?= Tempel"'s message of "Wed, 13 Sep 2023 12:23:50 +0200") Message-ID: <87cyylkdt5.fsf@HIDDEN> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 65486 Cc: 65486 <at> debbugs.gnu.org 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 (---) Hi, S=C3=B6ren Tempel <tempel@HIDDEN> skribis: > Ludovic Court=C3=A8s <ludo@HIDDEN> wrote: [...] >> So what we want to check is whether we=E2=80=99re using the GNU libc or = Musl, >> regardless of the kernel. > > Keep in mind that=E2=80=94contrary to glibc=E2=80=94musl only supports Li= nux and not > GNU/Hurd. Therefore, it should be sufficient to simply check for a > linux-musl host and then use statfs/readdir over statfs64/readdir64: > > (let ((proc (syscall->procedure (if linux-musl? > "readdir" > "readdir64")))) > ........ > > Would that be acceptable? You could call it =E2=80=98musl?=E2=80=99 instead, to (hopefully) convey we= =E2=80=99re interested in the C library specifically. >> Now, instead of checking the libc=E2=80=99s identity, we could check whe= ther >> =E2=80=9Cstatfs64=E2=80=9D is available, and if not, fall back to =E2=80= =9Cstatfs=E2=80=9D. > > You mean using a GNU ./configure check? No no, I meant something like: (or (false-if-exception (dynamic-func "readdir64" (dynamic-link))) (dynamic-func "readdir" (dynamic-link))) Of course, it=E2=80=99s not as simple as this because we=E2=80=99d rather h= ave it integrated with =E2=80=98syscall->procedure=E2=80=99 (maybe by adding an #:alternative-name argument for the Musl name?), but you get the idea. HTH! Ludo=E2=80=99.
guix-patches@HIDDEN
:bug#65486
; Package guix-patches
.
Full text available.Received: (at 65486) by debbugs.gnu.org; 13 Sep 2023 14:29:08 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Wed Sep 13 10:29:08 2023 Received: from localhost ([127.0.0.1]:35541 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1qgQrS-0001Qy-1E for submit <at> debbugs.gnu.org; Wed, 13 Sep 2023 10:29:08 -0400 Received: from smtp.zfn.uni-bremen.de ([2001:638:708:32::21]:39206) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <tempel@HIDDEN>) id 1qgN2b-0000e0-82 for 65486 <at> debbugs.gnu.org; Wed, 13 Sep 2023 06:24:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=uni-bremen.de; s=2019; t=1694600641; bh=0+IVlaJaI38lvz83BKbafWDatTnaojtiAdtrFoyp/q4=; h=Date:To:Cc:From:References:In-Reply-To; b=aPnryX0hfW/ngtsxShQhh8xoecb4KRTP3hX+7J8MFDdtUBzshveaIZeO+af4vHtTE 7LPiN77xC8nJ2Lgw+owSW4Qu4CYbYghYM0CgnAy7m+qSHZGZfzk5F+P5dYSTHDnU/x aQ0McktPcEyzX0CTsIGn1xYNzmKfM3AqBGjw7yfxa3lydP/2DDqixuuHUUmbYj57Yn qxF+yIZsSn32rxwGkqaQESWqIzYRjeoFYenKvEEs7uF75oBDU9lEWNJ1hkv7lHQE8z TIaza9NO81iwREUV66mPeu7ftISbgPQIurHKZ4l5MWH0/51vpKPW57CrWmhaSqbzrx YIkCsbL9EgzUA== Received: from localhost (dynamic-002-247-249-202.2.247.pool.telefonica.de [2.247.249.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp.zfn.uni-bremen.de (Postfix) with ESMTPSA id 4RlxPr6gg7zDCgV; Wed, 13 Sep 2023 12:24:00 +0200 (CEST) Date: Wed, 13 Sep 2023 12:23:50 +0200 To: Ludovic =?UTF-8?Q?Court=C3=A8s?= <ludo@HIDDEN> Subject: Re: bug#65486: [PATCH] syscalls: Add support for musl libc From: =?UTF-8?Q?S=C3=B6ren?= Tempel <tempel@HIDDEN> References: <20230824063303.7928-3-soeren@HIDDEN> <20230909130548.31083-2-soeren@HIDDEN> <87fs3kquwl.fsf_-_@HIDDEN> In-Reply-To: <87fs3kquwl.fsf_-_@HIDDEN> Message-Id: <3DOVAMAK0VD13.2XDJ9MT35902D@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: 65486 X-Mailman-Approved-At: Wed, 13 Sep 2023 10:28:47 -0400 Cc: 65486 <at> debbugs.gnu.org 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 Ludovic, Ludovic Court=C3=A8s <ludo@HIDDEN> wrote: > I think this is misleading because this has to do with the C library, > not with the kernel (=E2=80=9Clinux variant=E2=80=9D). >=20 > For example, GNU/Hurd uses the same C library as GNU/Linux, and both > should use =E2=80=9Cstatfs64=E2=80=9D, =E2=80=9Creaddir64=E2=80=9D, etc. Oh, right! I totally forgot about GNU/Hurd, thanks for pointing that out. > So what we want to check is whether we=E2=80=99re using the GNU libc or M= usl, > regardless of the kernel. Keep in mind that=E2=80=94contrary to glibc=E2=80=94musl only supports Linu= x and not GNU/Hurd. Therefore, it should be sufficient to simply check for a linux-musl host and then use statfs/readdir over statfs64/readdir64: (let ((proc (syscall->procedure (if linux-musl? "readdir" "readdir64")))) ........ Would that be acceptable? > Now, instead of checking the libc=E2=80=99s identity, we could check whet= her > =E2=80=9Cstatfs64=E2=80=9D is available, and if not, fall back to =E2=80=9C= statfs=E2=80=9D. You mean using a GNU ./configure check? That would be possible. However, I think we also need to check somehow that readdir/statfs return values are struct-layout compatible with the readdir64/statfs64 versions used by glibc. Unfortunately, I am not deeply familiar with GNU autotools. Is there a similar feature-check in the Guile code base already that I could use as a source of inspiration? Maybe the if expression outlined above would be sufficient for now and we can improve upon that later? Greetings, S=C3=B6ren
guix-patches@HIDDEN
:bug#65486
; Package guix-patches
.
Full text available.Received: (at 65486) by debbugs.gnu.org; 11 Sep 2023 21:09:48 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Mon Sep 11 17:09:48 2023 Received: from localhost ([127.0.0.1]:54957 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1qfoAG-0005Em-BT for submit <at> debbugs.gnu.org; Mon, 11 Sep 2023 17:09:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40616) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <ludo@HIDDEN>) id 1qfoAC-0005EX-OH for 65486 <at> debbugs.gnu.org; Mon, 11 Sep 2023 17:09:47 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <ludo@HIDDEN>) id 1qfoA1-0004GU-GH; Mon, 11 Sep 2023 17:09:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To: From; bh=YPtS5Gzzc/S7YWNM07XHmHDi7/VHoj2rf20g2QgzhEY=; b=OI+raNkUT5lOxLMuAHSt sLJZSgPQf+vi0hEfESZ1GEeXbhZxZGC5/Q9qxg+53ekC0Rpd1/BNs9J6fhWFkK0ICIeK6KLYoqaDD M3ttju2PcaPGkbCKqfe4Sr8GCukqS6sWHzbK3rtQtwlnHjgcHSB4c1GwJxp2jaBQaLUsKCWbh829Z c/hXlhYCTKafbTy+HD7ZLgsCR539B53AfdUzpijzhtr0rnDSGrdcyzNEA4ReV8Ysn1paH3pw9Pyc2 ON/dsBWlZT/GQnID5PM+MQTfSCnlxtcYTlRogl3JqPKNCBloqfeH33Ed1zH19ucHUTT0et+XtWcRP tQ8OVnudEfOuSA==; From: =?utf-8?Q?Ludovic_Court=C3=A8s?= <ludo@HIDDEN> To: soeren@HIDDEN Subject: Re: bug#65486: [PATCH] syscalls: Add support for musl libc References: <20230824063303.7928-3-soeren@HIDDEN> <20230909130548.31083-2-soeren@HIDDEN> Date: Mon, 11 Sep 2023 23:09:30 +0200 In-Reply-To: <20230909130548.31083-2-soeren@HIDDEN> (soeren@HIDDEN's message of "Sat, 9 Sep 2023 15:04:28 +0200") Message-ID: <87fs3kquwl.fsf_-_@HIDDEN> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 65486 Cc: 65486 <at> debbugs.gnu.org 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 (---) Hi, soeren@HIDDEN skribis: > From: S=C3=B6ren Tempel <soeren@HIDDEN> > > This commit allows using Guix on a foreign distro which uses musl libc, > for example, Alpine Linux. Such a distro is detected via the new > linux-musl? variable based on the %host-type. > > Using the new linux-musl? variable, we can now implement musl-specific > quirks. The two compatibility problems I encountered in this regard are > that musl dose not export a readdir64 and statfs64 symbol. On musl, > these two functions are implemented as CPP macros that expand to > readdir/statfs. For this reason, a case-distinction was added. > > The existing linux? variable is now set to a truth value if the > host-system is either a linux-gnu or a linux-musl. A new linux-gnu? > variable can be used to detect linux-gnu systems. > > The patch has been tested on Alpine Linux and is already used for the > downstream Guix package shipped in Alpine Linux's package repository. [...] > -(define linux? (string-contains %host-type "linux-gnu")) > +(define linux-gnu? (string-contains %host-type "linux-gnu")) > +(define linux-musl? (string-contains %host-type "linux-musl")) > +(define linux? (or linux-gnu? linux-musl?)) >=20=20 > (define-syntax define-statfs-flags > (syntax-rules (linux hurd) > @@ -905,7 +907,11 @@ (define-c-struct %statfs ;<= bits/statfs.h> > (spare (array fsword 4))) >=20=20 > (define statfs > - (let ((proc (syscall->procedure int "statfs64" '(* *)))) > + (let ((proc (syscall->procedure int (cond > + (linux-gnu? "statfs64") > + (linux-musl? "statfs") > + (else (error "unknown linux vari= ant"))) I think this is misleading because this has to do with the C library, not with the kernel (=E2=80=9Clinux variant=E2=80=9D). For example, GNU/Hurd uses the same C library as GNU/Linux, and both should use =E2=80=9Cstatfs64=E2=80=9D, =E2=80=9Creaddir64=E2=80=9D, etc. S= o what we want to check is whether we=E2=80=99re using the GNU libc or Musl, regardless of the kernel. Now, instead of checking the libc=E2=80=99s identity, we could check whether =E2=80=9Cstatfs64=E2=80=9D is available, and if not, fall back to =E2=80=9C= statfs=E2=80=9D. WDYT? Thanks, Ludo=E2=80=99.
guix-patches@HIDDEN
:bug#65486
; Package guix-patches
.
Full text available.Received: (at 65486) by debbugs.gnu.org; 9 Sep 2023 13:06:28 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sat Sep 09 09:06:28 2023 Received: from localhost ([127.0.0.1]:46393 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1qexfP-0001Jp-Tb for submit <at> debbugs.gnu.org; Sat, 09 Sep 2023 09:06:28 -0400 Received: from magnesium.8pit.net ([45.76.88.171]:11184) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <soeren@HIDDEN>) id 1qexfN-0001Jg-JG; Sat, 09 Sep 2023 09:06:26 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; s=opensmtpd; bh=d2mUpqragy YMXxnQCP3XHrMMgnVvknHJQhys+K4welY=; h=references:in-reply-to:date: subject:cc:to:from; d=soeren-tempel.net; b=fWPryGHmjCSihhCG9Tut5+S/Y4y XvsdbU7ryO8zmkf1oEwRQnwP4hDC0OYKgCJZms07jahgcnQ36+yVr8pVeRT0NperkVH+eh JPaJEweSDaK2deX5u/yaga73ArqDHFh4rCBWjip6oLrz+6SMoCwa7qbUGOwHKBacMZHCcd iwwQ= Received: from localhost (dynamic-2a02-3102-49da-001b-a1f5-aaf2-6701-ddb5.310.pool.telefonica.de [2a02:3102:49da:1b:a1f5:aaf2:6701:ddb5]) by magnesium.8pit.net (OpenSMTPD) with ESMTPSA id 6d6ccb73 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:YES); Sat, 9 Sep 2023 15:06:20 +0200 (CEST) From: soeren@HIDDEN To: guix-patches@HIDDEN Subject: [PATCH v2] syscalls: Add support for musl libc Date: Sat, 9 Sep 2023 15:04:28 +0200 Message-ID: <20230909130548.31083-2-soeren@HIDDEN> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20230824063303.7928-3-soeren@HIDDEN> References: <20230824063303.7928-3-soeren@HIDDEN> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 65486 Cc: 65486 <at> debbugs.gnu.org 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 (-) From: Sören Tempel <soeren@HIDDEN> This commit allows using Guix on a foreign distro which uses musl libc, for example, Alpine Linux. Such a distro is detected via the new linux-musl? variable based on the %host-type. Using the new linux-musl? variable, we can now implement musl-specific quirks. The two compatibility problems I encountered in this regard are that musl dose not export a readdir64 and statfs64 symbol. On musl, these two functions are implemented as CPP macros that expand to readdir/statfs. For this reason, a case-distinction was added. The existing linux? variable is now set to a truth value if the host-system is either a linux-gnu or a linux-musl. A new linux-gnu? variable can be used to detect linux-gnu systems. The patch has been tested on Alpine Linux and is already used for the downstream Guix package shipped in Alpine Linux's package repository. * guix/build/syscalls.scm (linux-gnu?): New variable. * guix/build/syscalls.scm (linux-musl?): New variable. * guix/build/syscalls.scm (linux?): Truth value on musl or GNU Linux. * guix/build/syscalls.scm (readdir-procedure): Support musl libc. * guix/build/syscalls.scm (statfs): Support musl libc. Signed-off-by: Sören Tempel <soeren@HIDDEN> --- Changes since v1: Also add special handling for musl libc to the statfs procedure. Instead of checking the %host-type, it may also be possible to the lack of statfs64/readdir64 symbols during ./configure time. guix/build/syscalls.scm | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/guix/build/syscalls.scm b/guix/build/syscalls.scm index d947b010d3..416fdc768c 100644 --- a/guix/build/syscalls.scm +++ b/guix/build/syscalls.scm @@ -836,7 +836,9 @@ (define-record-type <file-system> (define-syntax fsword ;fsword_t (identifier-syntax long)) -(define linux? (string-contains %host-type "linux-gnu")) +(define linux-gnu? (string-contains %host-type "linux-gnu")) +(define linux-musl? (string-contains %host-type "linux-musl")) +(define linux? (or linux-gnu? linux-musl?)) (define-syntax define-statfs-flags (syntax-rules (linux hurd) @@ -905,7 +907,11 @@ (define-c-struct %statfs ;<bits/statfs.h> (spare (array fsword 4))) (define statfs - (let ((proc (syscall->procedure int "statfs64" '(* *)))) + (let ((proc (syscall->procedure int (cond + (linux-gnu? "statfs64") + (linux-musl? "statfs") + (else (error "unknown linux variant"))) + '(* *)))) (lambda (file) "Return a <file-system> data structure describing the file system mounted at FILE." @@ -1232,7 +1238,12 @@ (define closedir* (define (readdir-procedure name-field-offset sizeof-dirent-header read-dirent-header) - (let ((proc (syscall->procedure '* "readdir64" '(*)))) + (let ((proc (syscall->procedure '* + (cond + (linux-gnu? "readdir64") + (linux-musl? "readdir") + (else (error "unknown linux variant"))) + '(*)))) (lambda* (directory #:optional (pointer->string pointer->string/utf-8)) (let ((ptr (proc directory))) (and (not (null-pointer? ptr))
guix-patches@HIDDEN
:bug#65486
; Package guix-patches
.
Full text available.Received: (at submit) by debbugs.gnu.org; 9 Sep 2023 13:06:39 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sat Sep 09 09:06:39 2023 Received: from localhost ([127.0.0.1]:46396 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1qexfb-0001KD-Bs for submit <at> debbugs.gnu.org; Sat, 09 Sep 2023 09:06:39 -0400 Received: from lists.gnu.org ([2001:470:142::17]:43740) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <soeren@HIDDEN>) id 1qexfY-0001K0-Vn for submit <at> debbugs.gnu.org; Sat, 09 Sep 2023 09:06: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 1qexfQ-0006pj-AM for guix-patches@HIDDEN; Sat, 09 Sep 2023 09:06:28 -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 1qexfN-0003eZ-GE; Sat, 09 Sep 2023 09:06:28 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; s=opensmtpd; bh=d2mUpqragy YMXxnQCP3XHrMMgnVvknHJQhys+K4welY=; h=references:in-reply-to:date: subject:cc:to:from; d=soeren-tempel.net; b=fWPryGHmjCSihhCG9Tut5+S/Y4y XvsdbU7ryO8zmkf1oEwRQnwP4hDC0OYKgCJZms07jahgcnQ36+yVr8pVeRT0NperkVH+eh JPaJEweSDaK2deX5u/yaga73ArqDHFh4rCBWjip6oLrz+6SMoCwa7qbUGOwHKBacMZHCcd iwwQ= Received: from localhost (dynamic-2a02-3102-49da-001b-a1f5-aaf2-6701-ddb5.310.pool.telefonica.de [2a02:3102:49da:1b:a1f5:aaf2:6701:ddb5]) by magnesium.8pit.net (OpenSMTPD) with ESMTPSA id 6d6ccb73 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:YES); Sat, 9 Sep 2023 15:06:20 +0200 (CEST) From: soeren@HIDDEN To: guix-patches@HIDDEN Subject: [PATCH v2] syscalls: Add support for musl libc Date: Sat, 9 Sep 2023 15:04:28 +0200 Message-ID: <20230909130548.31083-2-soeren@HIDDEN> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20230824063303.7928-3-soeren@HIDDEN> References: <20230824063303.7928-3-soeren@HIDDEN> MIME-Version: 1.0 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: 0.9 (/) X-Debbugs-Envelope-To: submit Cc: 65486 <at> debbugs.gnu.org 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: -0.1 (/) From: Sören Tempel <soeren@HIDDEN> This commit allows using Guix on a foreign distro which uses musl libc, for example, Alpine Linux. Such a distro is detected via the new linux-musl? variable based on the %host-type. Using the new linux-musl? variable, we can now implement musl-specific quirks. The two compatibility problems I encountered in this regard are that musl dose not export a readdir64 and statfs64 symbol. On musl, these two functions are implemented as CPP macros that expand to readdir/statfs. For this reason, a case-distinction was added. The existing linux? variable is now set to a truth value if the host-system is either a linux-gnu or a linux-musl. A new linux-gnu? variable can be used to detect linux-gnu systems. The patch has been tested on Alpine Linux and is already used for the downstream Guix package shipped in Alpine Linux's package repository. * guix/build/syscalls.scm (linux-gnu?): New variable. * guix/build/syscalls.scm (linux-musl?): New variable. * guix/build/syscalls.scm (linux?): Truth value on musl or GNU Linux. * guix/build/syscalls.scm (readdir-procedure): Support musl libc. * guix/build/syscalls.scm (statfs): Support musl libc. Signed-off-by: Sören Tempel <soeren@HIDDEN> --- Changes since v1: Also add special handling for musl libc to the statfs procedure. Instead of checking the %host-type, it may also be possible to the lack of statfs64/readdir64 symbols during ./configure time. guix/build/syscalls.scm | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/guix/build/syscalls.scm b/guix/build/syscalls.scm index d947b010d3..416fdc768c 100644 --- a/guix/build/syscalls.scm +++ b/guix/build/syscalls.scm @@ -836,7 +836,9 @@ (define-record-type <file-system> (define-syntax fsword ;fsword_t (identifier-syntax long)) -(define linux? (string-contains %host-type "linux-gnu")) +(define linux-gnu? (string-contains %host-type "linux-gnu")) +(define linux-musl? (string-contains %host-type "linux-musl")) +(define linux? (or linux-gnu? linux-musl?)) (define-syntax define-statfs-flags (syntax-rules (linux hurd) @@ -905,7 +907,11 @@ (define-c-struct %statfs ;<bits/statfs.h> (spare (array fsword 4))) (define statfs - (let ((proc (syscall->procedure int "statfs64" '(* *)))) + (let ((proc (syscall->procedure int (cond + (linux-gnu? "statfs64") + (linux-musl? "statfs") + (else (error "unknown linux variant"))) + '(* *)))) (lambda (file) "Return a <file-system> data structure describing the file system mounted at FILE." @@ -1232,7 +1238,12 @@ (define closedir* (define (readdir-procedure name-field-offset sizeof-dirent-header read-dirent-header) - (let ((proc (syscall->procedure '* "readdir64" '(*)))) + (let ((proc (syscall->procedure '* + (cond + (linux-gnu? "readdir64") + (linux-musl? "readdir") + (else (error "unknown linux variant"))) + '(*)))) (lambda* (directory #:optional (pointer->string pointer->string/utf-8)) (let ((ptr (proc directory))) (and (not (null-pointer? ptr))
guix-patches@HIDDEN
:bug#65486
; Package guix-patches
.
Full text available.Received: (at submit) by debbugs.gnu.org; 24 Aug 2023 06:34:16 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Thu Aug 24 02:34:16 2023 Received: from localhost ([127.0.0.1]:35980 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1qZ3v5-00006S-Qo for submit <at> debbugs.gnu.org; Thu, 24 Aug 2023 02:34:16 -0400 Received: from lists.gnu.org ([2001:470:142::17]:41126) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <soeren@HIDDEN>) id 1qZ3uz-000068-VT for submit <at> debbugs.gnu.org; Thu, 24 Aug 2023 02:34:14 -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 1qZ3up-00072J-Gx for guix-patches@HIDDEN; Thu, 24 Aug 2023 02:33:59 -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 1qZ3ul-0000Hn-ID; Thu, 24 Aug 2023 02:33:59 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; s=opensmtpd; bh=FTSMDA9n59 JCXXL4KvmHbSYBo8rWI/zoBNPQP45qVks=; h=date:subject:to:from; d=soeren-tempel.net; b=I8+UkETJejDlXgdQC0VkHdwis1ediBFxBraGolzC8PXkviO cPP2z4eX0YK0arN4Uz4OprLh1GNC4bI4efHh+K0m0ioe5EDjiGjIfqWwV4ripvOfU2Mw1i Cnt9x4OQXx1Lmo0+BV6pIQCHy9NmexYZSUfjuUqa+bfVin+h6ThS5Y= Received: from localhost (dynamic-2a02-3102-49da-001b-8471-2294-2cf4-4d1a.310.pool.telefonica.de [2a02:3102:49da:1b:8471:2294:2cf4:4d1a]) by magnesium.8pit.net (OpenSMTPD) with ESMTPSA id 7b3c79d8 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:YES); Thu, 24 Aug 2023 08:33:44 +0200 (CEST) From: soeren@HIDDEN To: guix-patches@HIDDEN Subject: [PATCH] syscalls: Add support for musl libc Date: Thu, 24 Aug 2023 08:33:05 +0200 Message-ID: <20230824063303.7928-3-soeren@HIDDEN> X-Mailer: git-send-email 2.42.0 MIME-Version: 1.0 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: 0.9 (/) 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: -0.1 (/) From: Sören Tempel <soeren@HIDDEN> This commit allows using Guix on a foreign distro which uses musl libc, for example, Alpine Linux. Such a distro is detected via the new linux-musl? variable based on the %host-type. Using the new linux-musl? variable, we can now implement musl-specific quirks. The only problem I encountered in this regard so far is that musl does not export a readdir64 symbol. On musl, readdir64 is a CPP macro that expands to readdir. For this reason, readdir-procedure now uses readdir over readdir64 if the host-system uses musl libc. The existing linux? variable is now set to a truth value if the host-system is either a linux-gnu or a linux-musl. A new linux-gnu? variable can be used to detect linux-gnu systems. The patch has been tested on Alpine Linux and is already used for the downstream Guix package shipped in Alpine Linux's package repository. * guix/build/syscalls.scm (linux-gnu?): New variable. * guix/build/syscalls.scm (linux-musl?): New variable. * guix/build/syscalls.scm (linux?): Truth value on musl or GNU Linux. * guix/build/syscalls.scm (readdir-procedure): Support musl libc. Signed-off-by: Sören Tempel <soeren@HIDDEN> --- guix/build/syscalls.scm | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/guix/build/syscalls.scm b/guix/build/syscalls.scm index d947b010d3..a690e8da0b 100644 --- a/guix/build/syscalls.scm +++ b/guix/build/syscalls.scm @@ -836,7 +836,9 @@ (define-record-type <file-system> (define-syntax fsword ;fsword_t (identifier-syntax long)) -(define linux? (string-contains %host-type "linux-gnu")) +(define linux-gnu? (string-contains %host-type "linux-gnu")) +(define linux-musl? (string-contains %host-type "linux-musl")) +(define linux? (or linux-gnu? linux-musl?)) (define-syntax define-statfs-flags (syntax-rules (linux hurd) @@ -1232,7 +1234,12 @@ (define closedir* (define (readdir-procedure name-field-offset sizeof-dirent-header read-dirent-header) - (let ((proc (syscall->procedure '* "readdir64" '(*)))) + (let ((proc (syscall->procedure '* + (cond + (linux-gnu? "readdir64") + (linux-musl? "readdir") + (else (error "unknown linux variant"))) + '(*)))) (lambda* (directory #:optional (pointer->string pointer->string/utf-8)) (let ((ptr (proc directory))) (and (not (null-pointer? ptr))
soeren@HIDDEN
:guix-patches@HIDDEN
.
Full text available.guix-patches@HIDDEN
:bug#65486
; Package guix-patches
.
Full text available.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.