unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
* bug#57567: ‘primitive-load’ should open files with O_CLOEXEC
@ 2022-09-03 19:24 Ludovic Courtès
  2022-09-07 16:03 ` Ludovic Courtès
  0 siblings, 1 reply; 2+ messages in thread
From: Ludovic Courtès @ 2022-09-03 19:24 UTC (permalink / raw)
  To: 57567

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’.





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-09-07 16:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-03 19:24 bug#57567: ‘primitive-load’ should open files with O_CLOEXEC Ludovic Courtès
2022-09-07 16:03 ` Ludovic Courtès

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).