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

Martin Steigerwald martin at lichtvoll.de
Sat Nov 19 11:27:12 UTC 2016


Am Samstag, 19. November 2016, 07:55:42 CET schrieb Daniel Shahaf:
> 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.
[…]
> On a tangent: what do "nyae" mean?  I couldn't find the answer in the
> manual.

I thought about this as well.

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

Well, I meant the last sentence "I think it would be good to reconsider the 
standard behavior" generally to both of the above items. The current 
combination of 1) and 2) invites accepting dangerous autocorrections 
accidentally. It may be enough to change 1) or 2). 

That written, on other occassions Z-Shell protects the user from accidentally 
triggering potentially dangerous operations as well:

Z-Shell:

martin at merkaba:/tmp/test/test2> echo LANG=C rm -rf .*
LANG=C rm -rf .*
martin at merkaba:/tmp/test/test2> LANG=C rm -rf .*

Bash:

martin at merkaba:/tmp/test/test2> bash
martin at merkaba:/tmp/test/test2 -> echo LANG=C rm -rf .*
LANG=C rm -rf . ..
martin at merkaba:/tmp/test/test2 -> LANG=C rm -rf .*
rm: refusing to remove '.' or '..' directory: skipping '.'
rm: refusing to remove '.' or '..' directory: skipping '..'

(Actually I am glad that coreutils rm -rf skips these meanwhile too. And also 
refused to do rm -rf / unless a special option is given.)

Thank you,
-- 
Martin



More information about the Pkg-zsh-devel mailing list