From nobody Sun Apr 24 13:30:08 2022 X-Original-To: bugs@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 0AA3B1A873CD for ; Sun, 24 Apr 2022 13:30:10 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4KmTXd2sg5z4tZx for ; Sun, 24 Apr 2022 13:30:09 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 27E2A27103 for ; Sun, 24 Apr 2022 13:30:09 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 23ODU8eh070389 for ; Sun, 24 Apr 2022 13:30:08 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from bugzilla@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 23ODU8Cr070388 for bugs@FreeBSD.org; Sun, 24 Apr 2022 13:30:08 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: bugzilla set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 235438] cp -R command not working properly Date: Sun, 24 Apr 2022 13:30:08 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: bin X-Bugzilla-Version: 12.0-RELEASE X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Many People X-Bugzilla-Who: commit-hook@FreeBSD.org X-Bugzilla-Status: In Progress X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: kevans@freebsd.org X-Bugzilla-Flags: mfc-stable13? mfc-stable12? X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Bug reports List-Archive: https://lists.freebsd.org/archives/freebsd-bugs List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-bugs@freebsd.org MIME-Version: 1.0 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1650807009; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=kj9DX8qrrUona+bOAUSDTvNrzr6sEN7YHRoiWoT81Mo=; b=r3hqCyW8DyEmSTxmzVWSh90HrgTSEt3LJDz3YXTfQpbEn47unqHq93aiSow1Rp0JEzpDPz DLlYf0imhUJtyNn77mVGSq/2plKEBP44pPBLjhyvlKNwqCDJrILAyqGIStoDUiLUicKnYF GJQJzxEw7Yb6JktJvmHVwptqW56YYgmLXwvT3qNkWR95iELmwwY6gPz+LXcIDGFEZlTp7V yecsUR89EM9g9b/NTtskT3Avzx0GsjLR7Y4FPc/YEK22Ce6QiLP3ZF8No4IQYzErbl0QTI onXd6RQPGFuOknaIb51eYCZyJpIuu7dePqGrUNIxUiwysAq5wBeCmLC3C1DLWQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1650807009; a=rsa-sha256; cv=none; b=LcXnSF7rA111KkvX6HkLS0f++H1UgsrMdYFCp2xeuTqRsLl0qN2gCy1Z7gXtLJB05Jljlh s/i/RHoEOa/2ex2ywZgbMB73o54nGKvzqbeTeRw5l9Qx0isl5mdPyigD5kf+uorLLxZaBK ip17EO3fC01A6HjNNyYHeGV69lDmtcNf57v4uOeaOmmoeytIk8uJUK7RI2a51WJXRFrDfE 66DGxzcnh3rDdnPd98PL5PneFyxsxIhytUKKKLXEzplSmGgAfg5zdmsXF/P0P7vYRuRomU QeLxPMtHoMBGORUrfZG9gGghj1m6tL/t5GuCv3pkSPk3JwCqm9Ac6rlSLd+DEA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D235438 --- Comment #3 from commit-hook@FreeBSD.org --- A commit in branch stable/13 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=3D5237a02ba86b5957d10d87148bbc0efb3= f2f6f82 commit 5237a02ba86b5957d10d87148bbc0efb3f2f6f82 Author: Kyle Evans AuthorDate: 2022-01-27 18:02:17 +0000 Commit: Kyle Evans CommitDate: 2022-04-24 03:51:13 +0000 cp: fix some cases with infinite recursion As noted in the PR, cp -R has some surprising behavior. Typically, when you `cp -R foo bar` where both foo and bar exist, foo is cleanly copied to foo/bar. When you `cp -R foo foo` (where foo clearly exists), cp(1) goes a little off the rails as it creates foo/foo, then discovers that and creates foo/foo/foo, so on and so forth, until it eventually fails. POSIX doesn't seem to disallow this behavior, but it isn't very useful. GNU cp(1) will detect the recursion and squash it, but emit a message in the process that it has done so. This change seemingly follows the GNU behavior, but it currently doesn't warn about the situation -- the author feels that the final product is about what one might expect from doing this and thus, doesn't need a warning. The author doesn't feel strongly about this. PR: 235438 Reviewed by: bapt Sponsored by: Klara, Inc. (cherry picked from commit 848263aad129c8f9de75b58a5ab9a010611b75ac) bin/cp/cp.c | 75 +++++++++++++++++++++++++++++++++++++++++++--= -- bin/cp/tests/cp_test.sh | 77 +++++++++++++++++++++++++++++++++++++++++++++= ++++ 2 files changed, 147 insertions(+), 5 deletions(-) --=20 You are receiving this mail because: You are on the CC list for the bug.=