bug-bash
[Top][All Lists]
Advanced

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

Re: fd leak with {fd}>


From: Sam Liddicott
Subject: Re: fd leak with {fd}>
Date: Thu, 22 Nov 2012 22:18:50 +0000

On Thu, Nov 22, 2012 at 7:15 PM, Chet Ramey <chet.ramey@case.edu> wrote:

> On 11/16/12 10:47 AM, Sam Liddicott wrote:
> > Repeated executions of: { echo $fd ; } {fd}> /dev/null
> > will emit different numbers, indicating that fd is not closed when the
> > block completes.
>
> This is intentional.  Having been given a handle to the file descriptor,
> the shell programmer is assumed to be able to manage it himself.
>
> > 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.

So this is probably a double no-bug

thanks for your attention

Sam


reply via email to

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