Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [PATCH 2/3] Fix the ':A' word modifier on paths with '..' components.
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.
>
Messages sorted by:
Reverse Date,
Date,
Thread,
Author