In argv_exp3() where we cut a line into args, check for '\' as the escape
character instead of using the IS_ESCAPE() macro which tests for ^V because the former is mandated by the standards, and the latter is insane. This is a very small part in addressing PR bin/26046 by lukem@. Before, in order to escape a special character, you had to use a literal ^V, which is type ^V twice before the character; whereas now, you use \. Because the fix will remain partial for a while, you have to remove \ from your shellmeta option otherwise the \ is swallowed by the invoked shell that handles arguments expansion. Please complain if you want ^V^V to also work, but please don't call me a heretic.
This commit is contained in:
parent
aece7a90fd
commit
44208cd8f1
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ex_argv.c,v 1.13 2005/09/06 21:36:10 aymeric Exp $ */
|
||||
/* $NetBSD: ex_argv.c,v 1.14 2005/09/06 21:50:51 aymeric Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1993, 1994
|
||||
@ -16,7 +16,7 @@
|
||||
#if 0
|
||||
static const char sccsid[] = "@(#)ex_argv.c 10.26 (Berkeley) 9/20/96";
|
||||
#else
|
||||
__RCSID("$NetBSD: ex_argv.c,v 1.13 2005/09/06 21:36:10 aymeric Exp $");
|
||||
__RCSID("$NetBSD: ex_argv.c,v 1.14 2005/09/06 21:50:51 aymeric Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -291,7 +291,7 @@ argv_exp3(sp, excp, cmd, cmdlen)
|
||||
*/
|
||||
for (ap = cmd, len = 0; cmdlen > 0; ++cmd, --cmdlen, ++len) {
|
||||
ch = *cmd;
|
||||
if (IS_ESCAPE(sp, excp, ch) && cmdlen > 1) {
|
||||
if (ch == '\\' && cmdlen > 1) {
|
||||
++cmd;
|
||||
--cmdlen;
|
||||
} else if (isblank(ch))
|
||||
@ -309,7 +309,7 @@ argv_exp3(sp, excp, cmd, cmdlen)
|
||||
off = exp->argsoff;
|
||||
exp->args[off]->len = len;
|
||||
for (p = exp->args[off]->bp; len > 0; --len, *p++ = *ap++)
|
||||
if (IS_ESCAPE(sp, excp, *ap))
|
||||
if (*ap == '\\')
|
||||
++ap;
|
||||
*p = '\0';
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user