From nobody Mon Apr 08 19:04:14 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 4VCz671Wvcz5HYVk; Mon, 8 Apr 2024 19:04:15 +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 4VCz6703SHz4fr5; Mon, 8 Apr 2024 19:04:15 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1712603055; 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=iu+YatGObTpd7gnIfKaBEvyCJ7S2Qa4DKY9dob2XnOM=; b=lEC4D0Wi4F/p+/8cCO2FDnfb6wsWZ8sF69QB7smjAvkWetRI2AzU1FoQxlmxr314AHbDlI SeaAxsqz2H5lO39aa/dhEigRndXd3JlSXFILDn+Ga5lwO4aOyXkmVTXaIg1C7vk5OMPbyp rhiwKPCi7NRu+eMeCX5j+M2WtO0bG/x+LHkBsUVnUwA7HuUSZM0/loL99nxoZDxH7R8ggW 9CwP/wRFlgboJDXOrf1C0pXJPmfOHaclzUvLcIFIfpqCTA7eGeosyHdyN16RO3ieTOquWw dOEDejJUIT7ud0dwcOls2EhvNcSogUEo9h75WAcFDUnxXdHf6yVixKa72vzWzg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1712603055; a=rsa-sha256; cv=none; b=s1bI6hVrkuwgTlR5/dFXONUZVxc9ljYKR+EuyorTim76miftBrameIl/fqykBjmpA+MWon 2GudvuFDn1VtujuwjedJHO4lLKYz8w3q2oh4mnZNpflbhW9S7FxdIFUfMXR2MkBhYBde6c VqauLoiid+e9DFP+dcAXnLTqApavT+TDv/WopEQ5BGvlOIelKPzVsjS0L47nvdQc1m+Y86 TAuKB9Wat2rGrv186TrKzvTYqELCz3gqE4L/1lWOdNNlm153lv6qkPOwoGkCauWLNwbROC tKZH0TBCLWqxUueSZLK2+AXRvAOHenaqG1VphkeTkLO3HFehKxRJdsNlm/d2OA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1712603055; 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=iu+YatGObTpd7gnIfKaBEvyCJ7S2Qa4DKY9dob2XnOM=; b=EZyRBWdR/kUk4wHk7iBJgcCsRRDqHNif2Qa8M+/FNz5DsOI2TaQYHb06UHtiN8Sj28qflE XuIXqmX4Rg3V+6Iuv1fq/VIxybSyN5PZ7P7a38EpyDydF5nWqBTYdlS+bq12SUVUydHEWq Tqq4VKC0y9CGyFeu/a5AJ3Lh5Y6o86S3yLaxMqgEhf7PcWbNFXXD+DWVKPDSg//XtCxzX6 gqIg9U+MwUFBzk2FjftLQZPz9/bp+SU/kquzNIGletAEUjxwuv3MavOKZfzJ1AP68Ni3Sk PjPcc/oOQKyn/XEBEGQSB/13VyCjYXkXY2AWdxW/yJ2DyJDBuJO0JYkgTb1A3g== 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 4VCz666TQkzNSk; Mon, 8 Apr 2024 19:04:14 +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 438J4EeJ093615; Mon, 8 Apr 2024 19:04:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 438J4Eea093612; Mon, 8 Apr 2024 19:04:14 GMT (envelope-from git) Date: Mon, 8 Apr 2024 19:04:14 GMT Message-Id: <202404081904.438J4Eea093612@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 1aebbbc69bb6 - stable/14 - 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: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 1aebbbc69bb65f35c60493479df62486a7b74a04 Auto-Submitted: auto-generated The branch stable/14 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=1aebbbc69bb65f35c60493479df62486a7b74a04 commit 1aebbbc69bb65f35c60493479df62486a7b74a04 Author: Ricardo Branco AuthorDate: 2024-01-15 18:35:27 +0000 Commit: John Baldwin CommitDate: 2024-04-08 17:33:19 +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 (cherry picked from commit 2a121b97e9673ff37062c9fa026eee969940d2e2) --- 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 afa4c7ab8215..a73196180e7c 100644 --- a/usr.bin/find/find.1 +++ b/usr.bin/find/find.1 @@ -30,7 +30,7 @@ .\" .\" @(#)find.1 8.7 (Berkeley) 5/9/95 .\" -.Dd December 22, 2023 +.Dd January 15, 2024 .Dt FIND 1 .Os .Sh NAME @@ -759,7 +759,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 @@ -788,11 +788,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 @@ -1118,6 +1121,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 d887c8479099..9c1fd4df8731 100644 --- a/usr.bin/find/function.c +++ b/usr.bin/find/function.c @@ -1343,7 +1343,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; }