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 21781
- From: Vincent Lefevre <vincent@xxxxxxxxxx>
- To: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- Subject: Re: realpath(3), symlinks, '..' components, and the ':A' word modifier
- Date: Wed, 20 Jul 2016 14:44:03 +0200
- Cc: zsh-users@xxxxxxx
- In-reply-to: <160707102031.ZM23611@torch.brasslantern.com>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mail-followup-to: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>, zsh-users@xxxxxxx
- 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> <20160707020022.GA6364@tarsus.local2> <160707102031.ZM23611@torch.brasslantern.com>
On 2016-07-07 10:20:31 -0700, Bart Schaefer wrote:
> On Jul 7, 2:00am, Daniel Shahaf wrote:
> } To everyone who asked about compatibility: under the existing semantics
> } of :A, "$foo" and "$foo:A" might denote different files.
>
> But that implies that "$foo" and "$foo:a" might also denote different
> files, so why is *that* a useful transformation?
IMHO, the only useful transformation is to the same file (the usual
realpath).
Note that some scripts may use ":A" thinking that one would get the
same file. So, changing the behavior may also fix these scripts!
> } 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).
>
> There's no letter to use that won't in some way be confuse-able with a
> parameter expansion flag, so here are some ideas:
>
> :L - mnemonic "link" - corresponds to "ls -L"
> :R - mnemonic "real" - think of realpath()
> :P - mnemonic "path" - the other half of realpath(), and also in a
> certain way comparable to the (P) parameter
> flag in that it interprets the path name as
> a further path name and yields the file at
> the other path
If you do not want to change the behavior of ":A", then ":R" is
probably the best one. ":L" would definitely be a bad choice as
it could be confused with "realpath -L" from GNU coreutils, which
does the opposite (the default being "realpath -P", so using ":P"
could be OK too, where "P" means "physical").
In any case, the documentation should be clarified.
--
Vincent Lefèvre <vincent@xxxxxxxxxx> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)
Messages sorted by:
Reverse Date,
Date,
Thread,
Author