From nobody Sun Apr 24 13:30:14 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 B79241A87612 for ; Sun, 24 Apr 2022 13:30:15 +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 4KmTXk1lmdz4tbM for ; Sun, 24 Apr 2022 13:30:14 +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 CA87C2686F for ; Sun, 24 Apr 2022 13:30:13 +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 23ODUDhi070532 for ; Sun, 24 Apr 2022 13:30:13 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from bugzilla@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 23ODUD8u070531 for bugs@FreeBSD.org; Sun, 24 Apr 2022 13:30:13 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:14 +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=1650807014; 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=6iFzclUtceQS3ur0aG37pwEWaWcIpUqVLl9DDe6b2+E=; b=YgkbtSXbWnGbG4WhA/H2Nyn6NzgY/PhKDMsST0JRc526zjncXZg0KHjDpV9t4hjQ0jLLwu L2mdmndIB2pxihihYFXUNvXvco7LgWMDriGB5MxF9xxN337WpDQkp4odBEohAW/KNV6HuM z8ydwZaHB9KKvbjgvUHS0/nkxwgDeXOHbEErIZ4xQtlHMVpQxwZDB0Yw6pfXIZG8yG8Iq8 q8MP1P+/1dQIQPz30sXq8/JW1h3A5sEJkpfeY1/FQd/YueIKbarNTTRpwM0y+QQviitdED JfbXrPdJyyLZXJKgwhH9PID9iAfzAbTMU72XIrZ/UBRPT5D+t9RZg/c+j99Q8Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1650807014; a=rsa-sha256; cv=none; b=AFNp9cWBHie0druMKdprKi6UQK+iqq4UeSz/qmmoOWKdVsJaFNUKaT4HGPMoAHKj2XQox9 TghzYa4c3Q7AGRkFniwkUL0VKgBlGbiXBLkBxm5gkot4To9NqFNkQ2JspUf0HCJWUXeWK8 DJ6O10uY28OKZTKpXlhRfTf9PTgJl5+ShZPWu7MrbPrCXhH/cuRcr79+1VAQLqgX/aoSVc UFmGWPARhPwr9Szx7WqnA/XrcHMadSdX36AbaL8XTaBALgvAH/+zNeXy0Bk153Zkj5yB5D gdteJqpBsJSqLVBvU6E+5hx53YCr6vj+IgjCAqxLCKJcOhYs7QxRKTR/R7rN5w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D235438 --- Comment #4 from commit-hook@FreeBSD.org --- A commit in branch stable/12 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=3Db57954717ddfe52be9e18591d302c61e5= 0db0aa6 commit b57954717ddfe52be9e18591d302c61e50db0aa6 Author: Kyle Evans AuthorDate: 2022-01-27 18:02:17 +0000 Commit: Kyle Evans CommitDate: 2022-04-24 03:48:56 +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.=