URL: <https://savannah.gnu.org/bugs/?66365>
Summary: find -exec treats + as special when it shouldn't
Group: findutils
Submitter: geoffclare
Submitted: Tue 22 Oct 2024 10:43:11 AM UTC
Category: None
Severity: 3 - Normal
Item Group: None
Status: None
Privacy: Public
Assigned to: None
Originator Name:
Originator Email:
Open/Closed: Open
Discussion Lock: Any
Release: None
Fixed Release: None
_______________________________________________________
Follow-up Comments:
-------------------------------------------------------
Date: Tue 22 Oct 2024 10:43:11 AM UTC By: Geoff Clare <geoffclare>
POSIX requires that a "+" supplied to "-exec" is only treated as special when
it follows an argument that is exactly "{}".
So in the command:
find . -prune -exec echo x{} + \;
the "+" is not special and the command should output "x. +", but GNU find
treats it as special:
$ find . -prune -exec echo x{} + \;
find: In ‘-exec ... {} +’ the ‘{}’ must appear by itself, but you
specified ‘x{}’
Tested with findutils 4.9.0 as included in Debian bookworm.
Here's the relevant text from POSIX.1-2024 (it was the same in .1-2008):
"Only a <plus-sign> that immediately follows an argument containing only the
two characters "{}" shall punctuate the end of the primary expression. Other
uses of the <plus-sign> shall not be treated as special."
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?66365>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
signature.asc
Description: PGP signature
