Message ID | 87illsb71w.fsf@gnu.org |
---|---|
State | New |
Headers |
Return-Path: <guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org> X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 5D11E27BBEA; Mon, 12 Sep 2022 22:47:16 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 165AE27BBE9 for <patchwork@mira.cbaines.net>; Mon, 12 Sep 2022 22:47:16 +0100 (BST) Received: from localhost ([::1]:38838 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from <guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org>) id 1oXrGs-0003ut-8I for patchwork@mira.cbaines.net; Mon, 12 Sep 2022 17:47:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51026) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1oXrGi-0003u4-40 for guix-patches@gnu.org; Mon, 12 Sep 2022 17:47:04 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:59530) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1oXrGh-00041a-RF for guix-patches@gnu.org; Mon, 12 Sep 2022 17:47:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1oXrGh-0004Ln-Kn for guix-patches@gnu.org; Mon, 12 Sep 2022 17:47:03 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#57730] [PATCH] syscalls: Adjust for glibc 2.34 and later. Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= <ludo@gnu.org> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org> Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 12 Sep 2022 21:47:03 +0000 Resent-Message-ID: <handler.57730.B57730.166301916316550@debbugs.gnu.org> Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 57730 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Marius Bakke <marius@gnu.org> Cc: 57730@debbugs.gnu.org Received: via spool by 57730-submit@debbugs.gnu.org id=B57730.166301916316550 (code B ref 57730); Mon, 12 Sep 2022 21:47:03 +0000 Received: (at 57730) by debbugs.gnu.org; 12 Sep 2022 21:46:03 +0000 Received: from localhost ([127.0.0.1]:48217 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces@debbugs.gnu.org>) id 1oXrFi-0004In-Lc for submit@debbugs.gnu.org; Mon, 12 Sep 2022 17:46:02 -0400 Received: from eggs.gnu.org ([209.51.188.92]:57180) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <ludo@gnu.org>) id 1oXrFg-0004I2-QI for 57730@debbugs.gnu.org; Mon, 12 Sep 2022 17:46:01 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:49946) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <ludo@gnu.org>) id 1oXrFa-0003rh-HX for 57730@debbugs.gnu.org; Mon, 12 Sep 2022 17:45:55 -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=JZEAG3yXPEHu8b37aradw06Cko7c68P3XkvVFTe3mKg=; b=e70Em7y/ejj2VGn6r65r s43h9mNASIIHPaKkdVzMk10Rg/LeUW/1LJbfwvvlmytVATYvhdfyy1EMOVoA7494Iqtum4/HRGxwE SSjMY0MT41vXFb2pv/Mr+GNBMagkMiZB5wZ5mTCP5g33VpdXGofkDP5kKDqSt36lRjnK9t6AF04ne dxAvvcCUgL43/93Ekx6cZtJhTwL5hkAXXKyK0RFfhwjyq1rjfYC2LZ14wj/syELaJNuTc5tvxxwbQ oDZf/YA/akAAQiswzimP0HsLOWglUnNutCNm0qS/Sz5PpOGDvMcLL3HOd7KkWQ7hdM+rcjiPgI83k AMUczfD7Wh/vqA==; Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201]:56508 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <ludo@gnu.org>) id 1oXrFV-000324-V0; Mon, 12 Sep 2022 17:45:50 -0400 From: Ludovic =?utf-8?q?Court=C3=A8s?= <ludo@gnu.org> References: <20220911105051.16901-1-marius@gnu.org> Date: Mon, 12 Sep 2022 23:45:47 +0200 In-Reply-To: <20220911105051.16901-1-marius@gnu.org> (Marius Bakke's message of "Sun, 11 Sep 2022 12:50:51 +0200") Message-ID: <87illsb71w.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.1 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: <guix-patches.gnu.org> List-Unsubscribe: <https://lists.gnu.org/mailman/options/guix-patches>, <mailto:guix-patches-request@gnu.org?subject=unsubscribe> List-Archive: <https://lists.gnu.org/archive/html/guix-patches> List-Post: <mailto:guix-patches@gnu.org> List-Help: <mailto:guix-patches-request@gnu.org?subject=help> List-Subscribe: <https://lists.gnu.org/mailman/listinfo/guix-patches>, <mailto:guix-patches-request@gnu.org?subject=subscribe> Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" <guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org> X-getmail-retrieved-from-mailbox: Patches |
Series |
[bug#57730] syscalls: Adjust for glibc 2.34 and later.
|
|
Commit Message
Ludovic Courtès
Sept. 12, 2022, 9:45 p.m. UTC
Hi, Marius Bakke <marius@gnu.org> skribis: > This is a re-implementation of 3c8b6fd94ceb1e898216929e8768fb518dbf1de9 that > works with new and old libc's. > > * guix/build/syscalls.scm (openpty, login-tty): Wrap in exception handlers and > retry with libutil if the first call is unsuccessful. [...] > (define openpty > - (let ((proc (syscall->procedure int "openpty" '(* * * * *) > - #:library "libutil"))) > - (lambda () > - "Return two file descriptors: one for the pseudo-terminal control side, > + (lambda* (#:optional library) > + "Return two file descriptors: one for the pseudo-terminal control side, > and one for the controlled side." > + (let ((proc (syscall->procedure int "openpty" '(* * * * *) > + #:library library))) In general, we must ensure that ‘syscall->procedure’ is called only once per procedure, because it’s expensive compared to the function we’re wrapping (it’s doing dlopen, dlsym, and all that). Anyway, I think this should work: WDYT? Thanks, Ludo’.
Comments
Ludovic Courtès <ludo@gnu.org> skriver: >> (define openpty >> - (let ((proc (syscall->procedure int "openpty" '(* * * * *) >> - #:library "libutil"))) >> - (lambda () >> - "Return two file descriptors: one for the pseudo-terminal control side, >> + (lambda* (#:optional library) >> + "Return two file descriptors: one for the pseudo-terminal control side, >> and one for the controlled side." >> + (let ((proc (syscall->procedure int "openpty" '(* * * * *) >> + #:library library))) > > In general, we must ensure that ‘syscall->procedure’ is called only once > per procedure, because it’s expensive compared to the function we’re > wrapping (it’s doing dlopen, dlsym, and all that). That makes sense. > Anyway, I think this should work: > > diff --git a/guix/build/syscalls.scm b/guix/build/syscalls.scm > index 7842b0a9fc..e081aaca44 100644 > --- a/guix/build/syscalls.scm > +++ b/guix/build/syscalls.scm > @@ -445,9 +445,14 @@ (define* (syscall->procedure return-type name argument-types > 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 subsumed > + ;; by libc.so with glibc >= 2.34. > (let ((ptr (dynamic-func name > (if library > - (dynamic-link 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 > > WDYT? I can confirm this works after reverting 3c8b6fd94ceb1e89821. Can you commit it, or should I do it on your behalf? I think we should try to get it in 1.4.0 so Guix works when linked against system libc on foreign distributions. I'll revert 3c8b6fd94ce once this lands on 'core-updates'. Thanks!
Hey, > Can you commit it, or should I do it on your behalf? I think we should > try to get it in 1.4.0 so Guix works when linked against system libc on > foreign distributions. This indeed seems like the right thing to do :) Marius or Ludo, I think you can go ahead :) Thanks, Mathieu
Hi, Mathieu Othacehe <othacehe@gnu.org> skribis: > Hey, > >> Can you commit it, or should I do it on your behalf? I think we should >> try to get it in 1.4.0 so Guix works when linked against system libc on >> foreign distributions. > > This indeed seems like the right thing to do :) Marius or Ludo, I think > you can go ahead :) Pushed on ‘core-updates’ as 3f6c32a88fc7a4d707ae1ed8ef3f7bd995461aff! Ludo’.
diff --git a/guix/build/syscalls.scm b/guix/build/syscalls.scm index 7842b0a9fc..e081aaca44 100644 --- a/guix/build/syscalls.scm +++ b/guix/build/syscalls.scm @@ -445,9 +445,14 @@ (define* (syscall->procedure return-type name argument-types 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 subsumed + ;; by libc.so with glibc >= 2.34. (let ((ptr (dynamic-func name (if library - (dynamic-link 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