From owner-freebsd-bugs@FreeBSD.ORG Tue May 19 14:30:04 2009 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 85D08106566C for ; Tue, 19 May 2009 14:30:04 +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 5A3888FC16 for ; Tue, 19 May 2009 14:30:04 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.3/8.14.3) with ESMTP id n4JEU4Fb051524 for ; Tue, 19 May 2009 14:30:04 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.3/8.14.3/Submit) id n4JEU4DI051516; Tue, 19 May 2009 14:30:04 GMT (envelope-from gnats) Date: Tue, 19 May 2009 14:30:04 GMT Message-Id: <200905191430.n4JEU4DI051516@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org From: dfilter@FreeBSD.ORG (dfilter service) Cc: Subject: Re: bin/90687: commit references a PR X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: dfilter service List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 May 2009 14:30:04 -0000 The following reply was made to PR bin/90687; it has been noted by GNATS. From: dfilter@FreeBSD.ORG (dfilter service) To: bug-followup@FreeBSD.org Cc: Subject: Re: bin/90687: commit references a PR Date: Tue, 19 May 2009 14:24:06 +0000 (UTC) Author: avg Date: Tue May 19 14:23:54 2009 New Revision: 192381 URL: http://svn.freebsd.org/changeset/base/192381 Log: find: do not silently disable -L when -delete is used First of all, current behavior is not documented and confusing, and it can be very dangerous in the following sequence: find -L . -type l find -L . -type l -delete (the second line is even suggested by find(1)). Instead simply refuse to proceed when -L and -delete are both used. A descriptive error message is provided. The following command can be safely used to remove broken links: find -L . -type l -print0 | xargs rm -0 To do: update find(1) PR: bin/90687 Obtained from: Anatoli Klassen Approved by: jhb (mentor) Modified: head/usr.bin/find/function.c Modified: head/usr.bin/find/function.c ============================================================================== --- head/usr.bin/find/function.c Tue May 19 14:10:14 2009 (r192380) +++ head/usr.bin/find/function.c Tue May 19 14:23:54 2009 (r192381) @@ -427,11 +427,13 @@ f_delete(PLAN *plan __unused, FTSENT *en /* sanity check */ if (isdepth == 0 || /* depth off */ - (ftsoptions & FTS_NOSTAT) || /* not stat()ing */ - !(ftsoptions & FTS_PHYSICAL) || /* physical off */ - (ftsoptions & FTS_LOGICAL)) /* or finally, logical on */ + (ftsoptions & FTS_NOSTAT)) /* not stat()ing */ errx(1, "-delete: insecure options got turned on"); + if (!(ftsoptions & FTS_PHYSICAL) || /* physical off */ + (ftsoptions & FTS_LOGICAL)) /* or finally, logical on */ + errx(1, "-delete: forbidden when symlinks are followed"); + /* Potentially unsafe - do not accept relative paths whatsoever */ if (strchr(entry->fts_accpath, '/') != NULL) errx(1, "-delete: %s: relative path potentially not safe", @@ -462,8 +464,6 @@ c_delete(OPTION *option, char ***argvp _ { ftsoptions &= ~FTS_NOSTAT; /* no optimise */ - ftsoptions |= FTS_PHYSICAL; /* disable -follow */ - ftsoptions &= ~FTS_LOGICAL; /* disable -follow */ isoutput = 1; /* possible output */ isdepth = 1; /* -depth implied */ _______________________________________________ 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"