On 4/12/24 13:24, enh via Toybox wrote: > ~/aosp-main-with-phones$ find external/ -name NOTICE -type l -maxdepth 2 > find: warning: you have specified the global option -maxdepth after > the argument -name, but global options are not positional, i.e., > -maxdepth affects tests specified before it as well as those specified > after it. Please specify global options before other arguments.
Looking back at this (ok, closing tabs), I think I implemented this the same as any other option, so you can "-type l -o -maxdepth 2" and friends. The thing is, when maxdepth triggers it returns without recursing on the path being evaluated, so you'd have to "-type d -o maxdepth 2" for the difference to matter. (Recursing into lower entries but not triggering on them.) But it's not "global" in any magic way. It's just... another option? Which doesn't seem WRONG... And of course https://pubs.opengroup.org/onlinepubs/9699919799/utilities/find.html hasn't got maxdepth. Meanwhile, busybox has: //config:config FEATURE_FIND_MAXDEPTH //config: bool "Enable -mindepth N and -maxdepth N" //config: default y //config: depends on FIND And: #define INIT_G() do { \ setup_common_bufsiz(); \ BUILD_BUG_ON(sizeof(G) > COMMON_BUFSIZE); \ /* we have to zero it out because of NOEXEC */ \ memset(&G, 0, sizeof(G)); \ IF_FEATURE_FIND_MAXDEPTH(G.minmaxdepth[1] = INT_MAX;) \ IF_FEATURE_FIND_EXEC_PLUS(G.max_argv_len = bb_arg_max() - 2048;) \ G.need_print = 1; \ G.recurse_flags = ACTION_RECURSE; \ } while (0) And I miss the days when I worked on that project and it was SIMPLE. I liked simple. That's what attracted me to it in the first place... https://git.busybox.net/busybox/commit/?id=053c12e0de30 Yeah, I'm not even trying to understand that right now. I'll take my 730 lines over their 1750 lines any day, I don't CARE who has the smaller binary size after stripping specific ELF table entries... Anyway, I should come up with a test for maxdepth acting as a normal option vs acting as a global option... Rob _______________________________________________ Toybox mailing list Toybox@lists.landley.net http://lists.landley.net/listinfo.cgi/toybox-landley.net