[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#8035: Processing of .. in a file path after going thru symlink
From: |
Eli Zaretskii |
Subject: |
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@gnus.org>
> Date: Thu, 26 Aug 2021 18:29:54 +0200
> Cc: 8035@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.
bug#8035: Processing of .. in a file path after going thru symlink, Andreas Schwab, 2021/08/26