From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4615 invoked by alias); 24 Sep 2015 18:55:34 -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: 36621 Received: (qmail 2158 invoked from network); 24 Sep 2015 18:55:33 -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=C+BcBWGEwaDI7ig7XQGlHQYtuLjUnN5ms0fej1Q/8WE=; b=Yg5FUct1eP80uOfRhGfM4QmE9nD+5MSADDnXymmDB8cfMt28o2i1SSzkT/lbMJICs4 xYEcTYqD6MA7nCdDQmblSZKwEmV741kYURH21K2Iy0XITHmB3DzGYKesPcusS90h+d/H ssydz2vRcvUxjrGGN/PlNk5rAz+NQsiclYVudtImPJCjGgJAMCxrdz067kMYSsUGp2qK gHNz3ZEbjk9oxwHd4KAjsKqCskF72k4AmRBb2oukpst4j3lQ/S2BFkWvN2rtADqbiquP ER/B1NI3r4qn2byqsb4CJ0E8bNU0an8jsLNTkRQQMlYzIphmrfy9rG7xyihl0BLBAi03 aBtg== MIME-Version: 1.0 X-Received: by 10.140.145.145 with SMTP id 139mr1722574qhr.100.1443120929519; Thu, 24 Sep 2015 11:55:29 -0700 (PDT) In-Reply-To: <150923221810.ZM32365@torch.brasslantern.com> References: <1443045290-26615-1-git-send-email-mikachu@gmail.com> <150923201201.ZM32285@torch.brasslantern.com> <150923221810.ZM32365@torch.brasslantern.com> Date: Thu, 24 Sep 2015 20:55:29 +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 7:18 AM, Bart Schaefer wrote: > On Sep 24, 5:38am, Mikael Magnusson wrote: > } > } % : ./*(-.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). > > Glancing at scanner() in glob.c and lchdir() in utils.c, it appears that > the working directory would only be changed if the full path to the target > directory is VERY long, i.e., does not fit in a PATH_MAX buffer. So it > probably is necessary to restore, but also probably really difficult to > construct an example actually goes through that code path. I've gone the safe route for now and only committed the closedir(lock) part. -- Mikael Magnusson