Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 30 Jan 2000 20:32:51 +1100 (EST)
From:      Bruce Evans <bde@zeta.org.au>
To:        Jun Kuriyama <kuriyama@sky.rim.or.jp>
Cc:        current@FreeBSD.ORG
Subject:   Re: "rm -rf" behavior on readonly nfs
Message-ID:  <Pine.BSF.4.21.0001302012500.10432-100000@alphplex.bde.org>
In-Reply-To: <86aeloo22e.wl@localhost.sky.rim.or.jp>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, 30 Jan 2000, Jun Kuriyama wrote:

> I found difference between "rm -rf" for non-exist file on readonly nfs
> and usual non-writable directory.
> 
> In this example, /usr/src is readonly nfs mounted and /usr/bin is
> normal filesystem but not writable.  And file "a" is not exist.
> 
> -----
> % rm /usr/bin/a
> rm: /usr/bin/a: No such file or directory
> % rm -f /usr/bin/a
> % rm -rf /usr/bin/a
> % rm /usr/src/a
> rm: /usr/src/a: No such file or directory
> % rm -f /usr/src/a
> % rm -rf /usr/src/a
> rm: /usr/src/a: Read-only file system
> %
> -----
> 
> For "-f" option, last behavior is expected one, or not?

The kernel returns EROFS for unlink() without even looking up the last
component of the filename.  This is a cosmetic bug IMO.  The errors
listed in POSIX.1 are not required to be checked for in the given
order.  However, checking in that order usually gives the most logical
results.  For unlink() and similar syscalls, EROFS is at the end of
the list.

Once unlink() returns EROFS, POSIX.2 requires the error to be reported
for rm -f (POSIX.2 requires rm -f to be silent about ENOENT but not about
all other errors).

Bruce



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0001302012500.10432-100000>