From owner-freebsd-bugs@FreeBSD.ORG Tue Mar 4 21:50:00 2014 Return-Path: Delivered-To: freebsd-bugs@smarthost.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D1B257B8 for ; Tue, 4 Mar 2014 21:50:00 +0000 (UTC) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id AE5DBF39 for ; Tue, 4 Mar 2014 21:50:00 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.8/8.14.8) with ESMTP id s24Lo0Oe086804 for ; Tue, 4 Mar 2014 21:50:00 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.8/8.14.8/Submit) id s24Lo02T086803; Tue, 4 Mar 2014 21:50:00 GMT (envelope-from gnats) Resent-Date: Tue, 4 Mar 2014 21:50:00 GMT Resent-Message-Id: <201403042150.s24Lo02T086803@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, John Wolfe Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7C9855B0 for ; Tue, 4 Mar 2014 21:43:35 +0000 (UTC) Received: from cgiserv.freebsd.org (cgiserv.freebsd.org [IPv6:2001:1900:2254:206a::50:4]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 678AAED4 for ; Tue, 4 Mar 2014 21:43:35 +0000 (UTC) Received: from cgiserv.freebsd.org ([127.0.1.6]) by cgiserv.freebsd.org (8.14.8/8.14.8) with ESMTP id s24LhYlE078219 for ; Tue, 4 Mar 2014 21:43:35 GMT (envelope-from nobody@cgiserv.freebsd.org) Received: (from nobody@localhost) by cgiserv.freebsd.org (8.14.8/8.14.8/Submit) id s24LhYDs078216; Tue, 4 Mar 2014 21:43:34 GMT (envelope-from nobody) Message-Id: <201403042143.s24LhYDs078216@cgiserv.freebsd.org> Date: Tue, 4 Mar 2014 21:43:34 GMT From: John Wolfe To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Subject: bin/187264: rm command: rm -r file1 file2 "" does not remove existing files or directories X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Mar 2014 21:50:01 -0000 >Number: 187264 >Category: bin >Synopsis: rm command: rm -r file1 file2 "" does not remove existing files or directories >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: Tue Mar 04 21:50:00 UTC 2014 >Closed-Date: >Last-Modified: >Originator: John Wolfe >Release: FreeBSD 9.2 (PC-BSD 9.2) >Organization: Xinuos, Inc. >Environment: FreeBSD sapphire.nj.sco.com 9.2-RELEASE-p12 FreeBSD 9.2-RELEASE-p12 #0: Thu Jan 16 21:12:30 UTC 2014 root@amd64-builder.pcbsd.org:/usr/obj/usr/src/sys/GENERIC amd64 >Description: When the gmake/make clean target contains a command of the form rm -rf "a.out" "$(DSYM)" main.o main.d the command fails to remove any of the existing files if DSYM is null. The '-f' option hides the error associated with the zero length file name, but gives no indication that, in fact, NO files/directories have been removed. >How-To-Repeat: Use the following script to see the problem rm.bug.sh: ====================== #! /bin/sh set -x cat > file_1 << !EOF 12345 How no brown cow !EOF cp file_1 file_2 cp file_1 file_3 # The following command should remove file_[123], but does not. # The '-r' implies the '-d' option - attempt to remove directories # as well as other types of files. The "" results in an error # when treated as a possible directory. # # $ rm -r "" # rm: fts_open: No such file or directory # # which is a valid error, but none of the arguments are removed. # # When the following command is run without the '-r', all three # files are removed. rm -r "file_1" "" file_[23] ls -l # Yet a "rm -r " with a non-existant file in the list, will remove # all existing files. rm -r "file_1" "xxx" file_2 ls -l >Fix: >Release-Note: >Audit-Trail: >Unformatted: