From c666aa7461fd2060c05485ae948c2d458ccbf862 Mon Sep 17 00:00:00 2001 From: =?utf8?q?P=C3=A1draig=20Brady?= Date: Tue, 20 Jan 2026 19:11:40 +0000 Subject: [PATCH] doc: cp: document --keep-directory-symlink in correct location * src/cp.c (usage): Move to alphabetically in list. * doc/coreutils.texi (mv invocation): Move description from here ... (cp invocation): ... to here. --- doc/coreutils.texi | 12 ++++++------ src/cp.c | 8 ++++---- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/doc/coreutils.texi b/doc/coreutils.texi index 261cb69dfc..34f1b775fe 100644 --- a/doc/coreutils.texi +++ b/doc/coreutils.texi @@ -8835,6 +8835,12 @@ Copy symbolic links as symbolic links rather than copying the files that they point to. This option affects only symbolic links in the source; symbolic links in the destination are always followed if possible. +@optItem{cp,--keep-directory-symlink,} +Follow existing symlinks to directories when copying. +Use this option only when the destination directory's contents are trusted, +as an attacker can place symlinks in the destination +to cause @command{cp} write to arbitrary target directories. + @optItem{cp,-p,} @optItemx{cp,--preserve,[=@var{attribute_list}]} @cindex file information, preserving, extended attributes, xattr @@ -10019,12 +10025,6 @@ option is also specified. @optItemx{mv,--verbose,} Print the name of each file before moving it. -@optItem{mv,--keep-directory-symlink,} -Follow existing symlinks to directories when copying. -Use this option only when the destination directory's contents are trusted, -as an attacker can place symlinks in the destination -to cause @command{cp} write to arbitrary target directories. - @optStripTrailingSlashes{mv} @optBackupSuffix{mv} diff --git a/src/cp.c b/src/cp.c index 278f7cd345..fa464f2c40 100644 --- a/src/cp.c +++ b/src/cp.c @@ -225,6 +225,10 @@ Copy SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY.\n\ oputs (_("\ -P, --no-dereference\n\ never follow symbolic links in SOURCE\n\ +")); + oputs (_("\ + --keep-directory-symlink\n\ + follow existing symlinks to directories\n\ ")); oputs (_("\ -p\n\ @@ -291,10 +295,6 @@ Copy SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY.\n\ oputs (_("\ -v, --verbose\n\ explain what is being done\n\ -")); - oputs (_("\ - --keep-directory-symlink\n\ - follow existing symlinks to directories\n\ ")); oputs (_("\ -x, --one-file-system\n\ -- 2.47.3