coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: cp: add support for preserving ext2 attributes


From: Pádraig Brady
Subject: Re: cp: add support for preserving ext2 attributes
Date: Sun, 18 Aug 2013 02:04:16 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130110 Thunderbird/17.0.2

On 08/16/2013 03:10 PM, Jaromir Koncicky wrote:
> In Red Hat Bugzilla, there was a request to add support of preserving ext2 
> extended filesystem flags (append only, immutable etc..) to cp, mv, install 
> commands: 
> https://bugzilla.redhat.com/show_bug.cgi?id=995249
> 
> I took a look at it and added the support into cp, using e2fsprogs-libs 
> library, so it is preserving the attributes as intended.
> However, I should consult this change with upstream first so I'm posting my 
> patch.
> Note that this is an initial version of the patch and it is not complete at 
> all, It has very basic functionality and I'm just demonstrating the way I'm 
> going to implement the support.
> I need your feedback about this first. Eventually I will complete the patch.
> 
> I am doing it under Fedora 19 3.10.4-300.fc19.x86_64, with libattr and 
> e2fsprogs-libs installed.
> 
> Steps to test it:
> 
> - apply the patch
> - into Makefile, add manually:
>   "LIB_EXT2ATTR = -le2p"    (for example after the line "LIB_XATTR = -lattr")
>   "copy_ldadd = ..." add "$(LIB_EXT2ATTR)"
> $ make
> $ touch testfile
> $ sudo chattr +a testfile
> $ lsattr testfile
> -----a-------e-- testfile
> $ sudo src/cp --preserve=all testfile testfile1
> $ lsattr testfile1
> -----a-------e-- testfile1
> 
> 

Thanks for the patch, however I'm not convinced of the approach here.
Given that ext2 isn't special it would open the flood gates
for a myriad of file system specific attributes,
that would never be complete.

I notice that star has the -xfflags option to support some of these flags.
While a higher level option, again it seems like it would always be incomplete.

Perhaps "copy" would have implementation advantages in this area,
by not needing to store such attributes in an intermediate format.
I.E. it seems to me that if file systems provided a copyfile()
system call that was recently mooted on the Linux kernel mailing list,
that would be a better vector for such support, and might also provide
for conversions of equivalent flags between various file system types.

thanks,
Pádraig.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]