From owner-freebsd-current Sun Jan 30 0:55: 3 2000 Delivered-To: freebsd-current@freebsd.org Received: from mx2.x-treme.gr (mx2.x-treme.gr [212.120.192.15]) by hub.freebsd.org (Postfix) with ESMTP id 8D155152C2 for ; Sun, 30 Jan 2000 00:54:48 -0800 (PST) (envelope-from keramida@diogenis.ceid.upatras.gr) Received: from hades.hell.gr (pat12.x-treme.gr [212.120.197.204]) by mx2.x-treme.gr (8.9.3/8.9.3/IPNG-ADV-ANTISPAM-0.1) with SMTP id KAA13450 for ; Sun, 30 Jan 2000 10:54:33 +0200 Received: (qmail 10766 invoked by uid 1001); 30 Jan 2000 07:40:43 -0000 Date: Sun, 30 Jan 2000 09:40:43 +0200 From: Giorgos Keramidas To: Jun Kuriyama Cc: current@FreeBSD.org Subject: Re: "rm -rf" behavior on readonly nfs Message-ID: <20000130094043.B10414@hades.hell.gr> Reply-To: keramida@ceid.upatras.gr References: <86aeloo22e.wl@localhost.sky.rim.or.jp> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0i In-Reply-To: <86aeloo22e.wl@localhost.sky.rim.or.jp>; from kuriyama@sky.rim.or.jp on Sun, Jan 30, 2000 at 09:06:33AM +0900 X-PGP-Fingerprint: 62 45 D1 C9 26 F9 95 06 D6 21 2A C8 8C 16 C0 8E X-Phone-Number: +30-94-6203692, +30-93-2886457 X-Address: Theodorou Kirinaiou 61, 26334 Patra, Greece Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Sun, Jan 30, 2000 at 09:06:33AM +0900, 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? This happens on either NFS-mounted or real directories. It think that since the manual of rm(1) says: -f Attempt to remove the files without prompting for confirma- tion, regardless of the file's permissions. If the file does not exist, do not display a diagnostic message or modify the exit status to reflect an error. it ought to print nothing in such a case. Let me know if the small patch shown below helps in correcting this. I can't check this cause I got bitten by getflags() in(s)anity last night when I cvsup'ed. The diff -u output is: %%% patch begins here %%% --- /usr/src/bin/rm/rm.c Sat Jan 29 01:14:23 2000 +++ rm.c Sun Jan 30 09:32:18 2000 @@ -196,7 +196,9 @@ } continue; case FTS_ERR: - errx(1, "%s: %s", p->fts_path, strerror(p->fts_errno)); + if (!fflag) + errx(1, "%s: %s", p->fts_path, + strerror(p->fts_errno)); case FTS_NS: /* * FTS_NS: assume that if can't stat the file, it %%% patch ends here %%% -- Giorgos Keramidas, < keramida @ ceid . upatras . gr > "Don't let your schooling interfere with your education." [Mark Twain] To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message