Feh / nocache

minimize caching effects
BSD 2-Clause "Simplified" License
554 stars 53 forks source link

nocache causes the file modification time to be updated #25

Closed sbrl closed 9 years ago

sbrl commented 9 years ago

If I have a file like this:

-rw-r--r-- 1 root root   23 Aug 26 10:13 test

And a script like this:

#!/usr/bin/env bash
nocache -n 2 cat test

Running the script causes the test file to have it's time of last modification updated. Here's what it looks like after running the above:

-rw-r--r-- 1 root root   23 Sep  2 10:15 test

I noticed this after my backup script ran I found myself with a whole filesystem with the same last modified time on it :P

Feh commented 9 years ago

I can’t reproduce this:

$ echo $RANDOM > /tmp/file
$ touch -t 200801010000 /tmp/file

# Modification time: Jan 1 2008
$ ll /tmp/file
-rw------- 1 feh feh 6 Jan  1  2008 /tmp/file

# Access time: Jan 1 2008
$ ll -u /tmp/file
-rw------- 1 feh feh 6 Jan  1  2008 /tmp/file

$ nocache -n 2 cat /tmp/file
26896

# Modification time: unchanged
$ ll /tmp/file
-rw------- 1 feh feh 6 Jan  1  2008 /tmp/file

Please make sure you don’t have the -u flag to ls supplied by default, which would display access time.

If you are sure this is a bug, please supply more information, in particular: how to reproduce. Thank you.

sbrl commented 9 years ago

Yep, I had the -u flag supplied by default :P

Thanks for the help anyway :)