bug-bash
[Top][All Lists]
Advanced

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

Re: using exec to close a fd in a var crashes bash


From: Andreas Schwab
Subject: Re: using exec to close a fd in a var crashes bash
Date: Wed, 23 Aug 2023 16:53:48 +0200
User-agent: Gnus/5.13 (Gnus v5.13)

On Aug 23 2023, Greg Wooledge wrote:

> Then again... leaving an FD open in a shell script usually won't matter,
> because the script will exit, and that'll just take care of it.  The
> only times it actually matters are long-running bash processes -- either
> interactive shells, or some kind of weird daemon that's been implemented
> in bash for some reason -- or scripts that open and (fail to) close lots
> of temp FDs in a loop.

It will also cause the open FD to be passed to all subsequent commands,
and keeps a reference to the underlying file, which may affect EOF
processing if the file is a pipe.

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."



reply via email to

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