1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-12-09 18:51:46 +01:00

20955: "unset foo" should return status 0 if foo was not set

This commit is contained in:
Peter Stephenson 2005-03-09 17:13:59 +00:00
parent 0c3de591d3
commit 7208c4024e
3 changed files with 15 additions and 72 deletions

View file

@ -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

76
README
View file

@ -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:
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
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
-------------

View file

@ -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;