bug#15943: [PATCH] doc: enhance diagnostic when rm skips . or .. arguments

2013-11-20 Thread Linda Walsh

On 20/11/2013 15:47, Bernhard Voelker wrote:


-  /* If a command line argument resolves to / (and --preserve-root
+  /* POSIX also says:
+ If a command line argument resolves to / (and --preserve-root
  is in effect -- default) diagnose and skip it.  */
   if (ROOT_DEV_INO_CHECK (x-root_dev_ino, ent-fts_statp))
 {

-

So it is easier to delete everything under '/' than
under /tmp/.

Hmm...

Maybe since '/' doesn't really delete the file system itself,
but only files and dirs underneath '/',

Then the correct solution is if a user says
to remove /tmp/
it will remove everything under /tmp but not /tmp itself?

That doesn't seem to be disallowed by POSIX...

(its a bit absurd, but as long as it conforms to POSIX
it should be fine, right? ;-/)







bug#15943: [PATCH] doc: enhance diagnostic when rm skips . or .. arguments

2013-11-20 Thread Eric Blake
forcemerge 15943 15926
thanks

On 11/20/2013 05:54 PM, Linda Walsh wrote:
 On 20/11/2013 15:47, Bernhard Voelker wrote:

 -  /* If a command line argument resolves to / (and
 --preserve-root
 +  /* POSIX also says:
 + If a command line argument resolves to / (and

No need to spawn a new bug when the existing bug tracking the issue is
still under discussion.  And on the surface, this email has nothing to
do with the subject line of enhance diagnostic when rm skips . or
.. arguments.

 
 Maybe since '/' doesn't really delete the file system itself,
 but only files and dirs underneath '/',

Huh?  When POSIX-compliant (that is, when --preserve-root is in effect),
attempting to 'rm -r /' does nothing at all.  When bypassing POSIX (with
'rm -r --no-preserve-root'), rm will delete as much as possible, and
eventually fail once it has deleted system resources that were essential
to the correct operation of the computer; but if you can get far enough,
it would eventually attempt rm(/).

 
 Then the correct solution is if a user says
 to remove /tmp/
 it will remove everything under /tmp but not /tmp itself?
 
 That doesn't seem to be disallowed by POSIX...

Not true.  POSIX requires 'rm -r /tmp/' to attempt to delete /tmp, but
that it might fail to do so if nested files are not deleted (perhaps due
to ownership) or if the user doesn't have rights to delete /tmp.

 (its a bit absurd, but as long as it conforms to POSIX
 it should be fine, right? ;-/)

Your idea of skipping the attempt to delete /tmp would not conform with
POSIX.


-- 
Eric Blake   eblake redhat com+1-919-301-3266
Libvirt virtualization library http://libvirt.org



signature.asc
Description: OpenPGP digital signature