1From b82903e6fbe37eb4feeeec259600611d46a71282 Mon Sep 17 00:00:00 2001 2From: =?UTF-8?q?S=C3=B6ren=20Tempel?= <soeren+git@soeren-tempel.net> 3Date: Sat, 11 Jan 2025 11:30:24 +0100 4Subject: [PATCH] find: fix compatibility with GNU getopt(3) 5 6By default, GNU getopt(3) will continue parsing options after the 7first nonoption. This behavior is incompatible with this find(1) 8implementation, causing parts of the expression to be parsed as 9(invalid) options.1011The behavior can be disabled by prefixing the option string with12a `+` character. Other applets, such as flock or mcookie do it13already so it would be cool to do this here too to make find(1)14compatible with glibc.15---16 src.freebsd/findutils/find/main.c | 2 +-17 1 file changed, 1 insertion(+), 1 deletion(-)1819diff --git a/src.freebsd/findutils/find/main.c b/src.freebsd/findutils/find/main.c20index 931d811..876d532 10064421--- a/src.freebsd/findutils/find/main.c22+++ b/src.freebsd/findutils/find/main.c23@@ -90,7 +90,7 @@ main(int argc, char *argv[])24 p = start = argv;25 Hflag = Lflag = 0;26 ftsoptions = FTS_NOSTAT | FTS_PHYSICAL;27- while ((ch = getopt(argc, argv, "EHLPXdf:sx")) != -1)28+ while ((ch = getopt(argc, argv, "+EHLPXdf:sx")) != -1)29 switch (ch) {30 case 'E':31 regexp_flags |= REG_EXTENDED;