From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Newsgroups: gmane.lisp.guile.bugs Subject: bug#57567: =?UTF-8?Q?=E2=80=98primitive-load=E2=80=99?= should open files with O_CLOEXEC Date: Sat, 03 Sep 2022 21:24:12 +0200 Message-ID: <877d2ktg6b.fsf@inria.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="19603"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.1 (gnu/linux) To: 57567@debbugs.gnu.org Original-X-From: bug-guile-bounces+guile-bugs=m.gmane-mx.org@gnu.org Sat Sep 03 21:25:10 2022 Return-path: Envelope-to: guile-bugs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oUYlQ-0004r5-FX for guile-bugs@m.gmane-mx.org; Sat, 03 Sep 2022 21:25:08 +0200 Original-Received: from localhost ([::1]:38000 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oUYlP-0001sh-BK for guile-bugs@m.gmane-mx.org; Sat, 03 Sep 2022 15:25:07 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:56934) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oUYlK-0001rH-Fg for bug-guile@gnu.org; Sat, 03 Sep 2022 15:25:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:54375) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oUYlK-0003En-2a for bug-guile@gnu.org; Sat, 03 Sep 2022 15:25:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oUYlJ-0008T1-TO for bug-guile@gnu.org; Sat, 03 Sep 2022 15:25:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Sat, 03 Sep 2022 19:25:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 57567 X-GNU-PR-Package: guile X-Debbugs-Original-To: bug-guile@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.166223305732491 (code B ref -1); Sat, 03 Sep 2022 19:25:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 3 Sep 2022 19:24:17 +0000 Original-Received: from localhost ([127.0.0.1]:43074 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oUYkb-0008Ry-En for submit@debbugs.gnu.org; Sat, 03 Sep 2022 15:24:17 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:55210) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oUYkZ-0008Rq-Fd for submit@debbugs.gnu.org; Sat, 03 Sep 2022 15:24:15 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:45490) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oUYkZ-0001q8-Aj for bug-guile@gnu.org; Sat, 03 Sep 2022 15:24:15 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:34328) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oUYkZ-0003CB-1q for bug-guile@gnu.org; Sat, 03 Sep 2022 15:24:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:Subject:To:From:in-reply-to: references; bh=hAkvekQNjnBaWZcsbk0hgrFttPBHApCpwxvfplvUNbo=; b=d6XC3a0LChxA6/ EDxofgAeXc/qZbws5/TjSJOpIQ7jQSwpFeXmI5mr4lim/hzb920bpwEl/9NIxky32A9YwLYXCtfpc yGmzX3AC9PrAzjXkH+FNSIXZ7gy0MVNhwlfeFphjt42M+FWezR9A4YbGuR+38VwkHESg1UEke1odd sLcIdhvFB9HJqYiU3qboxYQovoBSBUl1Iks9p5tNb9guHpV7NOwzhvCQiO5pI4Pp8X+D+ZnfQPd0n RHNspZ66tTV2ohHPUdze9ZKV+kaiSyscCOqfqgrakZMBdXxw9zfH3+anry+d7qkiTETYTnx5tHWAC jq8tCbqXdSZSeInd5tBg==; Original-Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201]:59758 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oUYkY-0000HR-IP for bug-guile@gnu.org; Sat, 03 Sep 2022 15:24:14 -0400 X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: Septidi 17 Fructidor an 230 de la =?UTF-8?Q?R=C3=A9volution, ?= jour de la =?UTF-8?Q?Card=C3=A8re?= 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 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-guile@gnu.org List-Id: "Bug reports for GUILE, GNU's Ubiquitous Extension Language" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guile-bounces+guile-bugs=m.gmane-mx.org@gnu.org Original-Sender: "bug-guile" Xref: news.gmane.io gmane.lisp.guile.bugs:10360 Archived-At: Hi, Currently =E2=80=98primitive-load=E2=80=99 opens files without O_CLOEXEC: port =3D scm_open_file_with_encoding (filename, scm_from_latin1_string ("r"), SCM_BOOL_T, /* guess_encoding */ scm_from_latin1_string ("UTF-8")); We should fix that; here=E2=80=99s an example where it shows: --8<---------------cut here---------------start------------->8--- $ guix shell bash -- sh -c 'ls -l /proc/$$/fd' total 0 lrwx------ 1 ludo users 64 Sep 3 21:20 0 -> /dev/pts/0 lrwx------ 1 ludo users 64 Sep 3 21:20 1 -> /dev/pts/0 lrwx------ 1 ludo users 64 Sep 3 21:20 2 -> /dev/pts/0 lr-x------ 1 ludo users 64 Sep 3 21:20 3 -> /proc/9563/fd lr-x------ 1 ludo users 64 Sep 3 21:20 5 -> /gnu/store/4qbqaa4dgr2fwjjs9i2= naqrd0djrcnw3-guix-command $ head -1 $(type -P guix) #!/gnu/store/9z95jms1r801z1kxpiq5xw594cxaw5jx-guile-wrapper/bin/guile --no-= auto-compile --8<---------------cut here---------------end--------------->8--- For a proper fix, one possibility would be to first augment =E2=80=98scm_i_mode_to_open_flags=E2=80=99 to recognize some letter for O_C= LOEXEC. In glibc, fopen(3) uses =E2=80=9Ce=E2=80=9D for that. Thoughts? Ludo=E2=80=99.