From nobody@FreeBSD.org  Sun Apr  1 09:29:24 2012
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 794CB1065672
	for <freebsd-gnats-submit@FreeBSD.org>; Sun,  1 Apr 2012 09:29:24 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22])
	by mx1.freebsd.org (Postfix) with ESMTP id 63ED28FC1E
	for <freebsd-gnats-submit@FreeBSD.org>; Sun,  1 Apr 2012 09:29:24 +0000 (UTC)
Received: from red.freebsd.org (localhost [127.0.0.1])
	by red.freebsd.org (8.14.4/8.14.4) with ESMTP id q319TOLj044323
	for <freebsd-gnats-submit@FreeBSD.org>; Sun, 1 Apr 2012 09:29:24 GMT
	(envelope-from nobody@red.freebsd.org)
Received: (from nobody@localhost)
	by red.freebsd.org (8.14.4/8.14.4/Submit) id q319TOFd044322;
	Sun, 1 Apr 2012 09:29:24 GMT
	(envelope-from nobody)
Message-Id: <201204010929.q319TOFd044322@red.freebsd.org>
Date: Sun, 1 Apr 2012 09:29:24 GMT
From: Richard Kettlewell <rjk@greenend.org.uk>
To: freebsd-gnats-submit@FreeBSD.org
Subject: find -delete is silent when failing to rmdir nonempty directories
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         166554
>Category:       bin
>Synopsis:       [patch] find(1): find -delete is silent when failing to rmdir nonempty directories
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    eadler
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Apr 01 09:30:13 UTC 2012
>Closed-Date:    Wed Sep 05 16:22:24 UTC 2012
>Last-Modified:  Wed Sep 05 16:22:24 UTC 2012
>Originator:     Richard Kettlewell
>Release:        
>Organization:
>Environment:
>Description:
find -delete is documented as removing files and/or directories. However since it uses rmdir() it cannot remove nonempty directories. This is fine, but it suppresses the error message in this case. This leads to considerable user confusion.

I suggest that:

1. The limitation that it can only remove nonempty directories be documented.
2. The error message not be suppressed (i.e. that the ENOTEMPTY test be removed).

GNU find -delete does produce an error message in this case.

-delete seems to be an extension compare to SUS find, so I don't believe there are any standards-compliance questions here.

>How-To-Repeat:

>Fix:


>Release-Note:
>Audit-Trail:

From: Matthew Story <matthewstory@gmail.com>
To: Richard Kettlewell <rjk@greenend.org.uk>
Cc: freebsd-gnats-submit@freebsd.org
Subject: Re: bin/166554: find -delete is silent when failing to rmdir nonempty directories
Date: Sun, 1 Apr 2012 14:10:04 -0400

 --bcaec51d21a4a5912104bca1fbed
 Content-Type: text/plain; charset=ISO-8859-1
 
 > GNU find -delete does produce an error message in this case.
 
 I agree with this assessment, patch attached for consideration.
 Following the patch:
 
 $ # old behavior
 $ mkdir -p foo/bar/baz
 $ find ./foo -depth 1 -delete
 $ find ./foo -depth 1
 ./foo/bar
 $ # new behavior
 $ mkdir -p foo/bar/baz
 $ find ./foo -depth 1 -delete
 find: -delete: rmdir(./foo/bar): Directory not empty
 $ find ./foo -depth 1
 ./foo/bar
 
 >
 > -delete seems to be an extension compare to SUS find, so I don't believe there are any standards-compliance questions here.
 
 POSIX 2008 does not define any -delete primary, so there are no
 standards-compliance questions.
 
 Patch is also available via HTTP here:
 
 http://axe0.blackskyresearch.net/patches/matt/freebsd.PR166554.patch.txt
 
 -- 
 regards,
 matt
 
 --bcaec51d21a4a5912104bca1fbed
 Content-Type: text/plain; charset=US-ASCII; name="freebsd.PR166554.patch.txt"
 Content-Disposition: attachment; filename="freebsd.PR166554.patch.txt"
 Content-Transfer-Encoding: base64
 X-Attachment-Id: f_h0iem7k00
 
 SW5kZXg6IGZpbmQuMQo9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
 PT09PT09PT09PT09PT09PT09PT09PT09Ci0tLSBmaW5kLjEJKHJldmlzaW9uIDIzMzc1OSkKKysr
 IGZ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ec51d21a4a5912104bca1fbed--
Responsible-Changed-From-To: freebsd-bugs->eadler 
Responsible-Changed-By: eadler 
Responsible-Changed-When: Sun May 13 22:25:33 UTC 2012 
Responsible-Changed-Why:  
I'll take it. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=166554 

From: Eitan Adler <lists@eitanadler.com>
To: Richard Kettlewell <rjk@greenend.org.uk>
Cc: bug-followup@freebsd.org
Subject: Re: bin/166554: find -delete is silent when failing to rmdir nonempty directories
Date: Thu, 17 May 2012 23:04:46 -0400

 On 1 April 2012 05:29, Richard Kettlewell <rjk@greenend.org.uk> wrote:
 >>Synopsis: =C2=A0 =C2=A0 =C2=A0 find -delete is silent when failing to rmd=
 ir nonempty directories
 
 Hi,
 
 this behavior is intentional. I don't have any objection to changing
 it, but please raise the issue on -hackers first.
 
 As to documenting the behavior, in either case it should be documented
 and I will attempt to commit something of that sort "soon"
 
 
 --=20
 Eitan Adler
State-Changed-From-To: open->analyzed 
State-Changed-By: eadler 
State-Changed-When: Fri Jun 1 07:17:59 UTC 2012 
State-Changed-Why:  
awaiting approval 

http://www.freebsd.org/cgi/query-pr.cgi?pr=166554 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/166554: commit references a PR
Date: Sat,  2 Jun 2012 03:13:38 +0000 (UTC)

 Author: eadler
 Date: Sat Jun  2 03:13:27 2012
 New Revision: 236433
 URL: http://svn.freebsd.org/changeset/base/236433
 
 Log:
   Document the limitations of the -delete primary
   
   PR:		bin/166554
   Submitted by:	Richard Kettlewell <rjk@greenend.org.uk>
   Discussed with:	jilles
   Approved by:	bcr
   MFC after:	3 days
 
 Modified:
   head/usr.bin/find/find.1
 
 Modified: head/usr.bin/find/find.1
 ==============================================================================
 --- head/usr.bin/find/find.1	Sat Jun  2 02:27:01 2012	(r236432)
 +++ head/usr.bin/find/find.1	Sat Jun  2 03:13:27 2012	(r236433)
 @@ -31,7 +31,7 @@
  .\"	@(#)find.1	8.7 (Berkeley) 5/9/95
  .\" $FreeBSD$
  .\"
 -.Dd September 28, 2011
 +.Dd May 06, 2012
  .Dt FIND 1
  .Os
  .Sh NAME
 @@ -319,6 +319,9 @@ character in its pathname relative to
  .Dq Pa \&.
  for security reasons.
  Depth-first traversal processing is implied by this option.
 +The
 +.Ic -delete
 +primary will fail to delete a directory if it is not empty.
  Following symlinks is incompatible with this option.
  .It Ic -depth
  Always true;
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: analyzed->patched 
State-Changed-By: eadler 
State-Changed-When: Sat Jun 2 03:24:20 UTC 2012 
State-Changed-Why:  
committed in r236433 

http://www.freebsd.org/cgi/query-pr.cgi?pr=166554 
State-Changed-From-To: patched->closed 
State-Changed-By: eadler 
State-Changed-When: Wed Sep 5 16:22:21 UTC 2012 
State-Changed-Why:  
MFCed 

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