From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15295 invoked by alias); 24 Sep 2015 03:38:06 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 36607 Received: (qmail 6857 invoked from network); 24 Sep 2015 03:38:05 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=fFdaM7y4xSrOa+fZ1HbiWUc1Fk+pGAeeyG09xLMVutc=; b=RwgP8BoQhmm4kU1aLnJc1ECpLMqE0IHwrCfMzOrd4MFcWQHd0J28/0qS1VfO14tB72 IXw8hR8ge9RBBoc5a0g7voW/tQJFsjGfjklsmhs3MH5+M1rhXK5U4kbOZJUJEp96/91Z d3GUVPzEgwzz6iPK911Op98/6C8L69Gw+z3lLk9YQdXOmQ9T2slFRpyEMSTc7AM7AaY3 x1X3/UKZSVgbI1Ddyazkj1AQZD41vZQFodui8hr30cj5cLZRgYMMpuL9blKSKmCn9x6p Z7EMBY2PKIJoO58U1vJ8rtj2rDj2eanxxAN4rnwKSwOn2/2E7RU/4jIF0OFrSyYBmR5b 174A== MIME-Version: 1.0 X-Received: by 10.140.100.182 with SMTP id s51mr38977285qge.25.1443065883334; Wed, 23 Sep 2015 20:38:03 -0700 (PDT) In-Reply-To: <150923201201.ZM32285@torch.brasslantern.com> References: <1443045290-26615-1-git-send-email-mikachu@gmail.com> <150923201201.ZM32285@torch.brasslantern.com> Date: Thu, 24 Sep 2015 05:38:03 +0200 Message-ID: Subject: Re: PATCH: Fix leak during Y shortcircuit glob qualifier From: Mikael Magnusson To: Bart Schaefer Cc: zsh workers Content-Type: text/plain; charset=UTF-8 On Thu, Sep 24, 2015 at 5:12 AM, Bart Schaefer wrote: > On Sep 23, 11:54pm, Mikael Magnusson wrote: > } Subject: PATCH: Fix leak during Y shortcircuit glob qualifier > } > } The closedir(lock) is the leak I actually did see in usage, I have no > } idea if the other part is needed/harmful though. I'll commit just the > } closedir if nobody has any opinions. > > Since scanner() is being called recursively, it's not clear that the > recursive call won't have already done an equivalent restoredir() > in the first two "return" cases -- but I do suspect it's needed in > the case where the closedir(lock) plugs a leak. > > Is the current directory munged in the situation where you found a leak? Oops, I see that I forgot to include the actual test case in the message. I think I had it typed out in gmail and then decided to look into the code instead and forgot to put it in the git send-email. % : ./*(-.Y1N); ls -l /proc/$$/fd was my test case, so not much would happen to $PWD in that particular case. I tried */*/*(-.Y5N) instead now, and nothing untoward seemed to happen then either (without and with my patch, so no weird pwd changing or errors about double frees, respectively). -- Mikael Magnusson