From nobody@FreeBSD.org Thu May 29 02:02:46 2008 Return-Path: Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0B3D4106566B for ; Thu, 29 May 2008 02:02:46 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21]) by mx1.freebsd.org (Postfix) with ESMTP id 1A0158FC17 for ; Thu, 29 May 2008 02:02:46 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.14.2/8.14.2) with ESMTP id m4T216VL024482 for ; Thu, 29 May 2008 02:01:06 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.14.2/8.14.1/Submit) id m4T216HN024481; Thu, 29 May 2008 02:01:06 GMT (envelope-from nobody) Message-Id: <200805290201.m4T216HN024481@www.freebsd.org> Date: Thu, 29 May 2008 02:01:06 GMT From: "Michael A. Smith" To: freebsd-gnats-submit@FreeBSD.org Subject: find -execdir does not prepend ./ to filenames, causing problems for certain files. X-Send-Pr-Version: www-3.1 X-GNATS-Notify: >Number: 124084 >Category: bin >Synopsis: find(1): find -execdir does not prepend ./ to filenames, causing problems for certain files. >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: Thu May 29 02:10:01 UTC 2008 >Closed-Date: >Last-Modified: Tue Mar 24 01:50:04 UTC 2009 >Originator: Michael A. Smith >Release: 7.0 >Organization: >Environment: >Description: freebsd find's implementation of -execdir fails for filenames that might be mistaken for arguments. >How-To-Repeat: The classic example is a filename starting with a dash. $ mkdir /tmp/test $ cd /tmp/test $ >"-foo" $ find . -type f -execdir rm {} \; rm: illegal option -- o usage: rm [-f | -i] [-dPRrvW] file ... unlink file >Fix: The easiest solution is to patch find to prepend ./ to each filename. >Release-Note: >Audit-Trail: From: Remko Lodder To: "Michael A. Smith" Cc: freebsd-gnats-submit@FreeBSD.org Subject: Re: bin/124084: find -execdir does not prepend ./ to filenames, causing problems for certain files. Date: Fri, 30 May 2008 16:42:41 +0200 as a workaround you can do: find . -type f -exec rm {} \; (for example). -- /"\ Best regards, | remko@FreeBSD.org \ / Remko Lodder | remko@EFnet X http://www.evilcoder.org/ | / \ ASCII Ribbon Campaign | Against HTML Mail and News From: Scott Sosna To: bug-followup@FreeBSD.org, michael@smith-li.com Cc: Subject: Re: bin/124084: find(1): find -execdir does not prepend ./ to filenames, causing problems for certain files. Date: Mon, 23 Mar 2009 20:29:15 -0500 This is a multi-part message in MIME format. --------------070607050305000006090009 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit The same problem occurs with touch: $ touch "-foo" touch: illegal option -- o usage: touch [-acfhm] [-r file] [-t [[CC]YY]MMDDhhmm[.SS]] file ... --------------070607050305000006090009 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit The same problem occurs with touch:

$ touch "-foo"
touch: illegal option -- o
usage: touch [-acfhm] [-r file] [-t [[CC]YY]MMDDhhmm[.SS]] file ...

--------------070607050305000006090009-- >Unformatted: