[Top][All Lists]

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

Re: Leak in BASH "named" file descriptors?

From: Chet Ramey
Subject: Re: Leak in BASH "named" file descriptors?
Date: Thu, 28 Jan 2016 13:33:26 -0500
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:38.0) Gecko/20100101 Thunderbird/38.5.1

On 1/27/16 1:18 PM, Mathieu Patenaude wrote:
> Hi,
> When using "named" file descriptors inside a function, the file descriptors
> are not automatically un-linked when the function returns, but when using
> regular "numbered" file descriptors they are automatically "destroyed".

Yes.  That's the intent.  The idea is that if you assign a variable, you
have a `handle' on the file descriptor and can manage it yourself.  It's
closer to how open(2) works: the system selects a descriptor and tells you
what it is, and it's up to you to track it from there.

In that sense, variables assigned by redirections are similar to how
`exec' makes redirections persist beyond a single command.

(I thought this had come up before, but I couldn't find that particular


``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    address@hidden    http://cnswww.cns.cwru.edu/~chet/

reply via email to

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