bug-bash
[Top][All Lists]
Advanced

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

Re: fd leak with {fd}>


From: Chet Ramey
Subject: Re: fd leak with {fd}>
Date: Mon, 26 Nov 2012 08:35:41 -0500
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:16.0) Gecko/20121026 Thunderbird/16.0.2

On 11/22/12 5:18 PM, Sam Liddicott wrote:

>     > As an interesting aside it seems not to be possible to close the FD
>     within
>     > the block either:
>     >
>     > { echo $fd ; eval exec "$fd>&-" ; } {fd}> /dev/null
> 
>     But this is not.  There should be a way to ensure the fd's survival while
>     allowing it to be closed within the block.  I will fix this for the next
>     version.
> 
> 
> It may well be closed within the block; I meant to state that externally it
> was visible despite the internal close.

Part of the rationale for the {x} redirection syntax is to give the user
a handle to the file descriptor and allow him to maniuplate it, so it
seems like the shell should honor the user's close request.  I think the
shell should not close it when the block exits, so the user can close it
when he chooses.

Chet

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



reply via email to

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