unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#33564: Incorrect path canonicalisation
@ 2018-12-01 20:04 Mattias Andrée
  2018-12-01 20:27 ` Andreas Schwab
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Mattias Andrée @ 2018-12-01 20:04 UTC (permalink / raw)
  To: 33564

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





^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2019-08-21  2:26 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-12-01 20:04 bug#33564: Incorrect path canonicalisation Mattias Andrée
2018-12-01 20:27 ` Andreas Schwab
2018-12-01 20:35   ` Mattias Andrée
2018-12-01 20:55     ` Andreas Schwab
2018-12-01 21:14       ` Mattias Andrée
2018-12-02  6:27         ` Eli Zaretskii
2018-12-01 20:30 ` Eli Zaretskii
2019-08-21  2:26 ` Stefan Kangas

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).