bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#19262: rm command removes a read-only file without confirming when t


From: Bob Proulx
Subject: bug#19262: rm command removes a read-only file without confirming when the stdin is closed
Date: Wed, 3 Dec 2014 14:45:03 -0700
User-agent: Mutt/1.5.23 (2014-03-12)

Eric Blake wrote:
> Takahashi Mamoru wrote:
> > $ touch a; chmod 0444 a; ls -l a
> > $ /bin/rm -v a 0<&-
> > removed 'a'
> 
> This is undefined behavior, per POSIX (starting ANY application with
> stdin closed is undefined; in some cases, the OS may choose to start the
> app with stdin pointing to /dev/null instead of being closed, but you
> can't rely on that happening).  But the answer is the same whether stdin
> remains closed by the OS or whether it was opened to /dev/null - either
> way, stdin is not interactive.
> 
> > Is this a bug or a feature ?
> 
> Feature, mandated by POSIX (arguably an odd requirement, but it matches
> historical practice that people have come to rely on, so we can't change
> it).  Therefore, I'm closing this as not a bug, although you should feel
> free to reply if you have further comments or questions.

It is a feature.  If that were changed then many cron tasks would
start emitting email.  Arguably people should be putting 'rm -f'
instead of simply 'rm' in cron scripts but often they don't.

Bob





reply via email to

[Prev in Thread] Current Thread [Next in Thread]