bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bad leaks file fd to child processes


From: Alexey
Subject: Re: Bad leaks file fd to child processes
Date: Mon, 28 Nov 2022 14:39:58 +0400
User-agent: Mail UserAgent

On 2022-11-28 14:20, Koichi Murase wrote:
2022年11月28日(月) 19:06 Alexey via Bug reports for the GNU Bourne Again
SHell <bug-bash@gnu.org>:
But we use the fact tat bash doesn't close FD for example to preliminary
open log file for utility that we will `exec' later.
Unfortunately bash doesn't provide any fcntl() mechanism to control FD
flags.
It'll be great to have ability to manage CLOEXEC or any other FD flags
from the script.

There is a loadable builtin `fdflags' to do that. If the loadable
builtin is installed (e.g. at /usr/lib/bash/fdflags), we can do
something like

enable -f /usr/lib/bash/fdflags fdflags
fdflags -s +cloexec <fd>

--
Koichi

Many thanks for the example.
But, I still have a lot of prod with bash 4.4 (I guess I could build fdflags for 4.4 myself)

Regards,
Alexey



reply via email to

[Prev in Thread] Current Thread [Next in Thread]