From nobody Mon Jan 15 18:50:00 2024 X-Original-To: dev-commits-src-all@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 4TDLmT2Dx4z57L2X; Mon, 15 Jan 2024 18:50:01 +0000 (UTC) (envelope-from git@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 4TDLmT1Fr0z4Wd1; Mon, 15 Jan 2024 18:50:01 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1705344601; 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; bh=oT6zbWvo4BGKwdqD1mphsE4VvoyF+3xoTC04aK0ZiMI=; b=orRoYXvWen30ytm76bXHikGZ3065FWnJxUCJ0ppYim++NHO8aPcFZ12S24c41CzwMIj9bt HKB990yQUXn0ocEK8wGzxcGTuT6dfQ5Qn1EcoDji9gRGIgo4m54gsCQU5DqU2/d2C9ZxPe /u0L633shDneC8r5rwg/1DssDGvcezFqy+ov6Gb2ZEhQWLwURs/8o52t/YCik1L+oYXhF0 qUdX0FQh3qmU3j8m+3lXIIhoDsa2uVTi7/IpTCTDdfOsosGPsAKxI68TfkyLwFpaQqU6V/ wdl6/ymF7WHauuiG8BKm1S4J+csoCf0V9nSOctcqQDAcE1hzFfKu1OsorgmJXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1705344601; 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; bh=oT6zbWvo4BGKwdqD1mphsE4VvoyF+3xoTC04aK0ZiMI=; b=SSyY0UgGcVK9mUaZBoNeaYu5AKJb8rJA+k6Rc74NvBUxI/OCsP0q+UBSn8GIavazhIz4tM XY21XZCCJKQuz2yD+BRIP1MrLi42EuHfiQJyhllbaDY2F+07GDXvioRHUgZEIccnSjgPLl z/mpadxbEMm1xwxmiIRwbVlhw6GfuPMZEwGzYSWkjTLm29jzXhjnJcuq37DR/uK5B2+PtT OdCqm2B7meC/nfONeJtJON72nY8RjBCWMGT8dc7lM1A/iSYzS2w/I5esW/UnU/jpVYl4jK SxXQnAlEurn7GvJRMr7AhiIHMwLQwDzP/7ViVL4GIpIR9lW848QIQN6MPfkJOQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1705344601; a=rsa-sha256; cv=none; b=huphza2W+eGJm1VBcFYfodDTU5q7XUJHKFBuNd47ppP3Pgaa2OpammQ0ADZzcifqp4GXvN uM+XPiO4N9PZpl//twuTUwOwpO8moO8GQq27+0HIKrbf4R7zd5a/wKa2n4oNATa7TnziWb k+jJjnGbrxJqbTknamTEC9u51P/InScN7cY0mquD/atx3/+D+ddYtHb3Px0gRdJFyehwGe nUjSmkpohu4LbE5xvkPFjxM6UsFyWlr5ppSPohtDqyw9ZvLUqxitGVIn9Vau+kYJJQMiV/ 4z4ZErp2BW7pm2+bf+hI1gbCe2xqoLMd+IUfKJAxWjUehYuA0bsBadlKMw6y6g== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 4TDLmT0LpNz17SG; Mon, 15 Jan 2024 18:50:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 40FIo0Ok048858; Mon, 15 Jan 2024 18:50:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 40FIo0GI048838; Mon, 15 Jan 2024 18:50:00 GMT (envelope-from git) Date: Mon, 15 Jan 2024 18:50:00 GMT Message-Id: <202401151850.40FIo0GI048838@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 2a121b97e967 - main - find: Allow '/' to be used with -perm for GNU compatibility List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2a121b97e9673ff37062c9fa026eee969940d2e2 Auto-Submitted: auto-generated The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=2a121b97e9673ff37062c9fa026eee969940d2e2 commit 2a121b97e9673ff37062c9fa026eee969940d2e2 Author: Ricardo Branco AuthorDate: 2024-01-15 18:35:27 +0000 Commit: Warner Losh CommitDate: 2024-01-15 18:47:24 +0000 find: Allow '/' to be used with -perm for GNU compatibility In 2005, Gnu find deprecated '+' as the leading character for the -perm argument, instead preferring '/' with the same meaning. Implement that behavior here, and document it in the man page. Reviewed by: imp, emaste Pull Request: https://github.com/freebsd/freebsd-src/pull/1060 --- usr.bin/find/find.1 | 19 ++++++++++++++++--- usr.bin/find/function.c | 2 +- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/usr.bin/find/find.1 b/usr.bin/find/find.1 index de16b012ce4d..856961d02395 100644 --- a/usr.bin/find/find.1 +++ b/usr.bin/find/find.1 @@ -28,7 +28,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd December 22, 2023 +.Dd January 15, 2024 .Dt FIND 1 .Os .Sh NAME @@ -757,7 +757,7 @@ Slashes .Pq Dq Li / are treated as normal characters and do not have to be matched explicitly. -.It Ic -perm Oo Cm - Ns | Ns Cm + Oc Ns Ar mode +.It Ic -perm Oo Cm - Ns | Ns Cm + Ns | Ns Cm / Oc Ns Ar mode The .Ar mode may be either symbolic (see @@ -786,11 +786,14 @@ are set in the file's mode bits. If the .Ar mode is preceded by a plus -.Pq Dq Li + , +.Pq Dq Li + this primary evaluates to true if any of the bits in the .Ar mode are set in the file's mode bits. +A slash +.Pq Dq Li / +is also accepted with the same meaning as plus for compatibility with GNU find. Otherwise, this primary evaluates to true if the bits in the .Ar mode @@ -1116,6 +1119,16 @@ option was inspired by the equivalent and .Xr sed 1 options. +.Pp +The +.Ic -perm +primary accepts a leading slash +.Pq Dq Li / +as an alias for a leading plus +.Pq Dq Li + +for its argument as an extension of +.St -p1003.1-2001 +to be compatible with GNU find. .Sh HISTORY A simple .Nm diff --git a/usr.bin/find/function.c b/usr.bin/find/function.c index 43aa2301439c..f96a086cbda3 100644 --- a/usr.bin/find/function.c +++ b/usr.bin/find/function.c @@ -1338,7 +1338,7 @@ c_perm(OPTION *option, char ***argvp) if (*perm == '-') { new->flags |= F_ATLEAST; ++perm; - } else if (*perm == '+') { + } else if (*perm == '+' || *perm == '/') { new->flags |= F_ANY; ++perm; }