emacs-bug-tracker
[Top][All Lists]
Advanced

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

[debbugs-tracker] bug#24730: closed (rmdir/mkdir error(s) and/or not wor


From: GNU bug Tracking System
Subject: [debbugs-tracker] bug#24730: closed (rmdir/mkdir error(s) and/or not working "reciprocally" w/each other)
Date: Tue, 18 Oct 2016 20:34:02 +0000

Your message dated Tue, 18 Oct 2016 15:33:43 -0500
with message-id <address@hidden>
and subject line Re: bug#24730: rmdir/mkdir error(s) and/or not working 
"reciprocally" w/each other
has caused the debbugs.gnu.org bug report #24730,
regarding rmdir/mkdir error(s) and/or not working "reciprocally" w/each other
to be marked as done.

(If you believe you have received this mail in error, please contact
address@hidden)


-- 
24730: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=24730
GNU Bug Tracking System
Contact address@hidden with problems
--- Begin Message --- Subject: rmdir/mkdir error(s) and/or not working "reciprocally" w/each other Date: Tue, 18 Oct 2016 12:49:44 -0700 User-agent: Thunderbird

It doesn't seem rmdir and mkdir are behaving "reciprocally"...

If I type

mkdir -p ./a/b/c   # no error
rmdir -p ./a/b/c   # get error msg, but a,b,c removed.

1) thinking either rmdir shouldn't generate an error or mkdir should

mkdir -p a/../b      # no error
rmdir -p a/../b      # error, but a & b removed

2) similar comment to above -- leading to:

for rmdir, if "-p" is used, then as similar to "mkdir -p":
  (no error if existing, make parent directories as needed)

rmdir -p should be
  "no error if dir not empty, but directories are followed
and deleted as possible".

======> seems to be best wording & solution:

"mkdir -p", it seems should really be restated to:

   follow given path and make directories as possible"

then "rmdir -p" could be

   "follow given path and delete directories if empty"


Does that look reasonable?

linda w.











--- End Message ---
--- Begin Message --- Subject: Re: bug#24730: rmdir/mkdir error(s) and/or not working "reciprocally" w/each other Date: Tue, 18 Oct 2016 15:33:43 -0500 User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0
tag 24730 notabug
thanks

On 10/18/2016 02:49 PM, L. A. Walsh wrote:
> 
> It doesn't seem rmdir and mkdir are behaving "reciprocally"...
> 
> If I type
> 
> mkdir -p ./a/b/c   # no error

. already exists, so mkdir silently does nothing,
./a needs to be created,
./a/b needs to be created,
./a/b/c needs to be created

> rmdir -p ./a/b/c   # get error msg, but a,b,c removed.

./a/b/c needs to be removed,
./a/b needs to be removed,
./a needs to be removed,
. needs to be removed, but you can't do that, hence the error

The apparent asymmetry is due to the POSIX rules on how '.' is treated;
but we can't change the behavior of either of these commands, because
they are both following the POSIX rules.

If you want symmetry, omit the leading './', as in:

$ mkdir -p a/b/c
$ rmdir -p a/b/c

> 
> 1) thinking either rmdir shouldn't generate an error or mkdir should
> 
> mkdir -p a/../b      # no error

a needs to be created,
a/.. already exists, so it silently does nothing,
a/../b needs to be created

> rmdir -p a/../b      # error, but a & b removed

a/../b needs to be removed,
a/.. needs to be removed, but you can't do that,
at this point, POSIX is fuzzy whether to attempt to remove 'a', or to
give up since 'a/..' was already an error; but obviously coreutils
removes 'a'

> 
> 2) similar comment to above -- leading to:
> 
> for rmdir, if "-p" is used, then as similar to "mkdir -p":
>   (no error if existing, make parent directories as needed)
> 
> rmdir -p should be
>   "no error if dir not empty, but directories are followed
> and deleted as possible".

Sadly, while that might be a nicer definition for 'rmdir -p', it doesn't
match the POSIX requirements nor the historical behavior, so we can't
really change it now.

So I'm marking this as not a bug, as there is nothing to change.

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

Attachment: signature.asc
Description: OpenPGP digital signature


--- End Message ---

reply via email to

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