zsh-workers
 help / color / mirror / code / Atom feed
From: Daniel Shahaf <d.s@daniel.shahaf.name>
To: zsh-workers@zsh.org
Subject: Re: [PATCH 2/3] Fix the ':A' word modifier on paths with '..' components.
Date: Mon, 13 Jun 2016 08:52:18 +0000	[thread overview]
Message-ID: <20160613085218.GA9572@tarsus.local2> (raw)
In-Reply-To: <160612094916.ZM9751@torch.brasslantern.com>

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.
> 


  reply	other threads:[~2016-06-13  8:52 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-10 17:36 [PATCH 1/3] Tests: Add tests for the ':a' and ':A' modifiers Daniel Shahaf
2016-06-10 17:36 ` [PATCH 2/3] Fix the ':A' word modifier on paths with '..' components Daniel Shahaf
2016-06-10 18:54   ` Mikael Magnusson
2016-06-10 19:46     ` Bart Schaefer
2016-06-12 14:28       ` Daniel Shahaf
2016-06-12 16:49         ` Bart Schaefer
2016-06-13  8:52           ` Daniel Shahaf [this message]
2016-06-21  1:53             ` [PATCH v2 1/3] Tests: Add tests for the ':a' and ':A' modifiers Daniel Shahaf
2016-06-21  1:53               ` [PATCH v2 2/3] Fix the ':A' word modifier on paths with '..' components Daniel Shahaf
2016-06-21  3:08                 ` Mikael Magnusson
2016-06-25 16:28                   ` Daniel Shahaf
2016-06-25 16:47                     ` Mikael Magnusson
2016-06-27  0:20                       ` Daniel Shahaf
2016-06-28 14:48                         ` Bart Schaefer
2016-07-01  5:11                           ` Daniel Shahaf
2016-07-01 16:05                             ` Bart Schaefer
2016-07-03 20:20                               ` Peter Stephenson
2016-07-05  4:57                               ` Daniel Shahaf
2016-06-21  1:53               ` [PATCH v2 3/3] Clean up chabspath() [':a' word modifier] Daniel Shahaf
2016-06-10 17:36 ` [PATCH " Daniel Shahaf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160613085218.GA9572@tarsus.local2 \
    --to=d.s@daniel.shahaf.name \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).