Summary: | 'man cp' does not discuss extended attributes; it really should since even -p discards them! | ||
---|---|---|---|
Product: | Documentation | Reporter: | Sean McBride <sean> |
Component: | Manual Pages | Assignee: | freebsd-bugs (Nobody) <bugs> |
Status: | Open --- | ||
Severity: | Affects Many People | CC: | cem, doc |
Priority: | --- | ||
Version: | Latest | ||
Hardware: | Any | ||
OS: | Any |
Description
Sean McBride
2019-08-27 14:15:48 UTC
Yeah, it's unfortunate! Totally agree we should at a minimum document the gap. cp(1) is an old tool and long predates extended attributes in FreeBSD. FWIW, POSIX 1003.1-2017 cp(1) also does not mention extattrs at all: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/cp.html GNU cp only touches on it obliquely: http://man7.org/linux/man-pages/man1/cp.1.html > -a, --archive > same as -dR --preserve=all ... ^^^^^^^^^^^^ > -p same as --preserve=mode,ownership,timestamps > > --preserve[=ATTR_LIST] > preserve the specified attributes (default: > mode,ownership,timestamps), if possible additional attributes: > context, links, xattr, all ^^^^^ (And note that even GNU cp's bare '-p' option does NOT preserve extattrs; you need to pass '-a'.) So this is a valid doc bug, but could also be filed as a Base system / bin bug to add the missing support. As a workaround, tar(1) can be used to copy extended attributes (--xattrs). I'm happy to file an additional bug against 'cp -p' behaviour. I tried to search for an existing one, but didn't find it. Surely I can't be the first to notice/want this? My impression is that extattr/fork use is much less common in BSD/Linux than Windows. It seems like Mac gained support in 10.4 in ~2005. It's quite possible that folks who ran into this shortcoming just installed coreutils and used gcp. Btw, I don't think the cp(1) -p behavior is wrong here. I was suggesting adding extattr support to '-a', like GNU cp does. Not sure about Windows, but EAs are quite common on macOS. Re: -p vs -a, don't much care myself, but I'd like *some* option for cp to preserve them. :) For cp itself, I created https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=240157 (In reply to Sean McBride from comment #4) On Windows, they're called "ADS" (alternative data streams) and the semantics are somewhat different, but they tend to be used in similar ways as extattrs. > but I'd like *some* option for cp to preserve them. :) Me too :-). > For cp itself, I created ... Thanks! |