Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Fwd: Re: [Pkg-zsh-devel] Bug#844710: autocorrection suggested rm for typing mr without typing "y"



Dear Z-Shell developers,

I want to make you aware of the following issue with autocorrection I ran 
into:

autocorrection suggested rm for typing mr without typing "y"
https://bugs.debian.org/844710

Axel analysed this below a bit further an indeed, if I press the space bar, I 
get this:

ms@merkaba:~> cd /tmp       
ms@merkaba:/tmp> LANG=C mr test
zsh: correct 'mr' to 'rm' [nyae]?  
rm: cannot remove 'test': No such file or directory
ms@merkaba:/tmp#1>

So two fixes to consider:

1) Don´t confirm on space, as thats to easy to trigger accidentally. :)

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.

Thank you,
Martin

----------  Weitergeleitete Nachricht  ----------

Betreff: Re: [Pkg-zsh-devel] Bug#844710: autocorrection suggested rm for 
typing mr without typing "y"
Datum: Freitag, 18. November 2016, 13:59:34 CET
Von: Martin Steigerwald <martin.steigerwald@xxxxxxxxx>
An: Axel Beckert <abe@xxxxxxxxxx>
Kopie: 844710@xxxxxxxxxxxxxxx

Am Freitag, 18. November 2016, 13:00:24 CET schrieben Sie:
> Hi Martin,
> 
> Martin Steigerwald wrote:
> > ms@intraws:~/Backup/Mail/Linux> mr kernel-ml_archive.gz
> > kernel-ml_archive_2014-1b.gz zsh: correct 'mr' to 'rm' [nyae]?
> > rm: das Entfernen von „kernel-ml_archive_2014-1b.gz“ ist nicht möglich:
> > Datei oder Verzeichnis nicht gefunden
> > 
> > I didn´t type yes, as when I type "y", it is shown on command line:
> > 
> > ms@intraws:~/Backup/Mail/Linux#1> LANG=C mr test
> > zsh: correct 'mr' to 'rm' [nyae]? y
> > rm: cannot remove 'test': No such file or directory
> > 
> > And I really didn´t type "y" there, I am pretty sure of that, but I may
> > have hit another key by accident.
> 
> Indeed scary.
> 
> From the output it look to as if "Enter" had been pressed on a
> first glance. But if I press "Enter" (on Sid at least) it shows an "n"
> instead afterwards. (Since I have mr installed, I tested it with "rmm"
> which is only available if nmh or mailutils-mh is installed.)
> 
> After some experimenting I noticed that while pressing Enter is
> equivalent to pressing "n" and also prints an "n", pressing the space
> bar is equivalent to "y" _without_ printing a "y".
> 
> So you very likely hit the space bar accidentially.

Yikes! Space bar to confirm? And correction to "rm".

Actually what I tried to type was "mv". I obviously wanted to move the file. 
But I accidentelly typed "mr". And then, yes, likely the space bar.

I think this deserves a fix in the software :)

Thanks.

-------------------------------------------------------------

-- 
Martin Steigerwald  | Trainer

teamix GmbH
Südwestpark 43
90449 Nürnberg

Tel.:  +49 911 30999 55 | Fax: +49 911 30999 99
mail: martin.steigerwald@xxxxxxxxx | web:  http://www.teamix.de | blog: http://blog.teamix.de

Amtsgericht Nürnberg, HRB 18320 | Geschäftsführer: Oliver Kügow, Richard Müller

teamix Support Hotline: +49 911 30999-112
 
 *** Bitte liken Sie uns auf Facebook: facebook.com/teamix ***



Messages sorted by: Reverse Date, Date, Thread, Author