The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
From: ralph@inputplus.co.uk (Ralph Corderoy)
Subject: [TUHS] rm command
Date: Wed, 25 Apr 2018 23:09:16 +0100	[thread overview]
Message-ID: <20180425220916.63C52206BE@orac.inputplus.co.uk> (raw)
In-Reply-To: <C15B0B7C-EC7E-44E3-ACF2-E8461C2C49E8@jctaylor.com>

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 604 bytes --]

Hi Bill,

> I think it’s a bit more interesting to uncover why rm does not remove
> directories by default thereby obviating the need for rmdir

Well, I'd guess it's: rm just does a single unlink to decrement an
inode's reference count by one, actually increment it since they were
negative, whereas rmdir on an empty directory needs to do two
decrements, one for its directory entry in the parent, and one for `..'.

(I think hard links could apply to directories in the early days, until
it made things too awkward, e.g. du(1) and cycles.)

-- 
Cheers, Ralph.
https://plus.google.com/+RalphCorderoy


  parent reply	other threads:[~2018-04-25 22:09 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-25 20:22 Eric Blood
2018-04-25 21:23 ` Ralph Corderoy
2018-04-25 21:33 ` John P. Linderman
2018-04-25 21:53   ` William Corcoran
2018-04-25 21:58     ` Derek Fawcus
2018-04-25 22:09     ` Ralph Corderoy [this message]
2018-04-25 22:17 Noel Chiappa
2018-04-27 16:26 ` Dave Horsfall
2018-04-27 16:58   ` Ian Zimmerman
2018-04-27 18:14   ` Steve Nickolas
2018-04-27 18:17     ` Pete Wright
2018-04-28 16:33       ` Michael Kjörling
2018-04-28 18:01         ` Ian Zimmerman
2018-04-28 18:51         ` Derek Fawcus
2018-04-26  2:19 Doug McIlroy
2018-04-26  9:41 ` Ralph Corderoy
2018-04-27 16:42 Noel Chiappa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180425220916.63C52206BE@orac.inputplus.co.uk \
    --to=ralph@inputplus.co.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).