Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Dangerous feature - multios with globbing
On Sun, Sep 22, 2024 at 2:01 AM Eric Cook <llua@xxxxxxx> wrote:
> While indifferent to the option default state and it leading to other more common encountered confusion, the fact that it took you
> 30 years to discover the behavior on accident speaks to how likely/dangerous one is to actually occur said problem.
That's an optimistic way to look at it. A more pessimistic way is to
say that in the last 30 years, I lost an average of 133 files
per year because of that feature ;-)
Although this calculation sounds like a joke, it actually emphasises
my main point - that the globbing+multios+clobber
combination - on by default - is dangerous exactly because it can
destroy many files at once.
I still wonder who really wants the ability to clobber many files at
once. The manual page gives examples of truncating many
files, and of replacing many shell scripts with a single script. But
does any user ever want to do such a thing? Or, in the rare
case that you do, wouldn't using a loop be safer than the multios
syntax? It will also be more general - the multios syntax
tries to open all the files at once, so will fail when "*" evaluates
to more than the number of allowed file descriptors (ulimit -n).
This is how I actually lost in this incident "only" the first few
thousands files and not all the files I had in that directory.
Nadav.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author