From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22542 invoked by alias); 13 Jun 2016 08:52:24 -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: 38673 Received: (qmail 23204 invoked from network); 13 Jun 2016 08:52:22 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) 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.1 Date: Mon, 13 Jun 2016 08:52:18 +0000 From: Daniel Shahaf To: zsh-workers@zsh.org Subject: Re: [PATCH 2/3] Fix the ':A' word modifier on paths with '..' components. Message-ID: <20160613085218.GA9572@tarsus.local2> References: <1465580184-3095-1-git-send-email-danielsh@tarsus.local2> <1465580184-3095-2-git-send-email-danielsh@tarsus.local2> <160610124623.ZM9598@torch.brasslantern.com> <20160612142843.GD10072@tarsus.local2> <160612094916.ZM9751@torch.brasslantern.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <160612094916.ZM9751@torch.brasslantern.com> User-Agent: Mutt/1.5.23 (2014-03-12) Bart Schaefer wrote on Sun, Jun 12, 2016 at 09:49:16 -0700: > On Jun 12, 2:28pm, Daniel Shahaf wrote: > } > } So, how about: > } > } - :a remains as it is today > } - :A when CHASE_DOTS set: same as :A today (resolves '..' first and > } symlinks second) > } - :A when CHASE_DOTS unset: as in the patch: equivalent to realpath(3) > } except that non-existing trailing path components are permitted > } > } Would that address everyone's concerns? > > I believe it would resolve most of mine. :A is a relatively new feature > so it would be understandable for it to evolve a bit. However, it is in > use in a few places already (e.g., expand-absolute-path, VCS_INFO_quilt, > zsh-mime-handler). I don't think any of those uses would be compromised > by this change, but if anyone wants to do a more thorough search for use > cases, don't be shy. > On the contrary: I expect that some existing usages are broken when their operand contains '..' path components; i.e., that existing usages assume :A is syntactic sugar for realpath(3). Anyway, I'll code up this alternative and post it once I have. Code-wise I think it boils down to adding « if (isset(CHASEDOTS)) chabspath(junkptr); » at the top of chrealpath(). Cheers, Daniel > } Note this doesn't use CHASE_LINKS at all, neither in :A nor in :a. > > Makes sense; :a plus CHASE_LINKS would be :A. >