From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10943 invoked from network); 25 Mar 1998 09:27:58 -0000 Received: from math.gatech.edu (list@130.207.146.50) by ns1.primenet.com.au with SMTP; 25 Mar 1998 09:27:58 -0000 Received: (from list@localhost) by math.gatech.edu (8.8.5/8.8.5) id EAA15202; Wed, 25 Mar 1998 04:24:20 -0500 (EST) Resent-Date: Wed, 25 Mar 1998 04:24:20 -0500 (EST) Message-Id: <199803250923.KAA26983@hydra.ifh.de> To: zsh-workers@math.gatech.edu Subject: PATCH: 3.1 Re: Weird bug with "bindkey" In-reply-to: ""Bart Schaefer""'s message of "Tue, 24 Mar 1998 09:19:18 MET." <980324091918.ZM6728@candle.brasslantern.com> Date: Wed, 25 Mar 1998 10:23:23 +0100 From: Peter Stephenson Resent-Message-ID: <"hv2dQ3.0.Tj3.3rC6r"@math> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/3815 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu > 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 Tel: +39 50 844536 WWW: http://www.ifh.de/~pws/ Gruppo Teorico, Dipartimento di Fisica Piazza Torricelli 2, 56100 Pisa, Italy