Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: realpath(3), symlinks, '..' components, and the ':A' word modifier
- X-seq: zsh-users 21739
- From: Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx>
- To: Roland Eggner <edvz2@xxxxxxxxxxxxxxxxxx>
- Subject: Re: realpath(3), symlinks, '..' components, and the ':A' word modifier
- Date: Thu, 07 Jul 2016 02:00:22 +0000
- Cc: zsh-users@xxxxxxx
- In-reply-to: <20160705125430.GA29959__3886.85245202414$1467723835$gmane$org@mobil.systemanalysen.net>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <20160705045756.GC11492@tarsus.local2> <20160705125430.GA29959__3886.85245202414$1467723835$gmane$org@mobil.systemanalysen.net>
Roland Eggner wrote on Tue, Jul 05, 2016 at 14:54:30 +0200:
> (1.2) Introduce a new modifier just for resolving
> filereferences (“symlinks”).
This seems like a reasonable way forward.
To everyone who asked about compatibility: under the existing semantics
of :A, «$foo» and «$foo:A» might denote different files. (Not just
different dirents, but different inodes, or possibly pathnames under
different mountpoints.) That does not seem like a useful transformation;
it has no equivalent in other languages (including but not limited
to C); it's different from other common modifiers ('cat $foo:h/$foo:t'
== 'cat $foo:r.$foo:e' == 'cat $foo' != 'cat `f $foo:A`'); and it makes
it impossible to use the :A modifier to resolve symlinks in arguments
that may contain '..' segments (so if someone thinks of :A as "zsh's
interface to realpath(3)", their code would be broken).
So yes, backwards compatibility is important; I'm normally the first to
speak in its favour. But when a behaviour has no obvious use-case, and
is unexpected to the point of possibly causing uses of it to be buggy,
then I do ask whether that documented behaviour is a feature or
a (documented) bug.
So, bottom line... it seems the consensus on both lists is not to risk
breaking compatibility here, and to add another :x modifier letter
instead (as suggested by Roland here and by pws/Bart in workers/38798 et
seq).
I will add that to my list, or if someone beats me to implementing it
that's fine too.
Thanks all,
Daniel
Messages sorted by:
Reverse Date,
Date,
Thread,
Author