[klibc] [klibc:update-dash] dash: expand: Fix glibc glob(3) support

klibc-bot for Herbert Xu herbert at gondor.apana.org.au
Sat Mar 28 14:49:06 PDT 2020


Commit-ID:  a38ba2beea4bb2eea36e687d2527ddb78717ea42
Gitweb:     http://git.kernel.org/?p=libs/klibc/klibc.git;a=commit;h=a38ba2beea4bb2eea36e687d2527ddb78717ea42
Author:     Herbert Xu <herbert at gondor.apana.org.au>
AuthorDate: Mon, 26 Mar 2018 17:50:24 +0800
Committer:  Ben Hutchings <ben at decadent.org.uk>
CommitDate: Sat, 28 Mar 2020 21:42:54 +0000

[klibc] dash: expand: Fix glibc glob(3) support

[ dash commit 6900ff60ef7347a8c1445853a8f4689808e0976e ]

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 at gondor.apana.org.au>
Signed-off-by: Ben Hutchings <ben at decadent.org.uk>

---
 usr/dash/expand.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/usr/dash/expand.c b/usr/dash/expand.c
index f52f34c9..3abfa0c4 100644
--- a/usr/dash/expand.c
+++ b/usr/dash/expand.c
@@ -1205,7 +1205,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);


More information about the klibc mailing list