From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:306:2d92::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id wLjJF1qC/2Q7+AAA9RJhRA:P1 (envelope-from ) for ; Mon, 11 Sep 2023 23:10:50 +0200 Received: from aspmx1.migadu.com ([2001:41d0:306:2d92::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id wLjJF1qC/2Q7+AAA9RJhRA (envelope-from ) for ; Mon, 11 Sep 2023 23:10:50 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id D21935386E for ; Mon, 11 Sep 2023 23:10:11 +0200 (CEST) Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=OI+raNkU; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gnu.org ARC-Seal: i=1; s=key1; d=yhetil.org; t=1694466612; a=rsa-sha256; cv=none; b=E24Q50lLXUBG49MdSynq96FJG8T+UlB7suHleXIimvLveV7RvtWKQAuX0ELlxgloS33TZ9 pd9pBEppKx6YB3nV4gQYIsIMtYJHFXmfhN3ZmnaSaY5NjOUf1UUcPWjv/fQuFXyWM0NEFF eN8umKBQ/5RptMlaTterW7FWPFgCjlyy3RkSNunnvL31U/k2uKG9mzoqwIKNcN+uQ1mGbv Ztc6cCmIt3fyh+JcuKYhmLRTFLw+la5mrF6R2Ojm6H1PY2/j0iHHYgeHtDgr2fRp5gy+j/ jfj0T5yT+3OwMclOUN8djF3MOhStc1eGRebrr7XSCT2faJJGjnJDGaw7Ju273w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1694466612; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=YPtS5Gzzc/S7YWNM07XHmHDi7/VHoj2rf20g2QgzhEY=; b=TFrFgJDZrc78KLaED1bswPePSoillMY8P9z/iGm6+vyhj5w5uslA5Vsf7JisxMXveOaaBD C4ihXEvlblH5PuHv1VRnlOhomygYQIMl6g+XmiOTtTsrsO3kmz6ULaJVp9U4pJMAoyvC7I mKg1BJK03kErpK5qMg2GAKLcJtpoGBUlBgaL5rF9IxFiDpKJzGSEIz5qzY4eNvzzsstR7b a9TyDvF08Q9yMsmbNDhZKCQDGHn4jiJesPhFL9Nn6+dzgs9YgKOT/F8dkId15j3YrNVZc6 NBFzd8jDVlTDdjOfZIzCe1Ibxt2XqIFOjxmXjODX0KKbKFeQNwE2YQI06jXjLQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=OI+raNkU; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gnu.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qfoAS-0002pZ-Tw; Mon, 11 Sep 2023 17:10:01 -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 ) id 1qfoAP-0002ku-Ld for guix-patches@gnu.org; Mon, 11 Sep 2023 17:09:59 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qfoAP-0004LE-Co for guix-patches@gnu.org; Mon, 11 Sep 2023 17:09:57 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qfoAT-0005FH-KK for guix-patches@gnu.org; Mon, 11 Sep 2023 17:10:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#65486] [PATCH] syscalls: Add support for musl libc Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 11 Sep 2023 21:10:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 65486 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: soeren@soeren-tempel.net Cc: 65486@debbugs.gnu.org Received: via spool by 65486-submit@debbugs.gnu.org id=B65486.169446658820140 (code B ref 65486); Mon, 11 Sep 2023 21:10:01 +0000 Received: (at 65486) by debbugs.gnu.org; 11 Sep 2023 21:09:48 +0000 Received: from localhost ([127.0.0.1]:54957 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qfoAG-0005Em-BT for submit@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 ) id 1qfoAC-0005EX-OH for 65486@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 ) 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: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <20230824063303.7928-3-soeren@soeren-tempel.net> <20230909130548.31083-2-soeren@soeren-tempel.net> Date: Mon, 11 Sep 2023 23:09:30 +0200 In-Reply-To: <20230909130548.31083-2-soeren@soeren-tempel.net> (soeren@soeren-tempel.net's message of "Sat, 9 Sep 2023 15:04:28 +0200") Message-ID: <87fs3kquwl.fsf_-_@gnu.org> 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-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Spam-Score: -6.92 X-Spam-Score: -6.92 X-Migadu-Queue-Id: D21935386E X-Migadu-Scanner: mx2.migadu.com X-TUID: Meb5pUEjNy2X Hi, soeren@soeren-tempel.net skribis: > From: S=C3=B6ren Tempel > > 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.