From owner-freebsd-current Sun Jan 30 1:33:59 2000 Delivered-To: freebsd-current@freebsd.org Received: from gidora.zeta.org.au (gidora.zeta.org.au [203.26.10.25]) by hub.freebsd.org (Postfix) with SMTP id 278B6152C2 for ; Sun, 30 Jan 2000 01:33:50 -0800 (PST) (envelope-from bde@zeta.org.au) Received: (qmail 1819 invoked from network); 30 Jan 2000 09:32:55 -0000 Received: from bde.zeta.org.au (203.2.228.102) by gidora.zeta.org.au with SMTP; 30 Jan 2000 09:32:55 -0000 Date: Sun, 30 Jan 2000 20:32:51 +1100 (EST) From: Bruce Evans X-Sender: bde@alphplex.bde.org To: Jun Kuriyama Cc: current@FreeBSD.ORG Subject: Re: "rm -rf" behavior on readonly nfs In-Reply-To: <86aeloo22e.wl@localhost.sky.rim.or.jp> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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