hi there
Strange title? Well yes...it is strange..."touch" is driving me nutts! Trying to set the access / modified date by a bash script. For a certain time everything works well with all files. After point x the code works only for some files, for others it doesn't. After looking for the cause, I saw that it is a permission issue..so I checked on which permission the access time is no longer editable.
For me, that doesn't make sense at all. I'm logged in as root and am owner of the file. I also don't know what cause that problem....after a reboot, everything works well again. Had anybody already the same problem? What could cause this strange behavior?
The command:
root@owned:/home/foobar# touch -t 201110101212 test
The output:
if it works:
root@owned:/home/foobar# stat -c "atime: %x mtime: %y ctime: %z" test
atime: 2011-10-10 12:12:00.000000000 +0200
mtime: 2011-10-10 12:12:00.000000000 +0200
ctime: 2011-07-13 14:34:04.383508864 +0200
else:
atime: 2011-07-13 14:30:21.398403162 +0200
mtime: 2011-10-10 12:12:00.000000000 +0200
ctime: 2011-07-13 14:30:20.386398151 +0200
List of permissions where it work / doesn't work:
-r-------- 1 root root 5 2011-07-13 14:11 test //ATIME & MTIME
-rw------- 1 root root 5 2011-10-10 12:11 test //ATIME & MTIME
-rwx------ 1 root root 5 2011-10-10 12:12 test //ATIME & MTIME
----r----- 1 root root 5 2011-10-10 12:14 test //ATIME & MTIME
----rw---- 1 root root 5 2011-10-10 12:15 test //ATIME & MTIME
----rwx--- 1 root root 5 2011-10-10 12:16 test //ATIME & MTIME
-------r-- 1 root root 5 2011-07-13 14:23 test //MTIME
-------rw- 1 root root 5 2011-07-13 14:25 test //MTIME
-------rwx 1 root root 5 2011-07-13 14:25 test //MTIME
-r-----r-- 1 root root 5 2011-07-13 14:27 test //MTIME
-rw----rw- 1 root root 5 2011-07-13 14:28 test //MTIME
-rw-r----- 1 root root 5 2011-10-10 12:10 test //ATIME & MTIME
-rw-r--r-- 1 root root 5 2011-07-13 14:30 test //ATIME
The influence are the "other" rights. As soon as it is readable for "other", the modified time is no longer editable. Again, this happens only after....well...after point x....
OS/Kernel
Linux owned 2.6.38-8-generic #42-Ubuntu SMP Mon Apr 11 03:31:50 UTC 2011 i686 i686 i386 GNU/Linux
best,
/dev/blah