bug-bash
[Top][All Lists]
Advanced

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

Re: Memory leak in subshell + read before bash 4.4


From: Adrien Mahieux
Subject: Re: Memory leak in subshell + read before bash 4.4
Date: Sat, 4 Nov 2017 02:18:40 +0100

On Sat, Nov 4, 2017 at 1:18 AM, Chet Ramey <chet.ramey@case.edu> wrote:
> On 11/3/17 6:01 PM, Adrien Mahieux wrote:
>> Hello,
>>
>> I think I've found a bug in the loop management. Maybe it's an
>> expected behavior (didn't find any related topic on the manpages) but
>> it's annoying in long-running scripts.
>>
>> The leak is triggered by this idiom (wether or not jobcontrol + lastpipe) :
>> cmd | read var
>>
>> but not by this one :
>> read var < <(cmd)
>>
>> Tested with :
>> - bash-4.2.46-19.el7.x86_64
>> - bash-4.3.42-5.fc23.x86_64
>> - bash-4.3-48.x86_64
>>
>> From the version tested, it was fixed in version 4.4 (tested 4.4-beta)
>> Do you have an idea of the commit that fixed this behavior, so the fix
>> can be backported to older versions ?
>
> Have you tried bisecting the devel git branch?

Didn't have time, nor tried. That's my first bisect \o/

85ec0778f9d778e1820fb8c0e3e996f2d1103b45 : no leak
1a088fee7368a8620e0bf64c481ac0bc5dddddcf : leak


This modification from 85ec0778 did fix the leak in 1a088fee73 :

-  if ((dflags & DEL_NOBGPID) == 0)
+  if ((dflags & DEL_NOBGPID) == 0 && (temp->flags &
(J_ASYNC|J_FOREGROUND)) == J_ASYNC)


Can you check and backport it ?

Cheers.



reply via email to

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