Summary: | multibuild.eclass - FreeBSD: cp -a or cp -P -R -p fails when encountering broken symlinks | ||
---|---|---|---|
Product: | Gentoo/Alt | Reporter: | Yuta SATOH <nigoro.dev> |
Component: | FreeBSD | Assignee: | Michał Górny <mgorny> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | bsd+disabled, prefix |
Priority: | Normal | ||
Version: | unspecified | ||
Hardware: | All | ||
OS: | FreeBSD | ||
URL: | http://www.freebsd.org/cgi/query-pr.cgi?pr=174489 | ||
See Also: | https://bugs.gentoo.org/show_bug.cgi?id=447370 | ||
Whiteboard: | |||
Package list: | Runtime testing required: | --- |
Description
Yuta SATOH
2014-04-14 11:13:46 UTC
Results of test the code that has been added to multibuild.eclass recently. http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/eclass/multibuild.eclass?r1=1.14&r2=1.15 Tested on Gentoo/FreeBSD 10.0 amd64 if cp -a --version &>/dev/null; then cp_args+=( -a ) else cp_args+=( -P -R -p ) fi $ cp -a --version &>/dev/null $ echo $? 64 FreeBSD's cp does not support the argument --version. So, the argument of cp is set "-P -R -p" on FreeBSD. $ mkdir 1 2 $ ln -s python-exec 1/foo $ cp -P -R -p 1/* 2/ $ cp -P -R -p 1/* 2/ cp: symlink: python-exec: File exists $ echo $? 1 Error occurs even if set "-a". $ rm -rf 1 2 $ mkdir 1 2 $ ln -s python-exec 1/foo $ cp -a 1/* 2/ $ cp -a 1/* 2/ cp: symlink: python-exec: File exists $ echo $? 1 FYI, FreeBSD's cp returns 64, and illegal option -- -. $ cp -a --version &>/dev/null $ echo $? 64 $ cp -a --version cp: illegal option -- - usage: cp [-R [-H | -L | -P]] [-f | -i | -n] [-alpvx] source_file target_file cp [-R [-H | -L | -P]] [-f | -i | -n] [-alpvx] source_file ... target_directory GNU's cp returns 0. $ gcp -a --version &>/dev/null $ echo $? 0 @bsd team, I have confirmed that the solved this issue by apply following patch. http://people.freebsd.org/~markj/patches/cp/002_stat_vs_lstat.diff I think better it is merged upstream. However, I don't know how to follow-up for FreeBSD's bug report... http://www.freebsd.org/cgi/query-pr.cgi?pr=174489 # cd /var/tmp/portage/sys-freebsd/freebsd-bin-10.0/work/bin/cp # wget http://people.freebsd.org/~markj/patches/cp/002_stat_vs_lstat.diff # patch -p3 < 002_stat_vs_lstat.diff # make # ./cp -a /tmp/1/* /tmp/2/ # ./cp -a /tmp/1/* /tmp/2/ # echo $? 0 I think this issue occurs on FreeBSD, OpenBSD, DragonFlyBSD. Error does not occur on NetBSD. NetBSD 6.1.2) # cp -a --version cp: unknown option -- - usage: cp [-R [-H | -L | -P]] [-f | -i] [-alNpv] src target cp [-R [-H | -L | -P]] [-f | -i] [-alNpv] src1 ... srcN directory # mkdir 1 2 # ln -s python-exec 1/foo # cp -P -R -p 1/* 2/ # cp -P -R -p 1/* 2/ # echo $? 0 # rm -rf 1 2 # mkdir 1 2 # ln -s python-exec 1/foo # cp -a 1/* 2/ # cp -a 1/* 2/ # echo $? 0 OpenBSD 5.4) # cp -a --version cp: unknown option -- a usage: cp [-fip] [-R [-H | -L | -P]] source target cp [-fip] [-R [-H | -L | -P]] source ... directory # cp --version cp: unknown option -- - usage: cp [-fip] [-R [-H | -L | -P]] source target cp [-fip] [-R [-H | -L | -P]] source ... directory # cp -a cp: unknown option -- a usage: cp [-fip] [-R [-H | -L | -P]] source target cp [-fip] [-R [-H | -L | -P]] source ... directory # mkdir 1 2 # ln -s python-exec 1/foo # cp -P -R -p 1/* 2/ # cp -P -R -p 1/* 2/ cp: symlink: python-exec: File exists # echo $? 1 DragonFly BSD 3.6.2) # cp -a --version cp: illegal option -- - usage: cp [-R [-H | -L | -P]] [-f | -i | -n] [-alpvx] source_file target_file cp [-R [-H | -L | -P]] [-f | -i | -n] [-alpvx] source_file ... target_directory # mkdir 1 2 # ln -s python-exec 1/foo # cp -P -R -p 1/* 2/ # cp -P -R -p 1/* 2/ cp: symlink: python-exec: File exists # echo $? 1 # rm -rf 1 2 # mkdir 1 2 # ln -s python-exec 1/foo # cp -a 1/* 2/ # cp -a 1/* 2/ cp: symlink: python-exec: File exists # echo $? 1 So back to userland_BSD workaround? + 15 Apr 2014; Michał Górny <mgorny@gentoo.org> multibuild.eclass: + multibuild_merge_root: re-introduce userland_BSD tar fallback, bug #507626. Let's just reuse the old code that handled BSD. |