mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-03-09 15:50:02 +00:00
Fix type names starting with lowercase 'a' (#69)
Type names that start with a lowercase 'a' cause an error when used:
$ typeset -T al=(typeset bar)
$ al foo=(bar=testset)
/usr/bin/ksh: al: : invalid variable name
The error occurs because when the parser checks for the alias
builtin (to set 'assignment' to two instead of one), only the first
letter of 'argp->argval' is checked (rather than the entire
string). This was fixed in ksh93v- by comparing argp->argval
against "alias", but in ksh93u+m the check can simply be removed
because it is only run when a builtin has the BLT_DCL flag. As of
04b9171
, the alias builtin does not have that flag.
src/cmd/ksh93/sh/parse.c:
- Remove the bugged check for the alias builtin.
src/cmd/ksh93/tests/types.sh:
- Add a regression test for type names starting with a lowercase 'a'.
This commit is contained in:
parent
f9d28935bb
commit
c4236cc295
4 changed files with 10 additions and 2 deletions
5
NEWS
5
NEWS
|
@ -3,6 +3,11 @@ For full details, see the git log at: https://github.com/ksh93/ksh
|
||||||
|
|
||||||
Any uppercase BUG_* names are modernish shell bug IDs.
|
Any uppercase BUG_* names are modernish shell bug IDs.
|
||||||
|
|
||||||
|
2020-07-10:
|
||||||
|
|
||||||
|
- Fixed a bug that caused types created with 'typeset -T' to throw an error
|
||||||
|
when used if the type name started with a lowercase 'a'.
|
||||||
|
|
||||||
2020-07-09:
|
2020-07-09:
|
||||||
|
|
||||||
- Fixed a crash on syntax error when sourcing/dotting multiple files.
|
- Fixed a crash on syntax error when sourcing/dotting multiple files.
|
||||||
|
|
|
@ -17,4 +17,4 @@
|
||||||
* David Korn <dgk@research.att.com> *
|
* David Korn <dgk@research.att.com> *
|
||||||
* *
|
* *
|
||||||
***********************************************************************/
|
***********************************************************************/
|
||||||
#define SH_RELEASE "93u+m 2020-07-09"
|
#define SH_RELEASE "93u+m 2020-07-10"
|
||||||
|
|
|
@ -1477,7 +1477,7 @@ static Shnode_t *simple(Lex_t *lexp,int flag, struct ionod *io)
|
||||||
t->comnamp = (void*)np;
|
t->comnamp = (void*)np;
|
||||||
if(nv_isattr(np,BLT_DCL))
|
if(nv_isattr(np,BLT_DCL))
|
||||||
{
|
{
|
||||||
assignment = 1+(*argp->argval=='a');
|
assignment = 1;
|
||||||
if(np==SYSTYPESET)
|
if(np==SYSTYPESET)
|
||||||
lexp->intypeset = 1;
|
lexp->intypeset = 1;
|
||||||
key_on = 1;
|
key_on = 1;
|
||||||
|
|
|
@ -642,5 +642,8 @@ bar.foo+=(bam)
|
||||||
# 'typeset -RF' should not create variables that cause crashes
|
# 'typeset -RF' should not create variables that cause crashes
|
||||||
"$SHELL" -c 'typeset -RF foo=1; test $foo' || err_exit 'typeset -RF does not work'
|
"$SHELL" -c 'typeset -RF foo=1; test $foo' || err_exit 'typeset -RF does not work'
|
||||||
|
|
||||||
|
# Type names that have 'a' as the first letter should be functional
|
||||||
|
"$SHELL" -c 'typeset -T al=(typeset bar); al foo=(bar=testset)' || err_exit "type names that start with 'a' don't work"
|
||||||
|
|
||||||
# ======
|
# ======
|
||||||
exit $((Errors<125?Errors:125))
|
exit $((Errors<125?Errors:125))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue