From owner-freebsd-bugs@FreeBSD.ORG Mon Nov 29 14:20:12 2010 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CAB1110656BE for ; Mon, 29 Nov 2010 14:20:12 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id A031D8FC13 for ; Mon, 29 Nov 2010 14:20:12 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id oATEKCWE056801 for ; Mon, 29 Nov 2010 14:20:12 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id oATEKCHg056800; Mon, 29 Nov 2010 14:20:12 GMT (envelope-from gnats) Resent-Date: Mon, 29 Nov 2010 14:20:12 GMT Resent-Message-Id: <201011291420.oATEKCHg056800@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, "Denise H. G." Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C59D0106564A for ; Mon, 29 Nov 2010 14:15:34 +0000 (UTC) (envelope-from darcsis@gmail.com) Received: from mail-iw0-f182.google.com (mail-iw0-f182.google.com [209.85.214.182]) by mx1.freebsd.org (Postfix) with ESMTP id 838838FC16 for ; Mon, 29 Nov 2010 14:15:34 +0000 (UTC) Received: by iwn39 with SMTP id 39so5697186iwn.13 for ; Mon, 29 Nov 2010 06:15:33 -0800 (PST) Received: by 10.231.35.138 with SMTP id p10mr5686374ibd.104.1291040133403; Mon, 29 Nov 2010 06:15:33 -0800 (PST) Received: from smtp.xbsd.name ([123.117.56.42]) by mx.google.com with ESMTPS id 8sm5963682iba.16.2010.11.29.06.15.30 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 29 Nov 2010 06:15:32 -0800 (PST) Received: from pluton.xbsd.name (pluton.xbsd.name [172.16.1.10]) by smtp.xbsd.name (OpenSMTPD) with ESMTP id 8mpS5NzI (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128) for ; Mon, 29 Nov 2010 22:15:23 +0800 (CST) Message-Id: <868w0c6wsn.fsf@pluton.xbsd.name> Date: Mon, 29 Nov 2010 22:15:20 +0800 From: "Denise H. G." To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: MiSendPr 0.3 Cc: Subject: bin/152673: [patch] find(1): correctly find empty dirs. X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: "Denise H. G." List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Nov 2010 14:20:13 -0000 >Number: 152673 >Category: bin >Synopsis: [patch] find(1): correctly find empty dirs. >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Mon Nov 29 14:20:12 UTC 2010 >Closed-Date: >Last-Modified: >Originator: Denise H. G. >Release: FreeBSD 8.2-PRERELEASE amd64 >Organization: XBSD Networks >Environment: System: FreeBSD pluton.xbsd.name 8.2-PRERELEASE FreeBSD 8.2-PRERELEASE #0: Mon Nov 29 08:41:06 CST 2010 root@pluton.xbsd.name:/opt/obj/sysbld/usr/src/sys/pluton-amd64 amd64 >Description: While searching for empty directories, find(1) quits if it encounters the first dir it can't descend into. However, it is supposed to print out an warning message and continue with the rest of the file hierachy. >How-To-Repeat: As a non-privileged user, execute: find /var -type d -empty >Fix: --- function.c.diff begins here --- --- usr.bin/find/function.c.orig 2010-11-29 21:44:30.451542259 +0800 +++ usr.bin/find/function.c 2010-11-29 21:49:24.670933099 +0800 @@ -559,8 +559,10 @@ empty = 1; dir = opendir(entry->fts_accpath); - if (dir == NULL) - err(1, "%s", entry->fts_accpath); + if (dir == NULL) { + warn("%s", entry->fts_accpath); + return 0; + } for (dp = readdir(dir); dp; dp = readdir(dir)) if (dp->d_name[0] != '.' || (dp->d_name[1] != '\0' && --- function.c.diff ends here --- >Release-Note: >Audit-Trail: >Unformatted: