Commit 82fc0d09e862 introduced an issue which you can reproduce by trying to copy contents of the root directory to somewhere else. E.g.: # mount -t tmpfs tmpfs /tmp # cp -avx / /tmp cp: /tmp//: Is a directory Assertion failed: (strcmp(to.end + (*to.end == '/'), curr->fts_name) == 0), function copy, file /usr/src/bin/cp/cp.c, line 452. Abort trap (core dumped) It seems like a corner case, because I can work around it by doing # cd / # cp -avx ./ /tmp
(In reply to Jan Noha from comment #0) Pasting the error again as it appears as of 07b7bd2311aff496b73f9552a5b3d8019685ef01 Assertion failed: (strcmp(to.end + (*to.end == '/'), curr->fts_name) == 0), function copy, file /usr/src/bin/cp/cp.c, line 527. The previous one was when I built cp from 82fc0d09e862.
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=fe836c50120daed3e4084f43c27d8d650d36dee8 commit fe836c50120daed3e4084f43c27d8d650d36dee8 Author: Dag-Erling Smørgrav <des@FreeBSD.org> AuthorDate: 2025-11-22 12:11:59 +0000 Commit: Dag-Erling Smørgrav <des@FreeBSD.org> CommitDate: 2025-11-22 12:11:59 +0000 cp: Fix copying the root directory When the source of the copy operation is the root directory, we should neither append it to the destination path on FTS_D nor trim it back off on FTS_DP. PR: 291132 MFC after: 3 days Fixes: 82fc0d09e862 ("cp: Partly restore symlink folllowing.") Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D53863 bin/cp/cp.c | 7 ++++++- bin/cp/tests/cp_test.sh | 15 +++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-)
A commit in branch stable/15 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=c4843e5805dec10ee552d21f19c8da7707c1fcbc commit c4843e5805dec10ee552d21f19c8da7707c1fcbc Author: Dag-Erling Smørgrav <des@FreeBSD.org> AuthorDate: 2025-11-22 12:11:59 +0000 Commit: Dag-Erling Smørgrav <des@FreeBSD.org> CommitDate: 2025-11-22 18:42:43 +0000 cp: Fix copying the root directory When the source of the copy operation is the root directory, we should neither append it to the destination path on FTS_D nor trim it back off on FTS_DP. PR: 291132 MFC after: 3 days Fixes: 82fc0d09e862 ("cp: Partly restore symlink folllowing.") Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D53863 (cherry picked from commit fe836c50120daed3e4084f43c27d8d650d36dee8) bin/cp/cp.c | 7 ++++++- bin/cp/tests/cp_test.sh | 15 +++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-)
A commit in branch releng/15.0 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=54808d50412aee31692f0041b4f78ddaf43bac8f commit 54808d50412aee31692f0041b4f78ddaf43bac8f Author: Dag-Erling Smørgrav <des@FreeBSD.org> AuthorDate: 2025-11-22 12:11:59 +0000 Commit: Colin Percival <cperciva@FreeBSD.org> CommitDate: 2025-11-23 16:38:48 +0000 cp: Fix copying the root directory When the source of the copy operation is the root directory, we should neither append it to the destination path on FTS_D nor trim it back off on FTS_DP. Approved by: re (cperciva) PR: 291132 MFC after: 3 days Fixes: 82fc0d09e862 ("cp: Partly restore symlink folllowing.") Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D53863 (cherry picked from commit fe836c50120daed3e4084f43c27d8d650d36dee8) (cherry picked from commit c4843e5805dec10ee552d21f19c8da7707c1fcbc) bin/cp/cp.c | 7 ++++++- bin/cp/tests/cp_test.sh | 15 +++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-)