On Sun, Nov 15, 2020 at 07:19:07PM +0100, Paul de Weerd wrote:
> Hi all,
> 
> It was pointed out to me off-list that I introduced a regression for
> the case that has '+' as one of its arguments, e.g.:
> 
>       [weerd@pom] $ find /var/empty -exec echo + {} +
>       find: -exec: "+" should follow {}
>                 
> Updated diff fixes that case:
> 
>       [weerd@pom] $ ./find /var/empty -exec echo cp {} /tmp/dest +
>       find: -exec: "+" should follow {}
>       [weerd@pom] $ ./find /var/empty -exec echo + {} +
>       + /var/empty
> 
> Any thoughts or concerns?  Other regressions?
> 
> Thanks,
> 
> Paul

I googled for "POSIX find", and hit this:

https://pubs.opengroup.org/onlinepubs/009695399/utilities/find.html

=> "Only a plus sign that follows an argument containing the two
    characters "{}" shall punctuate the end of the primary expression.
    Other uses of the plus sign shall not be treated as special."

What you do in your diff is exactly that, treating it special.

The manual page could maybe be more exact, but otherwise sth like
this could be enough (pardon the git diff, but you get the point).

/Alexander

diff --git a/usr.bin/find/function.c b/usr.bin/find/function.c
index 3d7f4963b1f..727f8dce43f 100644
--- a/usr.bin/find/function.c
+++ b/usr.bin/find/function.c
@@ -564,7 +564,7 @@ c_exec(char *unused, char ***argvp, int isok)
         */
        for (ap = argv = *argvp, brace = 0;; ++ap) {
                if (!*ap)
-                       errx(1, "%s: no terminating \";\" or \"+\"",
+                       errx(1, "%s: no terminating \";\" or \"{} +\"",
                            isok ? "-ok" : "-exec");
                lastbrace = brace;
                brace = 0;

Reply via email to