[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: File descriptor leak in nested functions
From: |
Chet Ramey |
Subject: |
Re: File descriptor leak in nested functions |
Date: |
Sat, 17 Apr 2010 23:17:33 -0400 |
User-agent: |
Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.1.7) Gecko/20100111 Lightning/1.0b1 Thunderbird/3.0.1 |
On 4/15/10 6:58 PM, Charles Duffy wrote:
> The provided reproducer was unnecessarily complicated. The following also
> reproduces the issue:
>
> function get_fd_count() {
> local fds
> cd /proc/$$/fd; fds=( * ) # avoid a StackOverflow source colorizer bug
> echo "${#fds[@]}"
> }
>
> function fd_leak_func() {
> while : ; do
> echo ">> Current FDs: $(get_fd_count)"
> read retval new_state < <(set +e; new_state=$(echo
> foo); retval=$?; printf "%d %s\n" $retval $new_state)
> done
> }
>
> fd_leak_func
>
>
> Running the contents of fd_leak_func at top level, by contrast, does not
> reproduce the bug.
Thanks for the report. This will be fixed in the next release of bash.
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/