From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8821 invoked by alias); 24 Sep 2015 05:18:15 -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: 36608 Received: (qmail 27310 invoked from network); 24 Sep 2015 05:18:15 -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 autolearn=ham autolearn_force=no version=3.4.0 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:message-id:date:in-reply-to:comments :references:to:subject:mime-version:content-type; bh=fkeXZ1HwU6gDo3rfjKQ+n3BTCW2X0IV54p2fl++xr70=; b=E9CpnmlYTVZsdjhyrWbIUsuzEfBxxQ88uX4RaVen4g121QtOselPMNl8g591dXmiKx 0onhmTHxc8mt0QD87ht1iYlBgPal6P8HUSM4kkW9N7aMIAbR63D7mMETA/PFuv4TqaSf 0JV+8mTJS2zMs8Uto/ee17qc/La3lK5pzklLPPgpP+3nrhdDad38nZUWf6G42V9m/84i k3QnltBUWV8qqzK5vNk/dpmOhFG/13vI7gUjk67YVjA867LxCeUeZ8qrrGN/ZBwJUMXO oPvGsjlZMX+M97VdEZ+NhbLswrFD8+pUeljDU6Sx0VScVESBK0RvjPn01QoG22OmaRz3 FZiA== X-Gm-Message-State: ALoCoQmJonAwYRWV7PgWYvcHWv2YPOVEoIMvSgYSm1/VnG6pbWpWGwmL9X2llMB/6Z88wGQU6zsY X-Received: by 10.60.134.40 with SMTP id ph8mr10899513oeb.58.1443071893249; Wed, 23 Sep 2015 22:18:13 -0700 (PDT) From: Bart Schaefer Message-Id: <150923221810.ZM32365@torch.brasslantern.com> Date: Wed, 23 Sep 2015 22:18:10 -0700 In-Reply-To: Comments: In reply to Mikael Magnusson "Re: PATCH: Fix leak during Y shortcircuit glob qualifier" (Sep 24, 5:38am) References: <1443045290-26615-1-git-send-email-mikachu@gmail.com> <150923201201.ZM32285@torch.brasslantern.com> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh workers Subject: Re: PATCH: Fix leak during Y shortcircuit glob qualifier MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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.