shells/ksh: Fix ksh 1.0.5 Regression (issue #660)

From issue #660:

Globs are not expanded with the following:

% echo "/"{bin,sbin}"/*"
/bin/* /sbin/*

% v=/; echo "$v"bin"/*"
/bin/*

But globbing is unexpectedly performed if both parameter substitution
and brace expansion are present:

	% v=/; echo "$v"{bin,sbin}"/*"
	[output omitted for the sake of brevity]

Obtained from:	https://github.com/ksh93/ksh/issues/660
MFH:		2023Q3
This commit is contained in:
Cy Schubert
2023-06-12 02:03:52 -07:00
parent ea591b90ea
commit a2ba1fd2c5
2 changed files with 14 additions and 0 deletions
+1
View File
@@ -11,6 +11,7 @@
DISTVERSIONPREFIX= v
PORTNAME= ksh
PORTVERSION= 1.0.5
PORTREVISION= 1
CATEGORIES= shells
MAINTAINER= cy@FreeBSD.org
@@ -0,0 +1,13 @@
diff --git src/cmd/ksh93/sh/macro.c.orig src/cmd/ksh93/sh/macro.c
index aba6f9d..0d60219 100644
--- src/cmd/ksh93/sh/macro.c.orig
+++ src/cmd/ksh93/sh/macro.c
@@ -2582,7 +2582,7 @@ static void endfield(Mac_t *mp,int split)
mp->atmode = 0;
if(mp->patfound)
{
- int musttrim = mp->wasexpan && !mp->noextpat && strchr(argp->argval,'\\');
+ int musttrim = mp->wasexpan && !mp->quoted && !mp->noextpat && strchr(argp->argval,'\\');
sh.argaddr = 0;
#if SHOPT_BRACEPAT
/* in POSIX mode, disallow brace expansion for unquoted expansions */