[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#22185: Operation not permitted for `touch -d` on 777 file
From: |
Assaf Gordon |
Subject: |
bug#22185: Operation not permitted for `touch -d` on 777 file |
Date: |
Wed, 16 Dec 2015 13:27:50 -0500 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 |
tag 22185 notabug
close 22185
stop
Additional information:
On 12/16/2015 01:19 PM, Assaf Gordon wrote:
Hello,
On 12/16/2015 09:39 AM, Silvio Ricardo Cordeiro wrote:
The following code fails whenever the specified date is different from `now`:
<...>
I see no description of that in the documentation, and it just seems wrong. If
other users have full control over the file (and surrounding directory),
shouldn't they be able to change its date?
<...>
If the above is correct, then this is not a bug in coreutils' touch per-se, but
a linux kernel behavior.
I should've looked first at the man page... which states it clearly:
from 'man 2 utimesnsat' :
====
Permissions requirements
To set both file timestamps to the current time (i.e., times is NULL,
or both tv_nsec fields
specify UTIME_NOW), either:
1. the caller must have write access to the file;
2. the caller's effective user ID must match the owner of the file; or
3. the caller must have appropriate privileges.
To make any change other than setting both timestamps to the current
time (i.e., times is not
NULL, and both tv_nsec fields are not UTIME_NOW and both tv_nsec
fields are not UTIME_OMIT),
either condition 2 or 3 above must apply.
====
Which means write access (condition 1) is not sufficient to set the time to
anything except 'now'.
Therefor it is not a coreutils bug - but a linux kernel requirement.
As such, I'm making this as 'closed' - but discussion is welcomed to continue.
regards,
- assaf