aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOliver Kiddle <opk@users.sourceforge.net>2003-11-13 16:45:36 +0000
committerOliver Kiddle <opk@users.sourceforge.net>2003-11-13 16:45:36 +0000
commitaf7eba0c848d12629d41be991467d35a902a9e66 (patch)
tree2f737d3e4c643d77bd7d79874fbb998ef8803fa7
parent2d241d0ff9f26f75d5923d896bd30c61b189b099 (diff)
downloadzsh-af7eba0c848d12629d41be991467d35a902a9e66.tar.gz
zsh-af7eba0c848d12629d41be991467d35a902a9e66.tar.xz
zsh-af7eba0c848d12629d41be991467d35a902a9e66.zip
merge back changes from 4.1
-rw-r--r--ChangeLog24
-rw-r--r--Src/Modules/parameter.c2
-rw-r--r--Src/Zle/zle_main.c3
-rw-r--r--Src/builtin.c6
-rw-r--r--Src/exec.c2
-rw-r--r--Src/hist.c2
-rw-r--r--Src/input.c14
-rw-r--r--Src/params.c10
8 files changed, 55 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index 65d042be2..3569b26ac 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -72,6 +72,11 @@
* 18944: Completion/Unix/Command/_ruby: update ruby completion for
version 1.8.0 and add descriptions for -T matches
+2003-08-11 Peter Stephenson <pws@csr.com>
+
+ * 18941: Src/hist.c, Src/input.c: Alias text could end up in
+ history after a parsing error during alias expansion.
+
2003-08-05 Peter Stephenson <pws@csr.com>
* 18926: Src/Zle/complist.c: fix (without knowing how) insertion
@@ -152,6 +157,11 @@
* 18877: Etc/completion-style-guide: add a few more points
+2003-07-22 Peter Stephenson <pws@csr.com>
+
+ * 18880: Src/Modules/parameter.c: Don't return unset variables
+ in whole array value for $parameters.
+
2003-07-21 Doug Kearns <djkea2@mugca.its.monash.edu.au>
* 18872: Completion/Unix/Command/_java: update javac completion for
@@ -228,6 +238,10 @@
spaces) was flakey. The same problem probably exists for
completing modified files, but the code is indecipherable.
+ * 18769: Src/exec.c: parse error in autoloading file causes
+ return value zero and empty function definition. Presumed
+ to be error introduced with wordcode.
+
2003-07-02 Oliver Kiddle <opk@zsh.org>
* 18520, 13691 (Mario Lang), 13701 (Sven):
@@ -295,6 +309,11 @@
* 18600: Src/pattern.c: bug matching against [[:xdigit:]].
+2003-05-19 Peter Stephenson <pws@csr.com>
+
+ * 18548: Src/Zle/zle_main.c: memory leak when vared'ing arrays
+ spotted by valgrind (18543).
+
2003-05-14 Peter Stephenson <pws@csr.com>
* Jonathan Paisley <jp-www@dcs.gla.ac.uk>: 18513:
@@ -408,6 +427,11 @@
Completion/Cygwin/Command/_pscp, Completion/Cygwin/Command/_putclip:
cygwin completion functions.
+2003-04-04 Peter Stephenson <pws@csr.com>
+
+ * 18435: Src/builtin.c, Src/params.c: spotted by Oliver: unsetting
+ a readonly variable returned status 0.
+
2003-03-28 Wayne Davison <wayned@users.sourceforge.net>
* 18402: Src/builtin.c: Prevent "print -m" from crashing (it now
diff --git a/Src/Modules/parameter.c b/Src/Modules/parameter.c
index e023ca9fe..5b897a7dc 100644
--- a/Src/Modules/parameter.c
+++ b/Src/Modules/parameter.c
@@ -181,6 +181,8 @@ scanpmparameters(HashTable ht, ScanFunc func, int flags)
for (i = 0; i < realparamtab->hsize; i++)
for (hn = realparamtab->nodes[i]; hn; hn = hn->next) {
+ if (((Param)hn)->flags & PM_UNSET)
+ continue;
pm.nam = hn->nam;
if (func != scancountparams &&
((flags & (SCANPM_WANTVALS|SCANPM_MATCHVAL)) ||
diff --git a/Src/Zle/zle_main.c b/Src/Zle/zle_main.c
index cb1854e9b..b7c7767b7 100644
--- a/Src/Zle/zle_main.c
+++ b/Src/Zle/zle_main.c
@@ -949,9 +949,10 @@ bin_vared(char *name, char **args, char *ops, int func)
/*
* Use spacesplit with fourth argument 1: identify quoted separators,
- * unquote but don't split.
+ * and unquote. This duplicates the string, so we still need to free.
*/
a = spacesplit(t, 1, 0, 1);
+ zsfree(t);
if (PM_TYPE(pm->flags) == PM_ARRAY)
setaparam(args[0], a);
else
diff --git a/Src/builtin.c b/Src/builtin.c
index bfb2f85b8..be5d124b6 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -2399,8 +2399,10 @@ bin_unset(char *name, char **argv, char *ops, int func)
zerrnam(name, "%s: invalid element for unset", s, 0);
returnval = 1;
}
- } else
- unsetparam_pm(pm, 0, 1);
+ } else {
+ if (unsetparam_pm(pm, 0, 1))
+ returnval = 1;
+ }
if (ss)
*ss = '[';
}
diff --git a/Src/exec.c b/Src/exec.c
index 77b657c18..7a457696a 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -3272,7 +3272,7 @@ loadautofn(Shfunc shf, int fksh, int autol)
return NULL;
}
if (!prog)
- prog = &dummy_eprog;
+ return NULL;
if (ksh == 2 || (ksh == 1 && isset(KSHAUTOLOAD))) {
if (autol) {
prog->flags |= EF_RUN;
diff --git a/Src/hist.c b/Src/hist.c
index e40007049..4a01ff652 100644
--- a/Src/hist.c
+++ b/Src/hist.c
@@ -290,6 +290,8 @@ safeinungetc(int c)
void
herrflush(void)
{
+ inpopalias();
+
while (!lexstop && inbufct && !strin)
hwaddc(ingetc());
}
diff --git a/Src/input.c b/Src/input.c
index 525a3202a..bf31c09cf 100644
--- a/Src/input.c
+++ b/Src/input.c
@@ -540,3 +540,17 @@ inpop(void)
inpoptop();
} while (remcont);
}
+
+/*
+ * Expunge any aliases from the input stack; they shouldn't appear
+ * in the history and need to be flushed explicitly when we encounter
+ * an error.
+ */
+
+/**/
+void
+inpopalias(void)
+{
+ while (inbufflags & INP_ALIAS)
+ inpoptop();
+}
diff --git a/Src/params.c b/Src/params.c
index aa80bcc78..e2a9f61f7 100644
--- a/Src/params.c
+++ b/Src/params.c
@@ -2089,18 +2089,18 @@ unsetparam(char *s)
/* Unset a parameter */
/**/
-mod_export void
+mod_export int
unsetparam_pm(Param pm, int altflag, int exp)
{
Param oldpm, altpm;
if ((pm->flags & PM_READONLY) && pm->level <= locallevel) {
zerr("read-only variable: %s", pm->nam, 0);
- return;
+ return 1;
}
if ((pm->flags & PM_RESTRICTED) && isset(RESTRICTED)) {
zerr("%s: restricted", pm->nam, 0);
- return;
+ return 1;
}
pm->unsetfn(pm, exp);
if ((pm->flags & PM_EXPORTED) && pm->env) {
@@ -2142,7 +2142,7 @@ unsetparam_pm(Param pm, int altflag, int exp)
*/
if ((pm->level && locallevel >= pm->level) ||
(pm->flags & (PM_SPECIAL|PM_REMOVABLE)) == PM_SPECIAL)
- return;
+ return 0;
/* remove parameter node from table */
paramtab->removenode(paramtab, pm->nam);
@@ -2167,6 +2167,8 @@ unsetparam_pm(Param pm, int altflag, int exp)
}
paramtab->freenode((HashNode) pm); /* free parameter node */
+
+ return 0;
}
/* Standard function to unset a parameter. This is mostly delegated to *