Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
rfc patch, abort rm instead of only removing the * from the cmdline
- X-seq: zsh-users 13141
- From: "Mikael Magnusson" <mikachu@xxxxxxxxx>
- To: zsh-users <zsh-users@xxxxxxxxxx>
- Subject: rfc patch, abort rm instead of only removing the * from the cmdline
- Date: Sat, 16 Aug 2008 01:49:08 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:mime-version:content-type:content-transfer-encoding :content-disposition; bh=qYi4XFP5OIsmFtatt783PnFOso24hLf8b12RqPvXWHI=; b=GqQxvWeNHxHDiJshIUJH69V02kk1DkQ1nckFg3cF+vFn/Pm+bLLGRRqkL9cOI9by1A y0DoFFTWeYQidovDe5BpxscnsbYLmoLHv64No7CTtlZp8ncpAbWTVEahqqtD1EDRB3QN 6mV7ySs9JK/82PiHM4T2pgZrwJVachE9d58EU=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:mime-version:content-type :content-transfer-encoding:content-disposition; b=O3J2zyOkC048ZOnrg8cnuhCjr5L4D8obbCdHEPK32vrOFUYghFYODArcDmKOy6i6bV Blwmj5//MvBExogolpypPXGZyHml8C5T4uf9PxDdA7e1deGIGI6axGHMaYIntZOuY4Bc 0HgCzOPGa/QPuo1Dqcn8a7T6X8iGiphQuBr7A=
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
It surprised me that this isn't already what happens, what do others think?
Imagine for example the typo
% rm -rf * /tmp
Before, even if you said no to the prompt, it will remove all your
files in /tmp.
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -2515,13 +2515,13 @@ execcmd(Estate state, int input, int output,
int how, int last1)
next = nextnode(node);
if (s[0] == Star && !s[1]) {
if (!checkrmall(pwd))
- uremnode(args, node);
+ return;
} else if (l > 2 && s[l - 2] == '/' && s[l - 1] == Star) {
char t = s[l - 2];
s[l - 2] = 0;
if (!checkrmall(s))
- uremnode(args, node);
+ return;
s[l - 2] = t;
}
}
--
Mikael Magnusson
Messages sorted by:
Reverse Date,
Date,
Thread,
Author