From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id KEXuCOWoH2P1CQAAbAwnHQ (envelope-from ) for ; Mon, 12 Sep 2022 23:47:17 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id wNj0COWoH2NbggAA9RJhRA (envelope-from ) for ; Mon, 12 Sep 2022 23:47:17 +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 C63A43AD06 for ; Mon, 12 Sep 2022 23:47:16 +0200 (CEST) Received: from localhost ([::1]:38838 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oXrGt-0003ut-Py for larch@yhetil.org; 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 ) 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 ) 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 ) 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?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 12 Sep 2022 21:47:03 +0000 Resent-Message-ID: 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 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 ) 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 ) 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 ) 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 ) id 1oXrFV-000324-V0; Mon, 12 Sep 2022 17:45:50 -0400 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1663019236; 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: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=JZEAG3yXPEHu8b37aradw06Cko7c68P3XkvVFTe3mKg=; b=ryITkFT/rM0vkkybHdjrEOK72/b8UcDN4j7mVzomNENauPDx1KeU7lu0WkNEZKvKDRhDxq YEhQdJVozLL4hlZR9xmXlF4umbiwWR+GemCAGtrnIKg/PAYEUU8t+Jd/NDXgg0tGgXcgCW rXEYKZx+l+5VUKQySUXkJwhuE+DyD2bxCrOx2VtlT5KggrlzEv8+d6nnspv1Zgaq7fmJAd 6aKQXWj4tSw82X5oXloMvsAEpejrgahZFEcZW4dVlfEcm9x4xSrXi+CbQy6kKBJfkwfYKC IRYzSoUO7ui2ZWLnrcXotDG5H7ON7jj/GvMG4wy6kTYa34eKy1Nt4BwqRCvHsA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1663019236; a=rsa-sha256; cv=none; b=kVYWVwH/RiqSbSAgTv5EXAS/i35i3nh/G5ULTvVyWeGxvYYCU8ehfgilsk1+n8G7I+9DGW STRFnw1A70PetNkHZP0TVmBGbJrta1FO68b8zASEzQ+sslAe/o3MzAoXTKD86HT3ylQLrM ahtRoLwpBUB0Co6gXaws0bexIzNrqxB8t4G+c5LJt0vTwugp6prIQrX18E/Bje1Ssc6Dks BXdHuz9eHrv56FENyrZke1AYhR02qy3lSl5UL+HfP72Q5GoGI2OmcVG49g9NQ3KULzFjvT qNieA7/AUHXtRaSj2s/jeGjCHVMo6kzjlwkclyEE9QQ+Q27OgOPkG9c9Q+Qn2A== 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="e70Em7y/"; dmarc=pass (policy=none) header.from=gnu.org; 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" X-Migadu-Spam-Score: -2.21 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b="e70Em7y/"; dmarc=pass (policy=none) header.from=gnu.org; 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" X-Migadu-Queue-Id: C63A43AD06 X-Spam-Score: -2.21 X-Migadu-Scanner: scn1.migadu.com X-TUID: D5RW4/QJ049E --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi, Marius Bakke skribis: > This is a re-implementation of 3c8b6fd94ceb1e898216929e8768fb518dbf1de9 t= hat > works with new and old libc's. > > * guix/build/syscalls.scm (openpty, login-tty): Wrap in exception handler= s 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 si= de, > and one for the controlled side." > + (let ((proc (syscall->procedure int "openpty" '(* * * * *) > + #:library library))) In general, we must ensure that =E2=80=98syscall->procedure=E2=80=99 is cal= led only once per procedure, because it=E2=80=99s expensive compared to the function we= =E2=80=99re wrapping (it=E2=80=99s doing dlopen, dlsym, and all that). Anyway, I think this should work: --=-=-= Content-Type: text/x-patch Content-Disposition: inline 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 --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable WDYT? Thanks, Ludo=E2=80=99. --=-=-=--