[PATCH v2] expand: Fix glibc glob(3) support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Mar 26, 2018 at 12:27:41AM +0800, Herbert Xu wrote:
>
> I tried making it work, and it looks like it should work with
> the latest glibc as they have just fixed a critical issue that
> would otherwise require nasty hacks to work around:
> 
> 	https://sourceware.org/bugzilla/show_bug.cgi?id=866
> 
> So I'll give it some time to filter through before trying it again.

OK, with this patch and glibc 2.27 it appears to be working:

---8<---
It's been a while since we disabled glob(3) support by default.
It appears to be working now, however, we have to change our
code to detect the no-match case correctly.

In particular, we need to test for GLOB_NOMAGIC | GLOB_NOCHECK
instead of GLOB_MAGCHAR.

Signed-off-by: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>

diff --git a/src/expand.c b/src/expand.c
index 705fef7..bc1f760 100644
--- a/src/expand.c
+++ b/src/expand.c
@@ -1188,7 +1188,8 @@ expandmeta(str, flag)
 			ckfree(p);
 		switch (i) {
 		case 0:
-			if (!(pglob.gl_flags & GLOB_MAGCHAR))
+			if ((pglob.gl_flags & (GLOB_NOMAGIC | GLOB_NOCHECK)) ==
+			    (GLOB_NOMAGIC | GLOB_NOCHECK))
 				goto nometa2;
 			addglob(&pglob);
 			globfree(&pglob);
-- 
Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
To unsubscribe from this list: send the line "unsubscribe dash" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux