• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Hard linked files cannot be modified
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Hard linked files cannot be modified


  • Subject: Re: Hard linked files cannot be modified
  • From: Hamish Allan <email@hidden>
  • Date: Thu, 17 Nov 2005 11:50:02 +0000


On Wed, 16 Nov 2005 21:26:24 -0800, Prady K <email@hidden> wrote:

It seems Spotlight gives the path to the last directory entry created to a file.

I wouldn't like to rely on that behaviour. Try the following:

  1)  $ mdfind hamishtest3
  2)  $ cat > foo.txt
  3)  hamishtest3
  4)  ^D
  5)  $ mdfind hamishtest3
  6)  /Users/hamish/foo.txt
  7)  $ mkdir bar
  8)  $ ln foo.txt bar/bar.txt
  9)  $ mdfind hamishtest3
10)  /Users/hamish/foo.txt
11)  $ cat >> bar/bar.txt
12)  extra
13)  ^D
14)  $ mdfind hamishtest3
15)  /Users/hamish/bar/foo.txt
16)  $ rm foo.txt
17)  $ mdfind hamishtest3
18)  $ mdimport bar/bar.txt
19)  $ mdfind hamishtest3
20)  /Users/hamish/bar/foo.txt

Expected Results:
At line 15, mdfind should report "/Users/hamish/bar/bar.txt". Certainly by line 20 the cache should have been updated.


Actual Results:
At lines 15 and 20, mdfind incorrectly reports "/Users/hamish/bar/ foo.txt", which does not exist.


This (presumably) happens because Spotlight uses vn_getpath() to discover path from volume + inode (which is kMDItemID from the /.Spotlight-V100 for a particular volume). This is a fundamental problem with vn_getpath() -- each inode only caches the context in which it was last accessed. I spoke to Mike Smith about this on Darwin-dev but he doesn't think it's much of a problem really (although I don't think there's any reason why each inode shouldn't cache every context rather than just the last one -- Vince, if you're reading, perhaps you could mention this to Dominic if he'd ever making changes to the filesystem for Spotlight? See also rdar:// problem/4132109 which describes the above behaviour.)

Best wishes,
Hamish

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Prev by Date: UKKQueue
  • Next by Date: Re: UKKQueue
  • Previous by thread: Re: Hard linked files cannot be modified
  • Next by thread: Re: Hard linked files cannot be modified
  • Index(es):
    • Date
    • Thread