diff options
author | Peter Stephenson <pws@users.sourceforge.net> | 2005-03-09 17:13:59 +0000 |
---|---|---|
committer | Peter Stephenson <pws@users.sourceforge.net> | 2005-03-09 17:13:59 +0000 |
commit | 7208c4024ea188e904b2aa28a79c6959e9b04a6e (patch) | |
tree | 8a59fe279fe8619882e6b7c811ea916b0cffa2be | |
parent | 0c3de591d3c90f555645dbde4aea4c800e18332d (diff) | |
download | zsh-7208c4024ea188e904b2aa28a79c6959e9b04a6e.tar.gz zsh-7208c4024ea188e904b2aa28a79c6959e9b04a6e.tar.xz zsh-7208c4024ea188e904b2aa28a79c6959e9b04a6e.zip |
20955: "unset foo" should return status 0 if foo was not set
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | README | 78 | ||||
-rw-r--r-- | Src/builtin.c | 6 |
3 files changed, 16 insertions, 73 deletions
diff --git a/ChangeLog b/ChangeLog index c858ec58b..9c42c7290 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2005-03-09 Peter Stephenson <pws@csr.com> + + * 20955: README, Src/builtin.c: "unset foo" should return + status 0 if foo was not set. + 2005-03-09 Motoi Washida <a66@h8.dion.ne.jp> * 20953: Completion/Unix/Command/_du: "du --version" tries to diff --git a/README b/README index 82f924cbd..894f78e35 100644 --- a/README +++ b/README @@ -24,78 +24,12 @@ details, see the documentation. Possible incompatibilities --------------------------- -Currently the only known incompatibilities between 4.2.0 and later -versions are minor: - - -Since 4.2.1: - -The "test" and "[" builtins now behave more like relevant Unix standards -suggest they should. Previously they were a simple front-end to the same -tests used by zsh's "[[" syntax. (The documentation was previously cagey -about what "test" and "[" actually did.) "[[" has always been the -recommended way of implementing tests within zsh. - -In recent versions of zsh, typing the end-of-file (EOF) character -(typically ^D, although this can be altered with the "stty" command) -repeatedly in the line editor printed a warning message, but never exited the -shell. This was a departure from the traditional behaviour of zsh and -other shells where the shell would exit after 10 EOFs. The traditional -behaviour has been restored. Also, binding a user-defined editor command -to the EOF character now suppresses the EOF behaviour inside the line -editor; it is possible to emulate it if desired. - - -From 4.2.0 to 4.2.1: - -IPv6 addresses must be specified in square brackets in the zftp module and -the function system built on top of the zftp module. - -Special traps for pseudosignals ZERR, DEBUG and EXIT are no longer executed -inside other traps. Users may well have assumed this was the case anyway -since the behaviour was not explicity documented. See the NEWS file for -more detail. - -By default, a maximum function depth of 4096 is now compiled into the -shell. This may be altered during configuration; see `Function depth' in -INSTALL. - - -Some particular differences you may notice between the 4.0 and 4.2 series -of releases: - -The bash-compatibility zle functions described in the zshcontrib manual -page have been removed as a more configurable set of editing widgets for -dealing with words have been added. The following code in .zshrc will set -up for bash-style word handling: - autoload -U select-word-style - select-word-style bash - -The `=prog' facility for expanding command paths (provided the EQUALS -option is enabled, as it is by default) no longer expands aliases. It was -felt this feature was underused and confusing. - -In 4.0, a literal `/' was quoted in the `src' text of a substitution of the -form `${foo/src/rep}' or ${foo//src/rep} with two backslashes. This was -documented, but inconsistent with normal quoting conventions and poorly -implemented. The `/' now requires only one backslash to quote it whether -or not the expression occurs in double quotes. For example: - % foo=word/bird - % print ${foo/\//-} "${foo/\//+}" - word-bird word+bird -Note also the following workaround which is valid in all versions of the -shell that support this syntax: - % slash=/ - % foo=word/bird - % print ${foo/$slash/-} "${foo/$slash/+}" - -In 4.0, the -M option to bindkey used the first non-option argument to -specify the keymap, whereas it now uses an argument to the option. Hence: - bindkey -M -R keymap a-z self-insert -needs to be rewritten as - bindkey -M keymap -R a-z self-insert -The following form works in both versions: - bindkey -R -M keymap a-z self-insert +Since 4.2: + +The "unset" builtin now does not regard the unsetting of non-existent +variables as an error, so can still return status 0 (depending on the +handling of other arguments). This appears to be the standard shell +behaviour. Documentation ------------- diff --git a/Src/builtin.c b/Src/builtin.c index 6fcfabfda..724a6baec 100644 --- a/Src/builtin.c +++ b/Src/builtin.c @@ -2726,8 +2726,12 @@ bin_unset(char *name, char **argv, Options ops, int func) pm = (Param) (paramtab == realparamtab ? gethashnode2(paramtab, s) : paramtab->getnode(paramtab, s)); + /* + * Unsetting an unset variable is not an error. + * This appears to be reasonably standard behaviour. + */ if (!pm) - returnval = 1; + continue; else if ((pm->flags & PM_RESTRICTED) && isset(RESTRICTED)) { zerrnam(name, "%s: restricted", pm->nam, 0); returnval = 1; |