unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: 57567@debbugs.gnu.org
Subject: bug#57567: ‘primitive-load’ should open files with O_CLOEXEC
Date: Sat, 03 Sep 2022 21:24:12 +0200	[thread overview]
Message-ID: <877d2ktg6b.fsf@inria.fr> (raw)

Hi,

Currently ‘primitive-load’ opens files without O_CLOEXEC:

    port = 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’s 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/4qbqaa4dgr2fwjjs9i2naqrd0djrcnw3-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
‘scm_i_mode_to_open_flags’ to recognize some letter for O_CLOEXEC.  In
glibc, fopen(3) uses “e” for that.

Thoughts?

Ludo’.





             reply	other threads:[~2022-09-03 19:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-03 19:24 Ludovic Courtès [this message]
2022-09-07 16:03 ` bug#57567: ‘primitive-load’ should open files with O_CLOEXEC Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=877d2ktg6b.fsf@inria.fr \
    --to=ludo@gnu.org \
    --cc=57567@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).