aboutsummaryrefslogtreecommitdiff
path: root/shell
diff options
context:
space:
mode:
authorandersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277>2002-07-04 00:19:46 +0000
committerandersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277>2002-07-04 00:19:46 +0000
commitffbd53074dd63d4c4701036bba894b7f873b6d4d (patch)
tree9c447224106be23ae890826690ea0b1535078a7c /shell
parentaa2bb6a4aa8d4fdb42ffd7a3118c145967926491 (diff)
downloadbusybox-w32-ffbd53074dd63d4c4701036bba894b7f873b6d4d.tar.gz
busybox-w32-ffbd53074dd63d4c4701036bba894b7f873b6d4d.tar.bz2
busybox-w32-ffbd53074dd63d4c4701036bba894b7f873b6d4d.zip
Patch from Stewart Brodie <stewart.brodie@pace.co.uk> to fix ash:
When alias support is not configured, ash believes that command parameters that look like dd's "if=/dev/zero" are requests to set a temporary environment variable whilst dd is running, even though it appears after the command name. This is caused by the re-use of the checkalias global variable to indicate when both alias checking and environment variable checking. The failure to reset this flag is due to the reset action being performed only inside the feature check CHECK_ASH_ALIAS. Hence ash works as expected when aliases are configured in, and fails when not. Example script using 'date' with different settings of TZ: # TZ=Europe/London # export TZ # date Thu May 30 17:18:49 BST 2002 # TZ=America/New_York date Thu May 30 12:19:10 EDT 2002 # date Thu May 30 17:19:12 BST 2002 # date TZ=America/New_York Thu May 30 12:19:30 EDT 2002 <----- wrong, should be BST time (or error!) # date Thu May 30 17:19:35 BST 2002 Attached is a patch against revision 1.52 of ash.c which moves the checks so that checkalias is updated regardless of whether CONFIG_ASH_ALIAS is set. With this patch applied, the command shown above which should generate an error does generate an error. I have tested this patch with the 'dd' command too and that now works correctly. git-svn-id: svn://busybox.net/trunk/busybox@5013 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'shell')
-rw-r--r--shell/ash.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/shell/ash.c b/shell/ash.c
index 366f704be..3d7043c8f 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -9967,8 +9967,8 @@ static int
9967readtoken() { 9967readtoken() {
9968 int t; 9968 int t;
9969 9969
9970#ifdef CONFIG_ASH_ALIAS
9971 int savecheckalias = checkalias; 9970 int savecheckalias = checkalias;
9971#ifdef CONFIG_ASH_ALIAS
9972 int savecheckkwd = checkkwd; 9972 int savecheckkwd = checkkwd;
9973 struct alias *ap; 9973 struct alias *ap;
9974#endif 9974#endif
@@ -9983,9 +9983,7 @@ top:
9983 9983
9984 t = xxreadtoken(); 9984 t = xxreadtoken();
9985 9985
9986#ifdef CONFIG_ASH_ALIAS
9987 checkalias = savecheckalias; 9986 checkalias = savecheckalias;
9988#endif
9989 9987
9990 if (checkkwd) { 9988 if (checkkwd) {
9991 /* 9989 /*
@@ -10021,8 +10019,8 @@ top:
10021 } 10019 }
10022 } else if (checkalias == 2 && isassignment(wordtext)) { 10020 } else if (checkalias == 2 && isassignment(wordtext)) {
10023 lasttoken = t = TASSIGN; 10021 lasttoken = t = TASSIGN;
10024#ifdef CONFIG_ASH_ALIAS
10025 } else if (checkalias) { 10022 } else if (checkalias) {
10023#ifdef CONFIG_ASH_ALIAS
10026 if (!quoteflag && (ap = *__lookupalias(wordtext)) != NULL && !(ap->flag & ALIASINUSE)) { 10024 if (!quoteflag && (ap = *__lookupalias(wordtext)) != NULL && !(ap->flag & ALIASINUSE)) {
10027 if (*ap->val) { 10025 if (*ap->val) {
10028 pushstring(ap->val, strlen(ap->val), ap); 10026 pushstring(ap->val, strlen(ap->val), ap);
@@ -10030,8 +10028,8 @@ top:
10030 checkkwd = savecheckkwd; 10028 checkkwd = savecheckkwd;
10031 goto top; 10029 goto top;
10032 } 10030 }
10033 checkalias = 0;
10034#endif 10031#endif
10032 checkalias = 0;
10035 } 10033 }
10036out: 10034out:
10037#ifdef DEBUG 10035#ifdef DEBUG
@@ -12442,7 +12440,7 @@ findvar(struct var **vpp, const char *name)
12442/* 12440/*
12443 * Copyright (c) 1999 Herbert Xu <herbert@debian.org> 12441 * Copyright (c) 1999 Herbert Xu <herbert@debian.org>
12444 * This file contains code for the times builtin. 12442 * This file contains code for the times builtin.
12445 * $Id: ash.c,v 1.53 2002/07/03 23:19:22 andersen Exp $ 12443 * $Id: ash.c,v 1.54 2002/07/04 00:19:46 andersen Exp $
12446 */ 12444 */
12447static int timescmd (int argc, char **argv) 12445static int timescmd (int argc, char **argv)
12448{ 12446{