Re: Identifying files with resource forks
Re: Identifying files with resource forks
- Subject: Re: Identifying files with resource forks
- From: Dan Shoop <email@hidden>
- Date: Wed, 30 Mar 2011 19:22:26 -0400
> On Wednesday 30 March 2011 16:03:01 Adam Mercer wrote:
>> Hi
>>
>> For some multi-platform software I distribute I'm having problems with
>> what looks like files with resource forks being distributed in the
>> source, when the source is extracted on Linux these resource forks
>> tend to show up as follows:
>>
>> -rw-r--r-- 1 501 staff 240 May 13 2010 ._compat
>> -rw-r--r-- 1 501 staff 240 May 13 2010 ._control
>> -rw-r--r-- 1 501 staff 240 May 13 2010 ._copyright
>> -rw-r--r-- 1 501 staff 240 May 13 2010 ._install
>> -rwxr-xr-x 1 501 staff 240 May 13 2010 ._rules
>> -rw-r--r-- 1 501 staff 2 May 13 2010 compat
>> -rw-r--r-- 1 501 staff 608 May 13 2010 control
>> -rw-r--r-- 1 501 staff 157 May 13 2010 copyright
>> -rw-r--r-- 1 501 staff 81 May 13 2010 install
>> -rwxr-xr-x 1 501 staff 442 May 13 2010 rules
>>
>> i.e. "._compat" is how the resource fork of the file "compat" is
>> represented under Linux.
>>
In HFS+ a file has a data fork and/or one or more arbitrarily named forks stored as extended attributes. And if you want to delete the expression of an HFS files' extended attributes as stored on a non-forked filesystem (such as linux filesystems) then just delete those dot-files and when viewed/accessed on a Mac or copied there they will be gone. Macintosh and Windows both support forked files where *nix does not generally, hence they are expressed on those filesystems as dot-files in order to store these arbitrarily named forks / extended attributes. ACLs, for instance, are extended attributes, and extended attributes are used to denote a file being compressed, or as one downloaded from the Internet. That is this isn't just what under HFS (pre-HFS+) was known as resource forks. It's actually a lot more than "resources".
Erik Fair wrote the RFC's for this, rfc1741 and rfc1740 and it's covered in "AppleSingle/AppleDouble Formats for Foreign Files Developer's Note".
The question here is how you're getting these files to this linux system.
You should also check to see what sort of extended attributes these are, it's not likely that they're "resource forks" as they really haven't been used in a long time.
>> I've been looking for a way to identify files with resource forks and
>> strip them before packaging up the source. From what I've found the
>> following should identify files that have resource forks:
>>
>> $ find . -type f -exec test -s {}/..namedfork/rsrc \; -print
>>
>> but it doesn't seem to be working, i.e. it doesn't identify the above
>> files.
>>
It probably *is* working it's just that the above only looks for "resource forks" (i.e. com.apple.ResourceFork), a specific "arbitrary name", extended attribute. If the file's don't have this extended attribute then it won't, obviously, trigger that `find`.
>> Does anyone know of a good way to find and strip resource forks from
>> files?
Again, you need to look beyond just this specific named attribute. For instance `ls` can display certain extended attributes and `xattr -v` will enumerate a files named attributes while xattr's -d option deletes a named extended attribute. Likewise chmod manages ACLs.
In ls -l@ displays extended attributes and -le displays ACLs. And `ls -Rl@ | grep @` will reveal extended attributes.
$ ls -l@ /System/Library/CFMSupport/CarbonLib
-rwxr-xr-x@ 1 root wheel 433820 Jun 9 2010 /System/Library/CFMSupport/CarbonLib
com.apple.FinderInfo 32
com.apple.ResourceFork 586
$ ls -l@ firesheep-0.1-1.xpi
-rw-r--r--@ 1 shoop admin 3082723 Oct 24 15:24 firesheep-0.1-1.xpi
com.apple.metadata:kMDItemWhereFroms 116
com.apple.quarantine 78
$ ls -l@ RemoteDesktopClient.dist
-rw-r--r--@ 1 root admin 4518 Jan 6 17:36 RemoteDesktopClient.dist
com.apple.TextEncoding 15
On Mar 30, 2011, at 5:33 PM, Tilghman Lesher wrote:
> While I'm not sure of a good way to find resource forks, you can remove them
> by using the -X option to the cp(1) command. You can also use RezWack
> (located in /Developer/Tools) to split forked files, then use find(1) to
> remove the resulting resource fork files (now separate from the data fork).
This operates on the arbitrarily named resource fork only, IIRC.
On Mar 30, 2011, at 5:33 PM, Francis Devereux wrote:
> OS X creates ._ files to store extended attributes as well as resource forks.
Resource forks _are_ just extended attributes.
-d
------------------------------------------------------------------------
Dan Shoop
email@hidden
GoogleVoice: 1-646-402-5293
aim: iWiring
twitter: @colonelmode
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden