[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Add NOFOLLOW flag to set-file-modes etc.

From: Paul Eggert
Subject: Add NOFOLLOW flag to set-file-modes etc.
Date: Wed, 19 Feb 2020 16:51:02 -0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0

Bug#39683 proposes a patch to add an optional nofollow argument to set-file-modes and related functions; if this flag is t, the functions do not follow symbolic links. This should help Emacs avoid race conditions where it mistakenly changes the permissions of an arbitrary victim file that happens to be the target of a recently-created symlink.

Since the implementation of this new argument uses the POSIX fchmodat function with the AT_SYMLINK_NOFOLLOW flag, some work may be needed in the Microsoft porting code to emulate fchmodat.

Also, packages like Tramp that have a file-modes or set-file-modes wrapper should be updated if possible to support the new optional flag if it is given. For now, the patch leaves these as FIXME comments.

This is designed to be an upward-compatible change, even though the default, traditional behavior of following the symbolic link is typically more dangerous than the new option of not following the link.

Comments welcome.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]