GNU bug report logs - #33564
Incorrect path canonicalisation

Previous Next

Package: emacs;

Reported by: Mattias Andrée <maandree <at> kth.se>

Date: Sat, 1 Dec 2018 20:06:02 UTC

Severity: normal

Tags: notabug

Done: Stefan Kangas <stefan <at> marxist.se>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Stefan Kangas <stefan <at> marxist.se>
Cc: tracker <at> debbugs.gnu.org
Subject: bug#33564: closed (Incorrect path canonicalisation)
Date: Wed, 21 Aug 2019 02:28:02 +0000
[Message part 1 (text/plain, inline)]
Your message dated Wed, 21 Aug 2019 04:26:51 +0200
with message-id <CADwFkm=OBZXbh_O1e7hSQAaTvkg=6Qt78HNrGcoMrNONq=VgyA <at> mail.gmail.com>
and subject line Re: bug#33564: Incorrect path canonicalisation
has caused the debbugs.gnu.org bug report #33564,
regarding Incorrect path canonicalisation
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)


-- 
33564: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=33564
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Mattias Andrée <maandree <at> kth.se>
To: bug-gnu-emacs <at> gnu.org
Subject: Incorrect path canonicalisation
Date: Sat, 1 Dec 2018 21:04:50 +0100
Emacs 26.1 removes ..'s incorrectly from file names.
Emacs removes the directory in front the .. rather than
getting its parent directory.

Example:

	cd
	mkdir -p 1/2
	cd 1/2
	echo 3 > ../../3
	ln -s ~ 4
	echo 5 > 5
	emacs 4/../5 # works, but shouldn't
	emacs 4/../$USER/3 # does not works, should

On Linux, the proper way to get the canonical path
for a file with the file descriptor $fd:

	stat(3) /dev/fd/$fd
	p := readlink(3) /dev/fd/$fd
	if (st_nlinks != 0) {
		stat(3) /dev/fd/$fd
		if (st_nlinks == 0) {
			p := readlink(3) /dev/fd/$fd
			remove " (deleted)" from the end of p
		}
	} else {
		remove " (deleted)" from the end of p
	}
	canonical path is p


[Message part 3 (message/rfc822, inline)]
From: Stefan Kangas <stefan <at> marxist.se>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Mattias Andrée <maandree <at> kth.se>,
 33564-done <at> debbugs.gnu.org
Subject: Re: bug#33564: Incorrect path canonicalisation
Date: Wed, 21 Aug 2019 04:26:51 +0200
Eli Zaretskii <eliz <at> gnu.org> writes:

> tags 33564 notabug
> thanks
>
>> Date: Sat, 1 Dec 2018 21:04:50 +0100
>> From: Mattias Andrée <maandree <at> kth.se>
>>
>>     cd
>>     mkdir -p 1/2
>>     cd 1/2
>>     echo 3 > ../../3
>>     ln -s ~ 4
>>     echo 5 > 5
>>     emacs 4/../5 # works, but shouldn't
>>     emacs 4/../$USER/3 # does not works, should
>
> This is by design: expand-file-name doesn't follow symlinks.  It's
> documented not to do that: see the doc string and the ELisp manual.
>
>> On Linux, the proper way to get the canonical path
>> for a file with the file descriptor $fd:
>
> expand-file-name doesn't aim at yielding the canonical file name in
> that sense.

This was tagged notabug in December 2018; I'm now also closing this bug report.

Thanks,
Stefan Kangas


This bug report was last modified 5 years and 279 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.