From: Peter Stephenson <pws@ifh.de>
To: zsh-workers@math.gatech.edu
Subject: PATCH: 3.1 Re: Weird bug with "bindkey"
Date: Wed, 25 Mar 1998 10:23:23 +0100 [thread overview]
Message-ID: <199803250923.KAA26983@hydra.ifh.de> (raw)
In-Reply-To: ""Bart Schaefer""'s message of "Tue, 24 Mar 1998 09:19:18 MET." <980324091918.ZM6728@candle.brasslantern.com>
> The weird thing is, if any of the "bindkey" commands in that function fails
> (e.g. with "bindkey: in-string is not bound") then the ENTIRE FUNCTION exits.
>
> What the devil is up with that?
>
> zsh 3.0.5
As Zefram suggested, it's to do with errflag, which is completely
global: it will abort back to the main command loop, or exit a
script. Originally, all zsh internal errors worked like this, until
some mug with nothing better to do (guess who?) introduced zwarnnam(),
which doesn't pass on errflag. There was some discussion at the time
about what should do which, but with the whole shell to rewrite in
this fashion things were obviously going to get missed, so I would
guess this bug has always been there.
Here's a patch for 3.1, which simply replaces zerrnam() with
zwarnnam() everywhere in zle_keymap.c (the unidiff was very much
shorter so I've sent that, but mail me if you need a context diff).
Looks like I've got 3.0.x lying around, so I'll dig out a patch for
that, too.
--- Src/Zle/zle_keymap.c.warn Tue Jan 13 11:41:41 1998
+++ Src/Zle/zle_keymap.c Wed Mar 25 10:10:29 1998
@@ -604,17 +604,17 @@
if(op->o)
for(opp = op; (++opp)->o; )
if(ops[opp->o]) {
- zerrnam(name, "incompatible operation selection options",
+ zwarnnam(name, "incompatible operation selection options",
NULL, 0);
return 1;
}
n = ops['e'] + ops['v'] + ops['a'] + ops['M'];
if(!op->selp && n) {
- zerrnam(name, "keymap cannot be selected with -%c", NULL, op->o);
+ zwarnnam(name, "keymap cannot be selected with -%c", NULL, op->o);
return 1;
}
if(n > 1) {
- zerrnam(name, "incompatible keymap selection options", NULL, 0);
+ zwarnnam(name, "incompatible keymap selection options", NULL, 0);
return 1;
}
@@ -629,14 +629,14 @@
else if(ops['M']) {
kmname = *argv++;
if(!kmname) {
- zerrnam(name, "-M option requires a keymap argument", NULL, 0);
+ zwarnnam(name, "-M option requires a keymap argument", NULL, 0);
return 1;
}
} else
kmname = "main";
km = openkeymap(kmname);
if(!km) {
- zerrnam(name, "no such keymap `%s'", kmname, 0);
+ zwarnnam(name, "no such keymap `%s'", kmname, 0);
return 1;
}
if(ops['e'] || ops['v'])
@@ -656,10 +656,10 @@
/* check number of arguments */
for(n = 0; argv[n]; n++) ;
if(n < op->min) {
- zerrnam(name, "not enough arguments for -%c", NULL, op->o);
+ zwarnnam(name, "not enough arguments for -%c", NULL, op->o);
return 1;
} else if(op->max != -1 && n > op->max) {
- zerrnam(name, "too many arguments for -%c", NULL, op->o);
+ zwarnnam(name, "too many arguments for -%c", NULL, op->o);
return 1;
}
@@ -731,10 +731,10 @@
{
km = openkeymap(argv[0]);
if(!km) {
- zerrnam(name, "no such keymap `%s'", argv[0], 0);
+ zwarnnam(name, "no such keymap `%s'", argv[0], 0);
return 1;
} else if(linkkeymap(km, argv[1])) {
- zerrnam(name, "keymap name `%s' is protected", argv[1], 0);
+ zwarnnam(name, "keymap name `%s' is protected", argv[1], 0);
return 1;
}
return 0;
@@ -749,13 +749,13 @@
KeymapName kmn = (KeymapName) keymapnamtab->getnode(keymapnamtab, argv[0]);
if(kmn && (kmn -> flags & KMN_IMMORTAL)) {
- zerrnam(name, "keymap name `%s' is protected", argv[0], 0);
+ zwarnnam(name, "keymap name `%s' is protected", argv[0], 0);
return 1;
}
if(argv[1]) {
km = openkeymap(argv[1]);
if(!km) {
- zerrnam(name, "no such keymap `%s'", argv[0], 0);
+ zwarnnam(name, "no such keymap `%s'", argv[0], 0);
return 1;
}
} else
@@ -779,7 +779,7 @@
Thingy fn;
if(km->flags & KM_IMMUTABLE) {
- zerrnam(name, "keymap `%s' is protected", kmname, 0);
+ zwarnnam(name, "keymap `%s' is protected", kmname, 0);
return 1;
}
for(i = 128; i < 256; i++)
@@ -811,12 +811,12 @@
for(a = argv+2; *a; a++)
if(!*++a) {
- zerrnam(name, "even number of arguments required", NULL, 0);
+ zwarnnam(name, "even number of arguments required", NULL, 0);
return 1;
}
}
if(km->flags & KM_IMMUTABLE) {
- zerrnam(name, "keymap `%s' is protected", kmname, 0);
+ zwarnnam(name, "keymap `%s' is protected", kmname, 0);
return 1;
}
do {
--
Peter Stephenson <pws@ifh.de> Tel: +39 50 844536
WWW: http://www.ifh.de/~pws/
Gruppo Teorico, Dipartimento di Fisica
Piazza Torricelli 2, 56100 Pisa, Italy
next prev parent reply other threads:[~1998-03-25 9:27 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
1998-03-24 17:19 Weird bug with "bindkey" in a function Bart Schaefer
1998-03-24 18:03 ` Andrew Main
1998-03-25 9:23 ` Peter Stephenson [this message]
1998-03-25 9:45 ` PATCH: 3.0.5 Re: Weird bug with "bindkey" Peter Stephenson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=199803250923.KAA26983@hydra.ifh.de \
--to=pws@ifh.de \
--cc=zsh-workers@math.gatech.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).