do not apply alias name restrictions to directories or “hash”

reported by Seb <sbb@tuxfamily.org>
This commit is contained in:
tg 2017-04-17 19:51:47 +00:00
parent f5c804d416
commit 2699a0686e
3 changed files with 11 additions and 10 deletions

10
check.t
View File

@ -1,4 +1,4 @@
# $MirOS: src/bin/mksh/check.t,v 1.775 2017/04/12 17:38:41 tg Exp $
# $MirOS: src/bin/mksh/check.t,v 1.776 2017/04/17 19:51:44 tg Exp $
# -*- mode: sh -*-
#-
# Copyright © 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
@ -30,7 +30,7 @@
# (2013/12/02 20:39:44) http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/regress/bin/ksh/?sortby=date
expected-stdout:
@(#)MIRBSD KSH R55 2017/04/12
@(#)MIRBSD KSH R55 2017/04/17
description:
Check version of shell.
stdin:
@ -39,7 +39,7 @@ name: KSH_VERSION
category: !shell:legacy-yes,!shell:textmode-yes
---
expected-stdout:
@(#)LEGACY KSH R55 2017/04/12
@(#)LEGACY KSH R55 2017/04/17
description:
Check version of legacy shell.
stdin:
@ -48,7 +48,7 @@ name: KSH_VERSION-legacy
category: !shell:legacy-no,!shell:textmode-yes
---
expected-stdout:
@(#)MIRBSD KSH R55 2017/04/12 +TEXTMODE
@(#)MIRBSD KSH R55 2017/04/17 +TEXTMODE
description:
Check version of shell.
stdin:
@ -57,7 +57,7 @@ name: KSH_VERSION-textmode
category: !shell:legacy-yes,!shell:textmode-no
---
expected-stdout:
@(#)LEGACY KSH R55 2017/04/12 +TEXTMODE
@(#)LEGACY KSH R55 2017/04/17 +TEXTMODE
description:
Check version of legacy shell.
stdin:

View File

@ -38,7 +38,7 @@
#endif
#endif
__RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.340 2017/04/12 17:46:29 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.341 2017/04/17 19:51:46 tg Exp $");
#if HAVE_KILLPG
/*
@ -758,7 +758,7 @@ c_alias(const char **wp)
{
struct table *t = &aliases;
int rv = 0, prefix = 0;
bool rflag = false, tflag, Uflag = false, pflag = false;
bool rflag = false, tflag, Uflag = false, pflag = false, chkalias;
uint32_t xflag = 0;
int optc;
@ -809,6 +809,7 @@ c_alias(const char **wp)
}
tflag = t == &taliases;
chkalias = t == &aliases;
/* "hash -r" means reset all the tracked aliases.. */
if (rflag) {
@ -851,7 +852,7 @@ c_alias(const char **wp)
strndupx(xalias, alias, val++ - alias, ATEMP);
alias = xalias;
}
if (!valid_alias_name(alias) || *alias == '-') {
if (chkalias && (!valid_alias_name(alias) || *alias == '-')) {
bi_errorf(Tinvname, alias, Talias);
afree(xalias, ATEMP);
return (1);

4
sh.h
View File

@ -175,9 +175,9 @@
#endif
#ifdef EXTERN
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.808 2017/04/12 17:38:46 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.809 2017/04/17 19:51:47 tg Exp $");
#endif
#define MKSH_VERSION "R55 2017/04/12"
#define MKSH_VERSION "R55 2017/04/17"
/* arithmetic types: C implementation */
#if !HAVE_CAN_INTTYPES