Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: zsh: RM_STAR warning counts files as though DOT_GLOB is set
- X-seq: zsh-workers 41675
- From: Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Re: zsh: RM_STAR warning counts files as though DOT_GLOB is set
- Date: Mon, 11 Sep 2017 15:41:00 +0000
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= daniel.shahaf.name; h=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; s=fm1; bh=XoA+gV KlJkU38ofPIdZEg1YrQQKODTaAwFr8SxtUdNU=; b=T/tGUtBA0JHalju73dVNXH Hg9sbIHtJ4Be2V5ehfIF4OHdh2XxPoa9Hgw8kumX6y1t41vWqm/5MvHlfXwrmAUx ZMweeXiqPygPdk6YgDu0kAqANY/2B62e5KRYuPIC9ww9JcXmNLZANbs926UJJCAd BftRvmG5fw0TX7Fv8WcY1u61rOeSaF9/5rw4sb7aqp85IYIBK1CQ3N8xeuLYPYej GylK6tyobvl+1GP6th3umKlMYLylaiyrw8etpBKP8m/hsw/KWrXo5DEn+1GoLCc5 EpAdV5Dm8anITAzjAUKYhSqcuQ2qlrlzKROOTmh0DYYH4yzUFPYzeF30c1l6nPLQ ==
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=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; s=fm1; bh=XoA+gV KlJkU38ofPIdZEg1YrQQKODTaAwFr8SxtUdNU=; b=GuHdGGHRQmKbPd5jIjeVr4 SfkebQVJ/dWPE7asfKDP6SmLSzw77YbGLvIZ6ySLoYd9NB1hYKRM1J9ew8Kv3dGw MSYLGnK7tb1xf+8nNAHv5O33sBFVL2bHBrwXqOH5pBIqTIBJUG0riaUiUTjpvtws pVvwezPVuLEhdLgH8OtQ5LhGrjzFhsUXewC/xmPoeTopZaHhQudUi4iG5v1XQp66 R7MAgt4+7Q0jNC5ivm+2YQnHYZOxfleLuY++Ww4l2Np8eVbzLIe7KV7ea9jFTaa/ lQTTSlD2sfykNXRqSB9USH/naC+fBN1zz86BpYQ97X483hh1AwI3/th+cPp9AS3w ==
- In-reply-to: <CAH+w=7ZLaJ5yzwjhQKoDAfvpt==d7YKCNrBNtueH1e_XRGqZbw@mail.gmail.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <20170911143436.GB1960@caska> <20170911150740.pz7fudj5lsflrmtk@tarpaulin.shahaf.local2> <CGME20170911152002epcas2p2c21e74cbd8645905fc8c6cf7680186da@epcas2p2.samsung.com> <1505143155.3891161.1102263072.1D722C8A@webmail.messagingengine.com> <20170911162337.630496ac@pwslap01u.europe.root.pri> <CAH+w=7ZLaJ5yzwjhQKoDAfvpt==d7YKCNrBNtueH1e_XRGqZbw@mail.gmail.com>
Bart Schaefer wrote on Mon, 11 Sep 2017 08:31 -0700:
> On Mon, Sep 11, 2017 at 8:23 AM, Peter Stephenson
> <p.stephenson@xxxxxxxxxxx> wrote:
> > On Mon, 11 Sep 2017 15:19:15 +0000
> > Daniel Shahaf <danielsh@xxxxxxxxxx> wrote:
> >> I don't understand the last branch of the if/else in that function: it
> >> seems to prompt "... delete all the files ..." when count == 0?
> >
> > Apparently, yes. I think it's just covering the bases.
>
> The issue here, as I recall, is that it's possible to have:
> 1 "rm *" is issued
> 2 chkrmall() finds no files in the directory
> 3 some external process creates a file
> 4 "rm *" is executed
> 5 the file created at (3) is silently deleted
>
> So we would need either to avoid re-expanding "*" after chkrmall(), or
> treat "found no files" as "user answered no".
Good catch.
The warning messages emitted by the "if" and "else if" branches are all
susceptible to this race condition. They were all added in 37946 in
order to "make [the] warnings more informative".
Simply reverting 37946 would resolve both the OP's problem and this race
condition. (Just stating a fact; maybe there are other/better solutions)
Cheers,
Daniel
Messages sorted by:
Reverse Date,
Date,
Thread,
Author