Skip to contentSkip to conversation

--reference option for setfattr

RFE Ales Zelinka 3 participants 3 messages Nov 4, 2008 – Dec 22, 2008

lore
Share & tools
lore
#0 lore raw

Hello,

currently when I want to copy all extended attributes from one file to another, I have to use ugly command like this:

getfattr --dump -m '-' /etc/samba/smb.conf |sed 's;file: etc/samba/smb.conf;file: /tmp/smb.conf;'| setfattr --restore=-

Would you please implement --reference=some_file option that will read all extended attributes set on some_file and set them on pathname?

The previous use case would then look like this:

setfattr --reference=/etc/samba/smb.conf /tmp/smb.conf

Other commands from file-attributes-manipulation familly already have parameter like this (chmod, chown, chcon,...)

Thanks

Ales Zelinka

#1 lore raw
Quoted 9 lines · Ales Zelinka

currently when I want to copy all extended attributes from one file to another, I have to use ugly command like this:

getfattr --dump -m '-' /etc/samba/smb.conf |sed 's;file:
etc/samba/smb.conf;file: /tmp/smb.conf;'| setfattr --restore=-

Would you please implement --reference=some_file option that will read all extended attributes set on some_file and set them on pathname?

Quoted 6 lines

The previous use case would then look like this:

setfattr --reference=/etc/samba/smb.conf /tmp/smb.conf

Other commands from file-attributes-manipulation familly already have parameter like this (chmod, chown, chcon,...)

This feature seems useful to me, any chance you could try coming up with a patch?

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#2 lore raw
Quoted 12 lines · On Monday, 22 December 2008 14:01:03 Christoph Hellwig wrote:
Quoted 11 lines · Ales Zelinka

currently when I want to copy all extended attributes from one file to another, I have to use ugly command like this:

getfattr --dump -m '-' /etc/samba/smb.conf |sed 's;file:
etc/samba/smb.conf;file: /tmp/smb.conf;'| setfattr --restore=-

Would you please implement --reference=some_file option that will read all extended attributes set on some_file and set them on pathname?

The previous use case would then look like this:

Quoted 7 lines
Quoted 4 lines

setfattr --reference=/etc/samba/smb.conf /tmp/smb.conf

Other commands from file-attributes-manipulation familly already have parameter like this (chmod, chown, chcon,...)

This feature seems useful to me, any chance you could try coming up with a patch?

getfattr/setfattr are modeled similar to getfacl/setfacl, and with those two tools you can do this (-b stands for --remove-all):

getfacl /etc/samba/smb.conf | setfacl -b -M - /tmp/smb.conf

Would it make sense to implement this in setfattr in a similar way? A -b option would be handy in this context as well, of course.

But maybe --reference is more convenient sometimes, and so it should be added in any case?

Thanks,
Andreas

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs