Re: curious: if not file references, what?

2017-01-20 Thread Charles Srstka
> On Jan 20, 2017, at 10:24 PM, Quincey Morris 
>  wrote:
> 
> It’s an interesting question whether file-references use inode numbers. Some 
> file systems don’t have them, so (I assume) they’re invented when such a file 
> system is mounted, but they’re not necessarily assigned permanently across 
> mounts. (I believe Apple documentation says not rely on the file number 
> returned by NSURL metadata methods being stable across mounts.) Even when 
> they’re baked into the file system, it’s not obvious what the semantics are 
> when a volume is copied, or a volume is restored from backup. Perhaps someone 
> else on this list is better informed on the subject than I am.

Actually, this is a common misconception; file references do *not* use inode 
numbers; they refer to CNIDs, which are a separate number stored in the catalog 
file. Inodes refer to raw file data on the disk; CNIDs point instead to a 
particular catalog node. You can have two or more hard links that all point to 
a specific file, but they’ll all have separate CNIDs, and if you delete one of 
them, you’ll break any file references pointing to that particular node.

Note that this is all HFS(+)-specific. APFS may be implemented differently, 
although in my limited testing, it appears to behave the same.

Charles

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: curious: if not file references, what?

2017-01-20 Thread Quincey Morris
On Jan 20, 2017, at 19:10 , David Young  wrote:
> 
> This discussion seems to connect with a question I have had: what's the
> "proper" way to refer from a first document to a second document, if
> the second document may not have a fixed location in the filesystem?
> It sounds like "file references" (perhaps these are roughly in
> correspondence with an inode number?) are on their way out.

It’s not precisely the answer to the question of file references, but the 
correct way to reference one document from another is to use security scoped 
bookmarks. That throws the task of tracking the referenced file onto the system 
(a bookmark is much the same thing as an alias), plus it incorporates the 
sandbox-puncturing security check that allows you to re-open the referenced 
file when your app is re-launched, assuming the file was chosen by a user 
originally.

Currently, a bookmark might incorporate a file-reference URL and/or a file-path 
URL along with other metadata. If file-reference URLs are deprecated, the 
bookmark can be assumed to continue working regardless, and there should be no 
evil consequences from your point of view.

That’s assuming your app is sandboxed. If not, then just a regular bookmark 
should be fine.

It seems to me that the file-reference *behavior* is unlikely to go away. If 
anything changes, perhaps it will be that a file reference is no longer a kind 
of URL, but some other new class. Think about FileSpecs and FileRefs, which had 
API support for many years (at least 10, IIRC) after they were no longer 
recommended for use.

It’s an interesting question whether file-references use inode numbers. Some 
file systems don’t have them, so (I assume) they’re invented when such a file 
system is mounted, but they’re not necessarily assigned permanently across 
mounts. (I believe Apple documentation says not rely on the file number 
returned by NSURL metadata methods being stable across mounts.) Even when 
they’re baked into the file system, it’s not obvious what the semantics are 
when a volume is copied, or a volume is restored from backup. Perhaps someone 
else on this list is better informed on the subject than I am.

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

curious: if not file references, what?

2017-01-20 Thread David Young
This discussion seems to connect with a question I have had: what's the
"proper" way to refer from a first document to a second document, if
the second document may not have a fixed location in the filesystem?
It sounds like "file references" (perhaps these are roughly in
correspondence with an inode number?) are on their way out.  Should one
use some metadata that's indexed by Spotlight?

I ask because in the app that I'm building in my spare time, I would
like someday to create hyperlinks between documents.

Dave

-- 
David Young
dyo...@pobox.comUrbana, IL(217) 721-9981
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com