GNU bug report logs - #78623
cp --preserve=xattr copies attr as well as xattr which breaks cross-FS copy

Previous Next

Package: coreutils;

Reported by: Gael Donval <gael.donval <at> manchester.ac.uk>

Date: Thu, 29 May 2025 05:04:02 UTC

Severity: normal

Full log


View this message in rfc822 format

From: Gael Donval <gael.donval <at> manchester.ac.uk>
To: "eggert <at> cs.ucla.edu" <eggert <at> cs.ucla.edu>, "P <at> draigBrady.com" <P <at> draigBrady.com>
Cc: "78623 <at> debbugs.gnu.org" <78623 <at> debbugs.gnu.org>
Subject: bug#78623: cp --preserve=xattr copies attr as well as xattr which breaks cross-FS copy
Date: Thu, 5 Jun 2025 10:05:08 +0000
> > `cp -a` offers that flexibility (good) but also silently drops
> > everything if any intermediary does not support xattrs (very bad). The
> > latter is relatively common on distributed FS but could also happen
> > depending on vendor/admin choices.
> > 
> > 
> > The current approach of setting up xattr copy rules in /etc/xattr.conf
> > is unwieldy:
> > 
> > 1. it does not work for non-root users;
> > 2. and does not allow for any call-specific adjustment.
> > 
> > Setting up a container so that a normal user can setup a scoped local
> > /etc/xattr.conf tailored to their use, to make a specific tree copy
> > checking for the existence of a minimal set of supported xattrs is a
> > bit convoluted.
> > 
> > Any alternative suggestion would be good.
> So you're suggesting supporting something like --xattrs-include=... and --xattrs-exclude.
> Looking now, I see that tar supports those exact options.
> Also rsync support xattr filtering though its --filter rules.
> This does give more control, though also less general control
> as one would need to config the xattrs for each particular system / call.
> Also given other archiving tools support this already,
> I'm not sure it's warranted in cp.

The only problem with rsync is that it doesn't support reflinks.
Otherwise it would be perfect (there is a series of patch that exist
since 2021 but no one ever merged them in main).

Gaël


> 
> cheers,
> Pádraig

This bug report was last modified 13 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.