From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11596 invoked by alias); 7 Jul 2016 02:00:27 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 21739 Received: (qmail 13504 invoked from network); 7 Jul 2016 02:00:26 -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: Thu, 07 Jul 2016 02:00:22 +0000 From: Daniel Shahaf To: Roland Eggner Cc: zsh-users@zsh.org Subject: Re: realpath(3), symlinks, '..' components, and the ':A' word modifier Message-ID: <20160707020022.GA6364@tarsus.local2> References: <20160705045756.GC11492@tarsus.local2> <20160705125430.GA29959__3886.85245202414$1467723835$gmane$org@mobil.systemanalysen.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20160705125430.GA29959__3886.85245202414$1467723835$gmane$org@mobil.systemanalysen.net> User-Agent: Mutt/1.5.23 (2014-03-12) 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