From shinra@61-27-47-65.home.ne.jp  Tue Nov 26 04:12:39 2002
Return-Path: <shinra@61-27-47-65.home.ne.jp>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 5882D37B401
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 26 Nov 2002 04:12:39 -0800 (PST)
Received: from 61-27-47-65.home.ne.jp (61-27-47-65.home.ne.jp [61.27.47.65])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 11E1643E9C
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 26 Nov 2002 04:12:38 -0800 (PST)
	(envelope-from shinra@61-27-47-65.home.ne.jp)
Received: from 61-27-47-65.home.ne.jp (localhost [127.0.0.1])
	by 61-27-47-65.home.ne.jp (8.12.6/8.12.6) with ESMTP id gAQCCVI6002593
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 26 Nov 2002 21:12:31 +0900 (JST)
	(envelope-from shinra@61-27-47-65.home.ne.jp)
Received: (from shinra@localhost)
	by 61-27-47-65.home.ne.jp (8.12.6/8.12.6/Submit) id gAQCCUqp002592;
	Tue, 26 Nov 2002 21:12:30 +0900 (JST)
	(envelope-from shinra)
Message-Id: <200211261212.gAQCCUqp002592@61-27-47-65.home.ne.jp>
Date: Tue, 26 Nov 2002 21:12:30 +0900 (JST)
From: AIDA Shinra <aida-s@jcom.home.ne.jp>
Reply-To: AIDA Shinra <aida-s@jcom.home.ne.jp>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: [PATCH] rm -f in MS-DOS directory
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         45749
>Category:       bin
>Synopsis:       [PATCH] rm -f in MS-DOS directory
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    trhodes
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Nov 26 04:20:00 PST 2002
>Closed-Date:    Sat Apr 23 17:27:24 GMT 2005
>Last-Modified:  Sat Apr 23 17:27:24 GMT 2005
>Originator:     AIDA Shinra
>Release:        FreeBSD 4.7-STABLE i386
>Organization:
>Environment:
System: FreeBSD e-note 4.7-STABLE FreeBSD 4.7-STABLE #2: Thu Nov 21 16:44:44 JST 2002 shinra@e-note:/usr/obj/usr/freebsd/src/sys/LOCAL i386


	
>Description:
For stat(), unlink() and others with an invalid filename fails with EINVAL on
msdosfs, rm(1) can't ignore such an argument even if -f is specified.
This means many usual commands such as "rm -f *.c" in empty directory fails in
"Invalid argument".

>How-To-Repeat:
	
>Fix:
Ignore EINVAL in addition to ENOENT.

diff -u -r1.1.1.2 -r1.3
--- rm.c	20 Jul 2002 11:31:00 -0000	1.1.1.2
+++ rm.c	26 Nov 2002 11:30:19 -0000	1.3
@@ -202,7 +202,8 @@
 			 */
 			if (!needstat)
 				break;
-			if (!fflag || p->fts_errno != ENOENT) {
+			if (!fflag || (p->fts_errno != ENOENT
+					&& p->fts_errno != EINVAL)) {
 				warnx("%s: %s",
 				    p->fts_path, strerror(p->fts_errno));
 				eval = 1;
@@ -271,7 +272,9 @@
 				if (Pflag)
 					rm_overwrite(p->fts_accpath, NULL);
 				rval = unlink(p->fts_accpath);
-				if (rval == 0 || (fflag && errno == ENOENT)) {
+				if (rval == 0 ||
+					(fflag && (errno == ENOENT
+						 || errno == EINVAL))) {
 					if (rval == 0 && vflag)
 						(void)printf("%s\n",
 						    p->fts_path);
@@ -304,7 +307,8 @@
 			if (Wflag) {
 				sb.st_mode = S_IFWHT|S_IWUSR|S_IRUSR;
 			} else {
-				if (!fflag || errno != ENOENT) {
+				if (!fflag || (errno != ENOENT
+						&& errno != EINVAL)) {
 					warn("%s", f);
 					eval = 1;
 				}

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->trhodes 
Responsible-Changed-By: trhodes 
Responsible-Changed-When: Tue Feb 17 08:35:31 PST 2004 
Responsible-Changed-Why:  
Take this PR. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=45749 
State-Changed-From-To: open->closed 
State-Changed-By: trhodes 
State-Changed-When: Sat Apr 23 17:26:50 GMT 2005 
State-Changed-Why:  
Cannot reproduce, seems to have been fixed in a latter version. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=45749 
>Unformatted:
