Disable tilde expansion after = (Debian PR #187839),

but only in POSIX mode
This commit is contained in:
tg 2005-05-25 10:01:24 +00:00
parent 1dd37a1086
commit 7305a6db5e
2 changed files with 7 additions and 4 deletions

7
eval.c
View File

@ -1,4 +1,4 @@
/** $MirOS: src/bin/mksh/eval.c,v 1.2 2005/05/23 15:18:15 tg Exp $ */
/** $MirOS: src/bin/mksh/eval.c,v 1.3 2005/05/25 10:01:24 tg Exp $ */
/* $OpenBSD: eval.c,v 1.27 2005/03/30 17:16:37 deraadt Exp $ */
#include "sh.h"
@ -6,7 +6,7 @@
#include <dirent.h>
#include <pwd.h>
__RCSID("$MirOS: src/bin/mksh/eval.c,v 1.2 2005/05/23 15:18:15 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/eval.c,v 1.3 2005/05/25 10:01:24 tg Exp $");
/*
* string expansion
@ -613,7 +613,8 @@ expand(char *cp, /* input word */
break;
case '=':
/* Note first unquoted = for ~ */
if (!(f & DOTEMP_) && !saw_eq) {
if (!(f & DOTEMP_) && (!Flag(FPOSIX)
|| (f & DOASNTILDE)) && !saw_eq) {
saw_eq = 1;
tilde_ok = 1;
}

4
mksh.1
View File

@ -1,4 +1,4 @@
.\" $MirOS: src/bin/mksh/mksh.1,v 1.2 2005/05/23 13:44:13 tg Exp $
.\" $MirOS: src/bin/mksh/mksh.1,v 1.3 2005/05/25 10:01:24 tg Exp $
.\" $OpenBSD: ksh.1,v 1.98 2005/05/12 09:18:24 jmc Exp $
.\" $OpenBSD: sh.1tbl,v 1.53 2004/12/10 01:56:56 jaredy Exp $
.\"
@ -2469,6 +2469,8 @@ in non-POSIX mode, it tests if file descriptor 1 is a
argument to the
.Fl t
test may be left out and defaults to 1).
.It
Tilde expansion after equal signs is disabled.
.El
.Ss Strict Bourne shell mode
When the