Eth*_*her 2 spotlight filesystems procmail timestamp macos
我正在尝试确定在Mac OS X 中默认情况下如何维护文件访问时间,因为我正在尝试诊断我在新MBP Unibody(运行 Snow Leopard,10.6.2)中看到的一些奇怪行为:
症状(深入到似乎导致问题的特定行为):
通过测试,没有出现atimes
可以在文件系统中单独设置:
: [ether@tequila ~]$; touch test
: [ether@tequila ~]$; touch -m -t 200801010000 test2
: [ether@tequila ~]$; touch -a -t 200801010000 test3
: [ether@tequila ~]$; ls -l test*
-rw------- 1 ether staff 0 Dec 30 11:42 test
-rw------- 1 ether staff 0 Jan 1 2008 test2
-rw------- 1 ether staff 0 Dec 30 11:43 test3
: [ether@tequila ~]$; ls -lu test*
-rw------- 1 ether staff 0 Dec 30 11:42 test
-rw------- 1 ether staff 0 Dec 30 11:43 test2
-rw------- 1 ether staff 0 Dec 30 11:43 test3
Run Code Online (Sandbox Code Playgroud)
test2 文件是用 old 创建的mtime
,并且atime
设置为 now (因为它是一个新文件),这是正确的。但是, test3 是用旧的atime
.创建的,但在文件. 为了确保这不仅仅是新文件的行为,让我们修改一个旧文件:
: [ether@tequila ~]$; touch -a -t 200801010000 test
: [ether@tequila ~]$; ls -l test
-rw------- 1 ether staff 0 Dec 30 11:42 test
: [ether@tequila ~]$; ls -lu test
-rw------- 1 ether staff 0 Dec 30 11:45 test
Run Code Online (Sandbox Code Playgroud)
所以似乎 atime 不能明确设置(当提交mtime
或atime
修改时,它总是重置为“现在” )。
这是文件系统本身固有的东西,是可以改变的东西,还是我完全疯了,看错了地方?
附注。的输出mount
是:
: [ether@tequila ~]$; mount
/dev/disk0s2 on / (hfs, local, journaled)
devfs on /dev (devfs, local, nobrowse)
map -hosts on /net (autofs, nosuid, automounted, nobrowse)
map auto_home on /home (autofs, automounted, nobrowse)
Run Code Online (Sandbox Code Playgroud)
...和磁盘工具说驱动器是“Mac OS Extended (Journaled)”类型。
来自man touch
(在雪豹上):
Change the modification time of the file. The access time of the
file is not changed unless the -a flag is also specified.
Run Code Online (Sandbox Code Playgroud)
更重要的是,它对我来说很好用:
betelgeuse:tmp james$ touch test
betelgeuse:tmp james$ touch -m -t 200801010000 test2
betelgeuse:tmp james$ touch -a -t 200801010000 test3
betelgeuse:tmp james$ ls -lu test*
-rw-r--r-- 1 james wheel 0 31 Dec 07:41 test
-rw-r--r-- 1 james wheel 0 31 Dec 07:41 test2
-rw-r--r-- 1 james wheel 0 1 Jan 2008 test3
betelgeuse:tmp james$ ls -l test*
-rw-r--r-- 1 james wheel 0 31 Dec 07:41 test
-rw-r--r-- 1 james wheel 0 1 Jan 2008 test2
-rw-r--r-- 1 james wheel 0 31 Dec 07:41 test3
betelgeuse:tmp james$
Run Code Online (Sandbox Code Playgroud)
另一方面,当我在 ~ 中尝试同样的事情时,我得到和你一样的结果:
betelgeuse:~ james$ touch test
betelgeuse:~ james$ touch -m -t 200801010000 test2
betelgeuse:~ james$ touch -a -t 200801010000 test3
betelgeuse:~ james$ ls -lu test*
-rw-r--r-- 1 james staff 0 31 Dec 07:42 test
-rw-r--r-- 1 james staff 0 31 Dec 07:42 test2
-rw-r--r-- 1 james staff 0 31 Dec 07:42 test3
Run Code Online (Sandbox Code Playgroud)
区别?Spotlight 不索引 /tmp,但它索引 ~。我很确定您在这里看到的是在更改 atime 后聚光灯读取文件以对其进行索引 - 然后将 atime 设置回现在。
解决方案很简单:只需将您不想编入索引的目录添加到 Spotlight 不应编入索引的文件夹列表中。
为了确认情况确实如此,我创建了一个名为“nospotlight”的新目录,并告诉 Spotlight 不要将其编入索引。
betelgeuse:nospotlight james$ ls -l *
-rw-r--r-- 1 james staff 0 31 Dec 07:47 test
-rw-r--r-- 1 james staff 0 1 Jan 2008 test2
-rw-r--r-- 1 james staff 0 31 Dec 07:47 test3
betelgeuse:nospotlight james$ ls -lu *
-rw-r--r-- 1 james staff 0 31 Dec 07:47 test
-rw-r--r-- 1 james staff 0 31 Dec 07:47 test2
-rw-r--r-- 1 james staff 0 1 Jan 2008 test3
Run Code Online (Sandbox Code Playgroud)
授予 Spotlight 索引权限,几秒钟后:
betelgeuse:nospotlight james$ ls -lu *
-rw-r--r-- 1 james staff 0 31 Dec 07:48 test
-rw-r--r-- 1 james staff 0 31 Dec 07:48 test2
-rw-r--r-- 1 james staff 0 31 Dec 07:48 test3
Run Code Online (Sandbox Code Playgroud)
再一次,修改 mtime 会导致更新的 atime。
这绝对是聚光灯。
归档时间: |
|
查看次数: |
2467 次 |
最近记录: |