From: Maxime Devos <maximedevos@telenet.be>
To: Marius Bakke <marius@gnu.org>, guile-devel <guile-devel@gnu.org>
Subject: Re: Preventing file descriptor leak to execl'd processes
Date: Sat, 06 Mar 2021 19:04:05 +0100 [thread overview]
Message-ID: <2fef0f8235c3dab7263dd1a38bea51d384414458.camel@telenet.be> (raw)
In-Reply-To: <87czwc5ijd.fsf@gnu.org>
[-- Attachment #1.1: Type: text/plain, Size: 665 bytes --]
On Sat, 2021-03-06 at 17:55 +0100, Marius Bakke wrote:
> Hello Guilers,
>
> [...]
>
> It works great, except that the script filename (/tmp/test-shell) has
> an open file descriptor which leaks into the new process:
>
> [...]
>
> I've managed to work around it by setting FD_CLOEXEC on it:
>
> [code using port-for-each and port-filename]
>
> But it seems heavy-handed. Is there an easier way to access the "script
> port"? Perhaps Guile itself should make it FD_CLOEXEC by default?
Easy way to access the ‘script port’: the Scheme procedure current-load-port.
Take a look at the output of the attached script.
Greetings,
Maxime
[-- Attachment #1.2: Type: text/x-scheme, Size: 423 bytes --]
#!/gnu/store/m5iprcg6pb5ch86r9agmqwd8v6kp7999-guile-3.0.5/bin/guile --no-auto-compile
!#
(eval-when (expand)
(pk 'expand (current-load-port) (fileno (current-load-port))))
(eval-when (load)
(pk 'load (current-load-port) (fileno (current-load-port))))
(eval-when (eval)
(pk 'eval (current-load-port) (fileno (current-load-port))))
(eval-when (compile)
(pk 'compile (current-load-port) (fileno (current-load-port))))
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]
next prev parent reply other threads:[~2021-03-06 18:04 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-06 16:55 Preventing file descriptor leak to execl'd processes Marius Bakke
2021-03-06 18:04 ` Maxime Devos [this message]
2021-03-12 21:22 ` Andy Wingo
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=2fef0f8235c3dab7263dd1a38bea51d384414458.camel@telenet.be \
--to=maximedevos@telenet.be \
--cc=guile-devel@gnu.org \
--cc=marius@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).