emacs-devel
[Top][All Lists]
Advanced

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

Re: master 9d626df: Add 'nofollow' flag to set-file-modes etc.


From: Paul Eggert
Subject: Re: master 9d626df: Add 'nofollow' flag to set-file-modes etc.
Date: Mon, 24 Feb 2020 16:25:51 -0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0

On 2/24/20 5:52 AM, Michael Albinus wrote:

However, for POSIX shells it is different. FreeBSD supports the "chmod
-h" argument, which implements nofollow. See
<https://www.freebsd.org/cgi/man.cgi?chmod>. I could check for this
argument, and use if possible.

But what shall I do if the target system runs GNU/Linux? chmod(1) does
not offer any comparable argument. Shall I simply ignore nofollow there?

How about something like this?

if (chmod -h works); then
  chmod -h MODE FILE
elif (test -h works); then
  test -h FILE && chmod MODE FILE
else
  chmod MODE FILE
fi

I'm suggesting 'test -h' rather than 'test -L' here because some ancient platforms support the former but not the latter.

Does anybody know, whether there are plans to extend chmod accordingly,
for example the version in coreutils? Or is there an alternative
possiblity to change the permission of the symbolic link?

It should be added to the coreutils TODO list, if it's not there already. On GNU/Linux symlink modes cannot be changed, for what it's worth, so chmod -h would merely be a safety feature.



reply via email to

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