From unknown Wed Jun 18 23:17:23 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#75133 <75133@debbugs.gnu.org> To: bug#75133 <75133@debbugs.gnu.org> Subject: Status: [PATCH] syscalls: Add implementation of statfs for guile-static. Reply-To: bug#75133 <75133@debbugs.gnu.org> Date: Thu, 19 Jun 2025 06:17:23 +0000 retitle 75133 [PATCH] syscalls: Add implementation of statfs for guile-stat= ic. reassign 75133 guix-patches submitter 75133 Noah Evans severity 75133 normal tag 75133 patch thanks From debbugs-submit-bounces@debbugs.gnu.org Fri Dec 27 01:12:14 2024 Received: (at submit) by debbugs.gnu.org; 27 Dec 2024 06:12:14 +0000 Received: from localhost ([127.0.0.1]:44429 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tR3a1-0004w6-PZ for submit@debbugs.gnu.org; Fri, 27 Dec 2024 01:12:14 -0500 Received: from lists.gnu.org ([209.51.188.17]:40132) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tQtXP-0005rd-Oo for submit@debbugs.gnu.org; Thu, 26 Dec 2024 14:28:52 -0500 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 1tQtXO-0004MS-NH for guix-patches@gnu.org; Thu, 26 Dec 2024 14:28:50 -0500 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tQtXM-00080D-RO for guix-patches@gnu.org; Thu, 26 Dec 2024 14:28:50 -0500 Received: by mail-wr1-x42d.google.com with SMTP id ffacd0b85a97d-38633b5dbcfso6482793f8f.2 for ; Thu, 26 Dec 2024 11:28:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1735241326; x=1735846126; darn=gnu.org; h=content-transfer-encoding:to:subject:message-id:date:from :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=v3ETJi45b6f7Qk88yK2m5z5Vwo9fJH4+3kMls+ScJGo=; b=mH/Gtq62RLkDM64pY2/x/VwiWu6JrLoGd/qooEW+jMrdH5ieJXpW042fdh6VY1j0x6 /6yjHL0XpiwPJzmhJNdSq16LW3aKuNvJJJ55WYTa9uIapY1RzZEnElBI4IMdZ0XRlQEd mX+/TM9PKwHQAR4mqfzU/r+vQoZGiqxhaVeyeNXPujBkmYQPtkETIHZuRW00Mn06iFpm G9wj+ShJQbHiKHFZIUd68y51VcB3u9Xi9N7a8J5/+uFKAMZAyzQgIyEBj5aeGAk3b4DE WuE/TvlA+buk2I6uD4CqJDA3V5AVBYD1BtM7aLe8CmCXbA60/Ah3hevZ5Pb2psBbnl5W KkZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735241326; x=1735846126; h=content-transfer-encoding:to:subject:message-id:date:from :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=v3ETJi45b6f7Qk88yK2m5z5Vwo9fJH4+3kMls+ScJGo=; b=c3HuEXJR6kw0iPWvvjWlVBUaD68fkwllWT7p0Q1TTQwhNS+9PK9HKhcXwCLmoFvBJu CCxzgiNjDS3q6ZYBSJXQ2ivhtmuRM9HCmrmBnx3QCGnnIdLX/aMTBcYvsRq2msZWiouD V8xgG2m0p8KKWhe5NC8hQpf/PhwBTDPy/lT46dbLg+oHwcPvhkESnBUsilzM/atcqFSI uw2nrcWuMciaOdFdsQ/UAe4vzMG9AgpZDazAvKRZ7fqQTfKbcAswMG59INmxcoZ/ZR3w cfinsv1OwRGzK2MiFKqU0lLIfNbdAfPpDLYSZiRgFM8q+nRODkeimMWWWHGUPtGWw5DX G/hg== X-Gm-Message-State: AOJu0YxKWR6JrAzNgh+DuC9Ifd+4J/SlEtYhKIluo1Gts4kIzq+8xblL zJbio0Bn/sfKjh8nYPFv4d5EPtmvilx6i6GXAmN9sPsMPdX75cQFl6QfYpEsp1O/YvPsWIntvjt ub86uFhZouufcdX5TkM7XyrNtGmdQwpYU3eY= X-Gm-Gg: ASbGncsI1klyTAbzHCohjGD7yie+ySaSpSaPdW1KyIiUYS+DrlHseWftslgb1d5ZCRS duyN9R9fBgO4Xs0VfRWlgUsk106AduBIJPlv7k2msiQNh5mEYg+g= X-Google-Smtp-Source: AGHT+IF4GwXpc0qu6Z/K5+l62rwNFESfCFSrqfB95cfE6p2Z9r6HPLGPFgwLDmvTsjZccv1IMqusgFqj6iT1GkUDtSM= X-Received: by 2002:a05:6000:713:b0:386:3903:86eb with SMTP id ffacd0b85a97d-38a221f1fd1mr19609750f8f.23.1735241326126; Thu, 26 Dec 2024 11:28:46 -0800 (PST) MIME-Version: 1.0 From: Noah Evans Date: Thu, 26 Dec 2024 14:28:35 -0500 Message-ID: Subject: [PATCH] syscalls: Add implementation of statfs for guile-static. To: guix-patches@gnu.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=2a00:1450:4864:20::42d; envelope-from=noahevans256@gmail.com; helo=mail-wr1-x42d.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 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, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.1 (-) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Fri, 27 Dec 2024 01:12:12 -0500 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.1 (--) * guix/build/syscalls.scm (statfs): Add implementation for calling from guile-static. * gnu/packages/patches/guile-3.0-linux-syscalls.patch, gnu/packages/patches/guile-linux-syscalls.patch (statfs-raw): C Function to support above. This is needed when bind mounting filesystems from the initrd guile, or els= e you get an error like this: https://lists.gnu.org/archive/html/help-guix/2021-07/msg00050.html Change-Id: Ibc8f1f27648add90639bd391aff8d61c6a23b884 --- .../patches/guile-3.0-linux-syscalls.patch | 34 ++++++++++++++++++- .../patches/guile-linux-syscalls.patch | 34 ++++++++++++++++++- guix/build/syscalls.scm | 30 ++++++++++------ 3 files changed, 85 insertions(+), 13 deletions(-) diff --git a/gnu/packages/patches/guile-3.0-linux-syscalls.patch b/gnu/packages/patches/guile-3.0-linux-syscalls.patch index 0d27f77ee2..1332d31241 100644 --- a/gnu/packages/patches/guile-3.0-linux-syscalls.patch +++ b/gnu/packages/patches/guile-3.0-linux-syscalls.patch @@ -6,7 +6,7 @@ a statically-linked Guile in an initrd that doesn't have libc.so around. diff --git a/libguile/posix.c b/libguile/posix.c --- a/libguile/posix.c +++ b/libguile/posix.c -@@ -2375,6 +2375,336 @@ scm_init_popen (void) +@@ -2375,6 +2375,368 @@ scm_init_popen (void) } #endif /* HAVE_START_CHILD */ @@ -339,6 +339,38 @@ diff --git a/libguile/posix.c b/libguile/posix.c +} +#undef FUNC_NAME +#endif ++ ++#include ++ ++SCM_DEFINE (scm_statfs_raw, "statfs-raw", 1, 0, 0, ++ (SCM filesystem), ++ "Return a bytevector describing @var{filesystem}") ++#define FUNC_NAME s_scm_statfs_raw ++{ ++ int err; ++ char *c_filesystem; ++ SCM bv; ++ ++ c_filesystem =3D scm_to_locale_string (filesystem); ++ ++ bv =3D scm_c_make_bytevector (sizeof (struct statfs)); ++ struct statfs *bv_pointer =3D scm_to_pointer (scm_bytevector_to_pointer (bv, scm_from_int (0))); ++ ++ err =3D statfs (c_filesystem, bv_pointer); ++ if (err !=3D 0) ++ err =3D errno; ++ ++ free (c_filesystem); ++ ++ if (err !=3D 0) ++ { ++ errno =3D err; ++ SCM_SYSERROR; ++ } ++ ++ return bv; ++} ++#undef FUNC_NAME + void scm_init_posix () diff --git a/gnu/packages/patches/guile-linux-syscalls.patch b/gnu/packages/patches/guile-linux-syscalls.patch index 12cddff47b..04645caeb8 100644 --- a/gnu/packages/patches/guile-linux-syscalls.patch +++ b/gnu/packages/patches/guile-linux-syscalls.patch @@ -7,7 +7,7 @@ diff --git a/libguile/posix.c b/libguile/posix.c index b0fcad5fd..1343186e3 100644 --- a/libguile/posix.c +++ b/libguile/posix.c -@@ -2341,6 +2341,335 @@ scm_init_popen (void) +@@ -2341,6 +2341,367 @@ scm_init_popen (void) } #endif /* HAVE_START_CHILD */ @@ -339,6 +339,38 @@ index b0fcad5fd..1343186e3 100644 +} +#undef FUNC_NAME +#endif ++ ++#include ++ ++SCM_DEFINE (scm_statfs_raw, "statfs-raw", 1, 0, 0, ++ (SCM filesystem), ++ "Return a bytevector describing @var{filesystem}") ++#define FUNC_NAME s_scm_statfs_raw ++{ ++ int err; ++ char *c_filesystem; ++ SCM bv; ++ ++ c_filesystem =3D scm_to_locale_string (filesystem); ++ ++ bv =3D scm_c_make_bytevector (sizeof (struct statfs)); ++ struct statfs *bv_pointer =3D scm_to_pointer (scm_bytevector_to_pointer (bv, scm_from_int (0))); ++ ++ err =3D statfs (c_filesystem, bv_pointer); ++ if (err !=3D 0) ++ err =3D errno; ++ ++ free (c_filesystem); ++ ++ if (err !=3D 0) ++ { ++ errno =3D err; ++ SCM_SYSERROR; ++ } ++ ++ return bv; ++} ++#undef FUNC_NAME + void scm_init_posix () diff --git a/guix/build/syscalls.scm b/guix/build/syscalls.scm index 2c20edf058..e2af4efd12 100644 --- a/guix/build/syscalls.scm +++ b/guix/build/syscalls.scm @@ -9,6 +9,7 @@ ;;; Copyright =C2=A9 2021 Chris Marusich ;;; Copyright =C2=A9 2021 Tobias Geerinckx-Rice ;;; Copyright =C2=A9 2022 Oleg Pykhalov +;;; Copyright =C2=A9 2024 Noah Evans ;;; ;;; This file is part of GNU Guix. ;;; @@ -930,18 +931,25 @@ (define-c-struct %statfs ; (spare (array fsword 4))) (define statfs - (let ((proc (syscall->procedure int (if musl-libc? "statfs" "statfs64") '(* *)))) - (lambda (file) - "Return a data structure describing the file system + (if (module-defined? the-scm-module 'statfs-raw) + (lambda (file) + "Return a data structure describing the file system mounted at FILE." - (let*-values (((stat) (make-bytevector sizeof-statfs)) - ((ret err) (proc (string->pointer file) - (bytevector->pointer stat)))) - (if (zero? ret) - (read-statfs stat) - (throw 'system-error "statfs" "~A: ~A" - (list file (strerror err)) - (list err))))))) + (read-statfs ((module-ref the-scm-module 'statfs-raw) file))) + (let ((proc (syscall->procedure int + (if musl-libc? "statfs" "statfs64") + '(* *)))) + (lambda (file) + "Return a data structure describing the file syste= m +mounted at FILE." + (let*-values (((stat) (make-bytevector sizeof-statfs)) + ((ret err) (proc (string->pointer file) + (bytevector->pointer stat)))) + (if (zero? ret) + (read-statfs stat) + (throw 'system-error "statfs" "~A: ~A" + (list file (strerror err)) + (list err)))))))) (define (free-disk-space file) "Return the free disk space, in bytes, on the file system that hosts FIL= E." base-commit: f03a0e2d19f95eb0961472842540970c2f7605f1 --=20 2.46.0 From debbugs-submit-bounces@debbugs.gnu.org Wed Jan 08 18:23:41 2025 Received: (at 75133-done) by debbugs.gnu.org; 8 Jan 2025 23:23:41 +0000 Received: from localhost ([127.0.0.1]:49472 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tVfOn-0001A4-GH for submit@debbugs.gnu.org; Wed, 08 Jan 2025 18:23:41 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:35460) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tVfOl-00019p-Cl for 75133-done@debbugs.gnu.org; Wed, 08 Jan 2025 18:23:40 -0500 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 1tVfOf-0001hs-Qa; Wed, 08 Jan 2025 18:23:33 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=TrPdLXcMeorKYgAW/R/BFmxdbzMdbPQZQ25yXZeDA2w=; b=dTWHGyv9jAzd3KljJPr4 i9ChGkjDCCNVgqnB3VABtSnMFDJXP0jnbeV94Acx1vEDCsEg4TrZzzBCbSmt8RwfwNRCgP0VDytER MXBkTbKxRKzDydxd+jOrP/1psyCZLDpl+pcVGge+AE9cHpfeFSVIhgoUotnwre2yKV2ekx3aS9UeJ UGItCeopQivKwTvppHuk2aUtlVTHdJklLwGaN3WVOcZ7hEL/q9+Sw+z11CkAMV8vKg1rAc7URSLwd gdSYgn3W2XcB3oZlFYpcM6KuzdrOtwdSo7geXFdq6/CPfRtaKUhFSBhHDvUcM1IgCz5MygmJdRGEl 0LpKkNt/+ydDPA==; From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Noah Evans Subject: Re: [bug#75133] [PATCH] syscalls: Add implementation of statfs for guile-static. In-Reply-To: (Noah Evans's message of "Thu, 26 Dec 2024 14:28:35 -0500") References: Date: Thu, 09 Jan 2025 00:23:29 +0100 Message-ID: <87y0zksxe6.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) 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: 75133-done Cc: 75133-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Hi, Noah Evans skribis: > * guix/build/syscalls.scm (statfs): Add implementation for calling from > guile-static. > * gnu/packages/patches/guile-3.0-linux-syscalls.patch, > gnu/packages/patches/guile-linux-syscalls.patch (statfs-raw): C Function = to > support above. > > This is needed when bind mounting filesystems from the initrd guile, or e= lse > you get an error like this: > https://lists.gnu.org/archive/html/help-guix/2021-07/msg00050.html > > Change-Id: Ibc8f1f27648add90639bd391aff8d61c6a23b884 Well done. Applied, thanks! Ludo=E2=80=99. From unknown Wed Jun 18 23:17:23 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Thu, 06 Feb 2025 12:24:08 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator