GNU bug report logs - #8035
Processing of .. in a file path after going thru symlink

Previous Next

Package: emacs;

Reported by: spucci <slpnabble <at> blackberry-hill.com>

Date: Mon, 14 Feb 2011 05:50:03 UTC

Severity: normal

Tags: moreinfo

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


Message #22 received at 8035 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 8035 <at> debbugs.gnu.org, slpnabble <at> blackberry-hill.com
Subject: Re: bug#8035: Processing of .. in a file path after going thru symlink
Date: Thu, 26 Aug 2021 19:44:11 +0300
> From: Lars Ingebrigtsen <larsi <at> gnus.org>
> Date: Thu, 26 Aug 2021 18:29:54 +0200
> Cc: 8035 <at> debbugs.gnu.org
> 
> (file-exists-p "/tmp/comp/src/subdir/../foo.c")
> => nil
> (file-truename "/tmp/comp/src/subdir/../foo.c")
> => "/tmp/comp/dest/foo.c"
> (file-exists-p (file-truename "/tmp/comp/src/subdir/../foo.c"))
> => t
> 
> And this is because:
> 
> static Lisp_Object
> check_file_access (Lisp_Object file, Lisp_Object operation, int amode)
> {
>   file = Fexpand_file_name (file, Qnil);
> 
> I'm guessing it's calling expand-file-name here to resolve "~"?

No, because we always must call expand-file-name before invoking a
libc function that accesses files -- to support file names relative to
their buffer's default-directory.

> I think that `expand-file-name' call in check_file_access should be
> changed to something that just does the "~" expansion.

I don't think we can do that, for the reason explained above.




This bug report was last modified 3 years and 270 days ago.

Previous Next


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