Skip to contentSkip to conversation

changing file copy to support extended attributes

DISCUSSION Eric Chen 3 participants 3 messages Feb 12, 2003

lore
Share & tools
lore

Eric Chen

author
#0 lore raw

Hi,

I wanted to modify file copy so it supports extended attributes. I am using extended attributes provided by the XFS filesystem, and right now when I copy a file with an extended attribute bit set on, the copy of the file does not preserve the extended attribute. I could use some help in this area because I am not sure where to start. If anyone has some suggestions or can offer me some help or resources to go to, please let me know.

Thanks,
Eric
[email protected]

#1 lore raw
Quoted 6 lines · Eric Chen

I wanted to modify file copy so it supports extended attributes. I am using extended attributes provided by the XFS filesystem, and right now when I copy a file with an extended attribute bit set on, the copy of the file does not preserve the extended attribute. I could use some help in this area because I am not sure where to start. If anyone has some suggestions or can offer me some help or resources to go to, please let me know.

Probably only user-space changes are needed. I think there are already modified tools for this. See http://acl.bestbits.at.

Cheers, Andreas
--
Andreas Dilger
http://sourceforge.net/projects/ext2resize/
http://www-mddsp.enel.ucalgary.ca/People/adilger/

#2 lore raw
In reply to Eric Chen
Quoted 8 lines · Eric Chen

Hi,

I wanted to modify file copy so it supports extended attributes. I am using extended attributes provided by the XFS filesystem, and right now when I copy a file with an extended attribute bit set on, the copy of the file does not preserve the extended attribute. I could use some help in this area because I am not sure where to start. If anyone has some suggestions or can offer me some help or resources to go to, please let me know.

You have to modify "cp" and "mv" (since a "mv" that crosses mount points is equivalent to a "cp original destination/copy; rm original".

Now you also need to realize that you might NOT be able to copy all of the extended attributes (XFS supports system and user attributes, and only the user attributes can be copied). This is the usual reason extended attributes are not copied at all.

Another is what about applications that may copy files too: cat, tar, cpio, dd, vi, ed, ... and sh (remember the old "shcat" script:
while[read v]; do; echo $v; done <original >copy)

And what do you do if the destination is not XFS?

And what about when the user is not the owner of the file, but does have read access?

Signature · 5 lines
-------------------------------------------------------------------------
Jesse I Pollard, II
Email: [email protected]

Any opinions expressed are solely my own.