From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=0.3 required=5.0 tests=MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE,RDNS_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 Received: (qmail 26613 invoked from network); 26 Mar 2020 00:39:54 -0000 Received-SPF: pass (primenet.com.au: domain of zsh.org designates 203.24.36.2 as permitted sender) receiver=inbox.vuxu.org; client-ip=203.24.36.2 envelope-from= Received: from unknown (HELO primenet.com.au) (203.24.36.2) by inbox.vuxu.org with ESMTP; 26 Mar 2020 00:39:54 -0000 Received: (qmail 13913 invoked by alias); 26 Mar 2020 00:39:44 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: List-Unsubscribe: X-Seq: 45621 Received: (qmail 1178 invoked by uid 1010); 26 Mar 2020 00:39:44 -0000 X-Qmail-Scanner-Diagnostics: from out2-smtp.messagingengine.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.102.2/25758. spamassassin: 3.4.2. Clear:RC:0(66.111.4.26):SA:0(-2.6/5.0):. Processed in 5.10116 secs); 26 Mar 2020 00:39:44 -0000 X-Envelope-From: d.s@daniel.shahaf.name X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: none (ns1.primenet.com.au: domain at daniel.shahaf.name does not designate permitted sender hosts) X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedugedrudehhedgvddvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvffukfgjfhfogggtgfesthhqtddtredtjeenucfhrhhomhepffgrnhhi vghlucfuhhgrhhgrfhcuoegurdhssegurghnihgvlhdrshhhrghhrghfrdhnrghmvgeqne cukfhppeejledrudejiedruddvhedrvdefvdenucevlhhushhtvghrufhiiigvpedtnecu rfgrrhgrmhepmhgrihhlfhhrohhmpegurdhssegurghnihgvlhdrshhhrghhrghfrdhnrg hmvg X-ME-Proxy: Date: Thu, 26 Mar 2020 00:38:59 +0000 From: Daniel Shahaf To: Stephane Chazelas Cc: Zsh hackers list Subject: Re: [bug] :P modifier and symlink loops Message-ID: <20200326003859.44643c9d@tarpaulin.shahaf.local2> In-Reply-To: <20200321195048.7c49a291@tarpaulin.shahaf.local2> References: <20200111170047.ifjsdd5lfeksqyaa@chaz.gmail.com> <20200201175740.lma5dxgwufk6fpeg@chazelas.org> <20200202081021.7c8aab22@tarpaulin.shahaf.local2> <20200321195048.7c49a291@tarpaulin.shahaf.local2> X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Daniel Shahaf wrote on Sat, 21 Mar 2020 19:50 +0000: > Patch series attached. >=20 > I ended up implementing the second option =E2=80=94 keeping the trailing > components verbatim =E2=80=94 for several reasons: >=20 > 1. It's actually documented this way for :P. (xsymlink() has other > callers too, but I didn't check whether any of them specifically relied > on this behaviour.) >=20 > 2. After I made the code use the realpath() wrapper function, > chabspath(), rather than xsymlinks() (plural), that's the behaviour > I observed, and I didn't go out of my way to change it. >=20 > I suppose we could revisit :P's behaviour on symlink loops with > trailing components after the loop, but in the meantime, this at least > fixes the segfault. >=20 > WDYT? For the record, redirecting xsymlink() [singular] to use chrealpath() rather than xsymlinks() [plural] has a side effect: it will make the call fail immediately on systems that don't have realpath(3) available. The following places are affected: - setting $HOME - 'ztie' in the gbdm module - the :P modifier in history and parameter expansions - the helper functions findpwd(), getnameddir(), check_autoload(), dircache_set() I suppose that basically means realpath(3) is required. It was added in 4.4BSD (1995) and has been in POSIX since 2004 if not earlier, so I'll go ahead and push this series =E2=80=94 but if it breaks anything, holler. Cheers, Daniel