mirror of
git://git.sv.gnu.org/coreutils
synced 2026-05-11 01:19:38 -04:00
a357cfb021
When recursively copying files into OS trees, it often happens that some subdirectory of the source directory is a symlink in the target directory. Currently, cp will fail in that scenario with the error: "cannot overwrite non-directory %s with directory %s" However, we'd like cp in this scenario to follow the destination directory symlink and copy the files into the symlinked directory instead. Let's support this by adding a new option --keep-directory-symlink that makes cp follow destination directory symlinks. We name the option --keep-directory-symlink to keep consistent with tar which has the same option with the same effect. * doc/coreutils.texi (cp invocation): Describe the new option. * src/copy.h: Add the new setting. * src/copy.h: Adjust to follow symlinks if setting enabled. * src/cp.c (usage): Describe the new option. (main): Accept the new option. * tests/cp/keep-directory-symlink.sh: A new test. * tests/local.mk: Reference the new test. * NEWS: Mention the new feature.