1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-29 05:38:00 +00:00

shells/ksh: Update to 1.0.6

From the announcement:

This is an urgent bugfix release that fixes a serious regression in
pathname expansion, see: https://github.com/ksh93/ksh/issues/660
The previous 1.0.5 release is withdrawn and should not be used.

Main changes between 1.0.5 and 1.0.6:

- Fixed a serious regression in pathname expansion where quoted wildcard
   characters were incorrectly expanded if a pattern contains both a brace
   expansion and a variable expansion.
- Fixed a bug where the command to launch a full-screen editor (^X^E in
   emacs and 'v' in vi) could cause the wrong command line to be edited
   if two shell sessions share a .sh_history file.

1.0.5 had a large amount of bugfixes compared to 93u+m/1.0.4. In summary:

- Fixed various bugs causing crashes.
- Fixed many bugs in the emacs and vi line editors, in command completion,
   and in file name completion.
- Fixed various bugs in the handling of quotes, backslash escapes and braces
   when processing shell glob patterns (e.g. in pathname expansion and
'case').
- ksh now throws a panic and exits if a read error (such as an I/O error)
   occurs while trying to read the next command(s) from a running script.
- Fixed many bugs in 'printf' and 'print -f' built-in commands, including:
   . Multiple bugs causing incorrect output for relative date
specifications,
     e.g., printf %T\\n 'exactly 20 months ago' now outputs a correct
result.
   . More printf bugs with mix and match of % and %x$.
   . A data corruption bug when using %B with 'printf -v varname'.
   . A bug causing double evaluation of arithmetic expressions.
- Fixed a bug where 'unset -f commandname', executed in a subshell, hides
   any built-in command by the same name for the duration of that subshell.
- Fixed ${var/#/string} and ${var/%/string} (with anchored empty pattern)
   to work as on mksh, bash and zsh; these are no longer ineffective.
- Fixed incorrect result of array slicing ${array[@]:offset:length} where
   'length' is a nested expansion involving an array.
- Command names can now end in ':' as they can on other shells.
- Fixed a spurious syntax error in compound assignments upon encountering a
   pair of repeated opening parentheses '(('.
- Fixed spurious syntax error in ${parameter:offset:length}: the arithmetic
   expressions 'offset' and 'length' may now contain the operators ( ) & |.
- Fixed a parsing bug in the declaration of .sh.math.* arithmetic functions.
- Fixed nameref self-reference loop detection for more than two namerefs.
- Several improvements to the POSIX compatibility mode.
- Many more minor and/or esoteric bugfixes.
This commit is contained in:
Cy Schubert 2023-06-13 11:50:46 -07:00
parent 94742ef781
commit f3cb8cd9be
3 changed files with 4 additions and 89 deletions

View File

@ -10,8 +10,7 @@
DISTVERSIONPREFIX= v DISTVERSIONPREFIX= v
PORTNAME= ksh PORTNAME= ksh
PORTVERSION= 1.0.5 PORTVERSION= 1.0.6
PORTREVISION= 2
CATEGORIES= shells CATEGORIES= shells
MAINTAINER= cy@FreeBSD.org MAINTAINER= cy@FreeBSD.org

View File

@ -1,3 +1,3 @@
TIMESTAMP = 1686152726 TIMESTAMP = 1686681922
SHA256 (ksh93-ksh-v1.0.5_GH0.tar.gz) = 940d6dd6b4204f4965cf87cbba5bdf2d2c5153975100ee242038425f9470c0fe SHA256 (ksh93-ksh-v1.0.6_GH0.tar.gz) = bcb230cb3cbe045e0c08ed8d379fb4e1b434784bb0aab0e990c51a03e63d6721
SIZE (ksh93-ksh-v1.0.5_GH0.tar.gz) = 2109689 SIZE (ksh93-ksh-v1.0.6_GH0.tar.gz) = 2111386

View File

@ -1,84 +0,0 @@
--- src/cmd/ksh93/sh/macro.c.orig 2023-06-06 21:29:33.000000000 -0700
+++ src/cmd/ksh93/sh/macro.c 2023-06-12 19:23:44.427794000 -0700
@@ -76,6 +76,7 @@
char macsub; /* set to 1 when running mac_substitute */
int dotdot; /* set for .. in subscript */
void *nvwalk; /* for name space walking */
+ char bracketexpr; /* set when in [brackets] within a non-ERE glob pattern */
} Mac_t;
#undef ESCAPE
@@ -437,7 +438,6 @@
char oldquote = mp->quote; /* save "double quoted" state */
char ansi_c = 0; /* set when processing ANSI C escape codes */
int32_t ere = 0; /* bitmask of pattern options indicating an extended regular expression */
- char bracketexpr = 0; /* set when in [brackets] within a non-ERE glob pattern */
Sfio_t *sp = mp->sp;
Stk_t *stkp = sh.stk;
char *resume = 0;
@@ -533,7 +533,7 @@
if(mp->pattern)
{
/* preserve \ for escaping glob pattern bracket expression operators */
- if(bracketexpr && n==S_BRAOP)
+ if(mp->bracketexpr && n==S_BRAOP)
break;
/* preserve \digit for pattern matching */
/* also \alpha for extended patterns */
@@ -636,8 +636,8 @@
mp->pattern = c;
break;
case S_ENDCH:
- if(bracketexpr && cp[-1]==RBRACT && !(mp->quote || mp->lit))
- bracketexpr--;
+ if(mp->bracketexpr && cp[-1]==RBRACT && !(mp->quote || mp->lit))
+ mp->bracketexpr--;
if((mp->lit || cp[-1]!=endch || mp->quote!=newquote))
goto pattern;
if(endch==RBRACE && mp->pattern && brace)
@@ -738,12 +738,12 @@
cp = first = fcseek(0);
break;
}
- if(mp->pattern==1 && !ere && !bracketexpr)
+ if(mp->pattern==1 && !ere && !mp->bracketexpr)
{
- bracketexpr++;
+ mp->bracketexpr++;
/* a ] following [, as in []abc], should not close the bracket expression */
if(cp[0]==RBRACT && cp[1])
- bracketexpr++;
+ mp->bracketexpr++;
}
/* FALLTHROUGH */
case S_PAT:
@@ -883,7 +883,7 @@
break;
case S_BRAOP:
/* escape a quoted !^- within a bracket expression */
- if(!bracketexpr || !(mp->quote || mp->lit))
+ if(!mp->bracketexpr || !(mp->quote || mp->lit))
continue;
if(c)
sfwrite(stkp,first,c);
@@ -2481,7 +2481,10 @@
continue;
}
if(n==S_ESC)
- sfputc(stkp,ESCAPE);
+ {
+ if(!mp->bracketexpr)
+ sfputc(stkp,ESCAPE);
+ }
else if(n==S_EPAT)
{
/* don't allow extended patterns in this case */
@@ -2582,7 +2585,7 @@
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 */