From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18106 invoked by alias); 19 Nov 2016 07:58:08 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 39982 Received: (qmail 21618 invoked from network); 19 Nov 2016 07:58:08 -0000 X-Qmail-Scanner-Diagnostics: from out2-smtp.messagingengine.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(66.111.4.26):SA:0(-0.7/5.0):. Processed in 1.810024 secs); 19 Nov 2016 07:58:08 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.1 X-Envelope-From: d.s@daniel.shahaf.name X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: none (ns1.primenet.com.au: domain at daniel.shahaf.name does not designate permitted sender hosts) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= daniel.shahaf.name; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc:x-sasl-enc; s= mesmtp; bh=gb101LlrfARj7YAKhar3vkota+A=; b=2n4rq8wIRYzBwqaafeET5 8qGPP7gJ7EkDjTGroKRsylSxrb0M0lKmlSnX3IgJPzj59L415vvA7oRAXq5SfeJ6 CzbbZrs+5Ll3g2Fmyem7pMrfaqUZLW39sfOw4DgvjoMeHSie2pxISapw2pZ3B05x MZ0ioyGhqh4kGWSpBxWuFM= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc:x-sasl-enc; s= smtpout; bh=gb101LlrfARj7YAKhar3vkota+A=; b=elq5zgEFi0UYfBtaObC0 lwhsf73GMdeirVaR+7wLZThOIxIuE5o4ol75wLJd/vhc1KSkxEE1T+y3ATqtCGmj XHuFVJo77H+WIRhNik5DkbN0Ahg/DmHrw8beewku7AwvtZ7JO5P5XIYpag2fp62A rsjrqQjV2+87ZE4FY7GDKXg= X-ME-Sender: X-Sasl-enc: 5BH17Hi4SMo6dKnz5r1+4c6xjvHSVnYoDWYQEQhfGdlu 1479542281 Date: Sat, 19 Nov 2016 07:55:42 +0000 From: Daniel Shahaf To: Martin Steigerwald , 844710@bugs.debian.org Cc: zsh-workers@zsh.org, Axel Beckert Subject: Re: Bug#844710: Fwd: Re: [Pkg-zsh-devel] Bug#844710: autocorrection suggested rm for typing mr without typing "y" Message-ID: <20161119075542.GA6750@fujitsu.shahaf.local2> References: <3574167.p9ErITdPmY@merkaba> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <3574167.p9ErITdPmY@merkaba> User-Agent: Mutt/1.5.23 (2014-03-12) Martin Steigerwald wrote on Fri, Nov 18, 2016 at 14:15:51 +0100: > So two fixes to consider: > > 1) Don´t confirm on space, as thats to easy to trigger accidentally. :) The code confirms on both tabs (since commit 7f1ce570) and spaces (since before CVS). Does anyone know a reason for doing this? The patch also downscopes a couple of local variables, with no functional change. diff --git a/README b/README index 855e764..4834e00 100644 --- a/README +++ b/README @@ -116,6 +116,11 @@ are output as "export" commands unless the parameter is also local, and other parameters not local to the scope are output with the "-g" option. Previously, only "typeset" commands were output, never using "-g". +8) At spelling-correction prompt ($SPROMPT), where the choices offered are +[nyae], previously would be accepted to mean [N] and and + would be accepted to mean [Y]. Now and are invalid +choices: typing either of them remains at the prompt. + Incompatibilities between 5.0.8 and 5.2 --------------------------------------- diff --git a/Src/utils.c b/Src/utils.c index 7bbd588..7f3ddad 100644 --- a/Src/utils.c +++ b/Src/utils.c @@ -2944,9 +2944,7 @@ mod_export void spckword(char **s, int hist, int cmd, int ask) { char *t, *correct_ignore; - int x; char ic = '\0'; - int ne; int preflen = 0; int autocd = cmd && isset(AUTOCD) && strcmp(*s, ".") && strcmp(*s, ".."); @@ -3015,6 +3013,7 @@ spckword(char **s, int hist, int cmd, int ask) } else { guess = *s; if (*guess == Tilde || *guess == String) { + int ne; ic = *guess; if (!*++t) return; @@ -3059,6 +3058,7 @@ spckword(char **s, int hist, int cmd, int ask) if (errflag) return; if (best && (int)strlen(best) > 1 && strcmp(best, guess)) { + int x; if (ic) { char *u; if (preflen) { @@ -3088,14 +3088,14 @@ spckword(char **s, int hist, int cmd, int ask) free(pptbuf); fflush(shout); zbeep(); - x = getquery("nyae \t", 0); + x = getquery("nyae", 0); if (cmd && x == 'n') pathchecked = path; } else x = 'n'; } else x = 'y'; - if (x == 'y' || x == ' ' || x == '\t') { + if (x == 'y') { *s = dupstring(best); if (hist) hwrep(best); On a tangent: what do "nyae" mean? I couldn't find the answer in the manual. > 2) Don´t autocorrect to dangerous commands like "rm". Could be a bit > challenging to make a list of commands which are dangerous and can easily > trigger unwanted actions. "rm" would IMO definately be one of this, while with > "dd" it would be harder to trigger an unwanted action by accident due to > syntax requirements. > > Axel made me aware that I tell Z-Shell to ignore dangerous commands with > CORRECT_IGNORE=rm, but I think it would be good to reconsider the standard > behavior. Well, it _does_ prompt the user asking whether "rm" is correct. Isn't that sufficient? Cheers, Daniel