Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 13 Mar 2002 09:31:04 +0300 (MSK)
From:      .@babolo.ru
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   bin/35842: rm -rf fails to delete nonexistent file [patch]
Message-ID:  <200203130631.JAA24905@aaz.links.ru>

next in thread | raw e-mail | index | archive | help


>Number:         35842
>Category:       bin
>Synopsis:       rm -f nonexistent file successful but rm -fr is not in some conditions
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Mar 12 22:30:01 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     Aleksandr A. Babaylov
>Release:        FreeBSD 4.5-STABLE i386
>Organization:
home
>Environment:

uname -a
FreeBSD cicuta.babolo.ru 4.5-STABLE FreeBSD 4.5-STABLE #7: Thu Feb 28 06:47:27 MSK 2002     babolo@cicuta.babolo.ru:/tmp/babolo/usr/src/sys/cicuta  i386

>Description:

choose nonexistant file in ro mount filesystem:

0cicuta~(53)>mount | grep mnt
/dev/ad4s1h on /mnt (ufs, local, read-only)

0cicuta~(54)>stat /mnt/a/e
Can't lstat /mnt/a/e

2cicuta~(55)>rm -f /mnt/a/e  

0cicuta~(56)>rm -fr /mnt/a/e 
rm: /mnt/a/e: Read-only file system

1cicuta~(57)>

This affects, for example buildworld on ro mount
sources.
(another thing - I do non understand contrib/libgmp/mp[zfq] 
existanse)

>How-To-Repeat:

See Description

>Fix:
	
--- bin/rm/rm.c	Wed Aug  1 09:15:56 2001
+++ bin/rm/rm.c	Wed Mar 13 08:54:54 2002
@@ -268,6 +268,14 @@
 				}
 				break;
 
+			case FTS_NS:
+				/*
+				 * FTS_NS: assume that if can't stat the file, it
+				 * can't be unlinked.
+				 */
+				if (fflag)
+					continue;
+				/* breakthrough */
 			default:
 				if (Pflag)
 					rm_overwrite(p->fts_accpath, NULL);

>Release-Note:
>Audit-Trail:
>Unformatted:

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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200203130631.JAA24905>