From owner-freebsd-hackers@FreeBSD.ORG Fri Apr 26 14:17:29 2013 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 21B80747 for ; Fri, 26 Apr 2013 14:17:29 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from mx1.stack.nl (relay02.stack.nl [IPv6:2001:610:1108:5010::104]) by mx1.freebsd.org (Postfix) with ESMTP id DC9281BEE for ; Fri, 26 Apr 2013 14:17:28 +0000 (UTC) Received: from snail.stack.nl (snail.stack.nl [IPv6:2001:610:1108:5010::131]) by mx1.stack.nl (Postfix) with ESMTP id 346BF3592E7; Fri, 26 Apr 2013 16:17:27 +0200 (CEST) Received: by snail.stack.nl (Postfix, from userid 1677) id 1B4AF28493; Fri, 26 Apr 2013 16:17:27 +0200 (CEST) Date: Fri, 26 Apr 2013 16:17:27 +0200 From: Jilles Tjoelker To: Joshua Isom Subject: Re: Some improvements to rm(1) Message-ID: <20130426141726.GA85955@stack.nl> References: <20130426025049.GC50623@lor.one-eyed-alien.net> <20130426122214.GA9086@stack.nl> <517A8242.6090509@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <517A8242.6090509@gmail.com> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: freebsd-hackers@freebsd.org X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Apr 2013 14:17:29 -0000 On Fri, Apr 26, 2013 at 08:33:54AM -0500, Joshua Isom wrote: > On 4/26/2013 7:23 AM, Eitan Adler wrote: > > Yes, rm's functionality can be fully replicated by find. > As well as anything using -R. Emulating other -R things using find becomes quite slow when you don't want to impose {PATH_MAX} limits or open up symlink-based race windows because the only safe option is -execdir UTILITY {} \;. Any find command based on -exec, -print or -print0 passes pathnames which are subject to {PATH_MAX} limits and directories concurrently replaced with symlinks. The construct -execdir ... {} + is unusably broken in older FreeBSD versions and gives no advantage compared to -execdir ... {} \; in recent -CURRENT. With -L, this is not a new problem because symlinks are followed anyway and the underlying code (fts(3)) always imposes the {PATH_MAX} limit in that case. The -delete primary is safe like -execdir. I'm not entirely sure about this because the rm(1) patch is simple and the new syntax is fairly clear. -- Jilles Tjoelker