From arkadi@hosting.lv  Mon Jun 14 18:36:35 2004
Return-Path: <arkadi@hosting.lv>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 5B3DB16A4CE
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 14 Jun 2004 18:36:35 +0000 (GMT)
Received: from idea.hosting.lv (idea.hosting.lv [62.85.37.81])
	by mx1.FreeBSD.org (Postfix) with ESMTP id C982743D41
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 14 Jun 2004 18:36:34 +0000 (GMT)
	(envelope-from arkadi@hosting.lv)
Received: from arkadi by mail.hosting.lv with local 
	id 1BZwJI-0004fy-00
	for FreeBSD-gnats-submit@freebsd.org; Mon, 14 Jun 2004 21:35:56 +0300
Message-Id: <E1BZwJI-0004fy-00@idea.hosting.lv>
Date: Mon, 14 Jun 2004 21:35:56 +0300
From: Arkadi Shishlov <arkadi@hosting.lv>
Reply-To: Arkadi Shishlov <arkadi@hosting.lv>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: find(1) fails when current directory is not readable by user
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         67943
>Category:       bin
>Synopsis:       find(1) fails when current directory is not readable by user
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Jun 14 18:40:22 GMT 2004
>Closed-Date:    
>Last-Modified:  Fri Feb 15 06:04:43 UTC 2008
>Originator:     Arkadi Shishlov
>Release:        FreeBSD 4.9-RELEASE-p3 i386
>Organization:
>Environment:
System: FreeBSD idea.hosting.lv 4.9-RELEASE-p3 FreeBSD 4.9-RELEASE-p3 #0: Wed Mar 3 21:51:26 EET 2004 root@idea.hosting.lv:/usr/obj/usr/src/sys/idea i386

>Description:
find(1) utility opens current directory dotfd = open(".", O_RDONLY, 0)
and use obtained dotfd handle later in fchdir(). 
If current directory is not readable by user then find fails.

>How-To-Repeat:
mkdir dir
chmod -r dir
cd dir
find /tmp
find: .: Permission denied

>Fix:
dotfd handle is only used when -exec predicate is requested.
find(1) from GNU findutils combat this situation by using getcwd()
call in case cwd is not readable.
>Release-Note:
>Audit-Trail:
>Unformatted:
