Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: `rm *` count is incorrect with `setopt GLOB_DOTS`
- X-seq: zsh-workers 42636
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxxx
- Subject: Re: `rm *` count is incorrect with `setopt GLOB_DOTS`
- Date: Fri, 13 Apr 2018 18:48:22 -0700
- Cc: "zsh-workers@xxxxxxx" <zsh-workers@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=oN5Lqd2Du8PA0aTo9YCo2aD8DfhKxO3JDIvSvjuGhK8=; b=obb/A3T/uNL34p2hLDLCKjxXZwQEg4EvRjXnXUIxk4QU+qIEi572EidMWNyQ3WgvOh Q5mD6oB20e/Fk8ZgvpobFR/tRPpthEa9oswMnX6jYN/WKPvFyF7NBZq6Jwk2dbWNMGXL 4dRI3UCwQz3LLCVbxGg+NqTYyyGvkC5QCsy9tjSaAHZNBH4dz0QXZ8VsG+Ihp9JePPPE Eh+Nf9poGUh6p4sbx+S96IIWVA6z6gR30Bl3Jl7fJNr0oZSzYzxmHR87O3BfcXn4QMWS VsTIztKxfKLeT/47FENT4J/FhsllkyKr8t9ZgBptB4+YsGhe/H8gbP5Bdxba4ZN3uz/1 aAxg==
- In-reply-to: <20180414002342.oon7lfuxt6msti7i@message.id>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-unsubscribe: <mailto:zsh-workers-unsubscribe@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <20180414002342.oon7lfuxt6msti7i@message.id>
On Fri, Apr 13, 2018 at 5:23 PM, <zsh-workers@xxxxxxxxxxx> wrote:
>
> When I run `rm *`, zsh asks if I "want to delete all x files", where x
> is the number of files to be deleted. However, with `setopt GOB_DOTS`,
> this number appears to be two more than the actual number of files.
It's counting "." and ".." because, well, they begin with a dot.
It's actually wrong any time the directory contains files beginning
with ".", it's just LESS wrong when GLOB_DOTS.
Apologies if this gets line-folded badly:
diff --git a/Src/utils.c b/Src/utils.c
index 180693d..2a006b4 100644
--- a/Src/utils.c
+++ b/Src/utils.c
@@ -2775,10 +2775,11 @@ checkrmall(char *s)
const int max_count = 100;
if ((rmd = opendir(unmeta(s)))) {
int ignoredots = !isset(GLOBDOTS);
- /* ### TODO: Passing ignoredots here is wrong. See workers/41672
- aka <https://bugs.debian.org/875460>.
- */
- while (zreaddir(rmd, ignoredots)) {
+ char *fname;
+
+ while ((fname = zreaddir(rmd, 1))) {
+ if (ignoredots && *fname == '.')
+ continue;
count++;
if (count > max_count)
break;
Messages sorted by:
Reverse Date,
Date,
Thread,
Author