This queue is for tickets about the File-Path CPAN distribution.

Report information
The Basics
Id:
122648
Status:
resolved
Priority:
Low/Low
Queue:

People
Owner:
jkeenan [...] cpan.org
Requestors:
jkeenan [...] pobox.com
Cc:
AdminCc:

BugTracker
Severity:
(no value)
Broken in:
  • 2.12_006
  • 2.12_007
  • 2.12_008
  • 2.13
  • 2.14
Fixed in:
2.15



MIME-Version: 1.0
X-Spam-Status: No, score=-2.608 tagged_above=-99.9 required=10 tests=[AWL=-1.387, BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, SPF_NEUTRAL=0.779] autolearn=no
X-Cpan.org: This message routed through the cpan.org mail forwarding service. Please use PAUSE pause.perl.org to configure your delivery settings.
X-Spam-Flag: NO
Content-Language: en-US
content-type: text/plain; charset="utf-8"; format="flowed"
Message-ID: <246dc174-2cf5-d46b-aafb-62576f0545dc@pobox.com>
X-Virus-Scanned: Debian amavisd-new at bestpractical.com
X-Spam-Score: -2.608
Received: from localhost (localhost [127.0.0.1]) by hipster.bestpractical.com (Postfix) with ESMTP id 7BFC32401C3 for <cpan-bug+File-Path@hipster.bestpractical.com>; Sat, 29 Jul 2017 22:22:19 -0400 (EDT)
Received: from hipster.bestpractical.com ([127.0.0.1]) by localhost (hipster.bestpractical.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id bW6E64ywUo9M for <cpan-bug+File-Path@hipster.bestpractical.com>; Sat, 29 Jul 2017 22:22:02 -0400 (EDT)
Received: from xx1.develooper.com (xx1.develooper.com [207.171.7.115]) by hipster.bestpractical.com (Postfix) with ESMTPS id C7AB72400D2 for <bug-File-Path@rt.cpan.org>; Sat, 29 Jul 2017 22:22:01 -0400 (EDT)
Received: from localhost (xx1.develooper.com [127.0.0.1]) by localhost (Postfix) with ESMTP id 794E211EDE0 for <bug-File-Path@rt.cpan.org>; Sat, 29 Jul 2017 19:22:00 -0700 (PDT)
Received: from xx1.develooper.com (xx1.develooper.com [127.0.0.1]) by localhost (Postfix) with SMTP id 9101611EDCF for <bug-File-Path@rt.cpan.org>; Sat, 29 Jul 2017 19:21:58 -0700 (PDT)
Received: from sasl.smtp.pobox.com (pb-smtp1.pobox.com [64.147.108.70]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by xx1.develooper.com (Postfix) with ESMTPS id 3C36E11EDA3 for <bug-File-Path@rt.cpan.org>; Sat, 29 Jul 2017 19:21:52 -0700 (PDT)
Received: from sasl.smtp.pobox.com (unknown [127.0.0.1]) by pb-smtp1.pobox.com (Postfix) with ESMTP id 53A24AA7CD for <bug-File-Path@rt.cpan.org>; Sat, 29 Jul 2017 22:21:51 -0400 (EDT)
Received: from pb-smtp1.nyi.icgroup.com (unknown [127.0.0.1]) by pb-smtp1.pobox.com (Postfix) with ESMTP id 4CDFFAA7CC for <bug-File-Path@rt.cpan.org>; Sat, 29 Jul 2017 22:21:51 -0400 (EDT)
Received: from [192.168.1.44] (unknown [71.246.115.115]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pb-smtp1.pobox.com (Postfix) with ESMTPSA id B59D2AA7CB for <bug-File-Path@rt.cpan.org>; Sat, 29 Jul 2017 22:21:50 -0400 (EDT)
Authentication-Results: hipster.bestpractical.com (amavisd-new); dkim=pass header.i=@pobox.com
Authentication-Results: hipster.bestpractical.com (amavisd-new); domainkeys=pass header.from=jkeenan@pobox.com
Delivered-To: cpan-bug+File-Path@hipster.bestpractical.com
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1
Subject: Documentation error: remove_tree(), rmtree() do accept files as arguments
Return-Path: <jkeenan@pobox.com>
Domainkey-Signature: a=rsa-sha1; c=nofws; d=pobox.com; h=to:from:subject :message-id:date:mime-version:content-type :content-transfer-encoding; q=dns; s=sasl; b=Qlq6J2f8qZzM7wnEizn 49PIgCjVn6U8SfftGXevTgf2hMXzVO6egnaR0KyvGa9VKCRoV86RbUMFXlf0rkUm DogSK+ZNr/HlZKb/U9klz+b5iyaXJOaiqnMA31CizntXdt8p79I3/lcdCq6mfCMS ktvDD3FXynDn8LAvZZWR9u+A=
X-RT-Mail-Extension: file-path
X-Original-To: cpan-bug+File-Path@hipster.bestpractical.com
Dkim-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=to:from :subject:message-id:date:mime-version:content-type :content-transfer-encoding; s=sasl; bh=6L+UgGrZPYPFq57n2dRCCYwk8 IA=; b=TPGCy1Ax+MBPlLQ0ReuByvbf1nMr6OeyRN4vSY7X8NIsDMmryZgD6ZWzv kZoCaupJJq4T2ibtG/A0Vj+vY54rjzudjvaBtETZuLMMvyygyW5cnPdpAHXr3y+n TUd+zDDYCowN2cL/CaAJn6+Qusw6w+IbIXNPtjstdYtHXpS698=
X-PMX-Spam: Gauge=IIIIIIII, Probability=8%, Report=' HTML_00_01 0.05, HTML_00_10 0.05, BODYTEXTP_SIZE_3000_LESS 0, BODY_SIZE_1700_1799 0, BODY_SIZE_2000_LESS 0, BODY_SIZE_5000_LESS 0, BODY_SIZE_7000_LESS 0, DATE_TZ_NA 0, DKIM_SIGNATURE 0, DOMAINKEY_SIG 0, NO_CTA_URI_FOUND 0, NO_URI_FOUND 0, NO_URI_HTTPS 0, SPF_PASS 0, __CT 0, __CTE 0, __CT_TEXT_PLAIN 0, __FRAUD_MONEY_CURRENCY 0, __FRAUD_MONEY_CURRENCY_DOLLAR 0, __HAS_FROM 0, __HAS_MSGID 0, __MIME_TEXT_ONLY 0, __MIME_TEXT_P 0, __MIME_TEXT_P1 0, __MIME_VERSION 0, __MOZILLA_USER_AGENT 0, __NO_HTML_TAG_RAW 0, __SANE_MSGID 0, __SUBJ_ALPHA_END 0, __TO_MALFORMED_2 0, __TO_NO_NAME 0, __USER_AGENT 0, __blackholes.mail-abuse.org_TIMEOUT , __zen.spamhaus.org_ERROR '
Date: Sat, 29 Jul 2017 22:21:49 -0400
X-Spam-Level:
X-PMX-Version: 5.6.1.2065439, Antispam-Engine: 2.7.2.376379, Antispam-Data: 2017.7.30.21517
To: bug-File-Path@rt.cpan.org
X-Pobox-Relay-ID: D88837F0-74CD-11E7-9191-FE4B1A68708C-57062903!pb-smtp1.pobox.com
Content-Transfer-Encoding: 7bit
From: James E Keenan <jkeenan@pobox.com>
X-RT-Original-Encoding: utf-8
X-RT-Interface: Email
Content-Length: 1717
In commit 4b54a837 in mid-2015 a statement was added to the documentation for File::Path::remove_tree() which erroneously claimed that remove_tree() accepted only directories: ##### diff --git a/lib/File/Path.pm b/lib/File/Path.pm index 3ee17bc..4e8fd8a 100644 --- a/lib/File/Path.pm +++ b/lib/File/Path.pm @@ -717,11 +717,14 @@ return value of the function is otherwise identical to make_path(). The C<remove_tree> function deletes the given directories and any files and subdirectories they might contain, much like the Unix -command C<rm -r> or the Windows commands C<rmdir /s> and C<rd /s>. +command C<rm -r> or the Windows commands C<rmdir /s> and C<rd /s>. The +only exception to the function similarity is C<remove_tree> accepts +only directories whereas C<rm -r> also accepts files. ##### While remove_tree() and rmtree() suggest by their names that directories are their intended arguments, the code has never enforced a prohibition on passing non-directory filesystem entries as arguments. Indeed, t/Path.t has long contained the following code: ##### my $file_name = catfile( $tmp_base, 'a', 'delete.me' ); my $file_count = 0; if (open OUT, "> $file_name") { print OUT "this file may be deleted\n"; close OUT; ++$file_count; } else { diag( "Failed to create file $file_name: $!" ); } SKIP: { skip "cannot remove a file we failed to create", 1 unless $file_count == 1; my $count = rmtree($file_name); is($count, 1, "rmtree'ed a file"); } ##### Other code blocks in t/Path.t demonstrate that symlinks can be passed as arguments to these functions. The documentation should change to reflect the actual behavior. Thank you very much. Jim Keenan
MIME-Version: 1.0
In-Reply-To: <246dc174-2cf5-d46b-aafb-62576f0545dc@pobox.com>
X-Mailer: MIME-tools 5.504 (Entity 5.504)
Content-Disposition: inline
X-RT-Interface: Web
References: <246dc174-2cf5-d46b-aafb-62576f0545dc@pobox.com>
Content-Type: text/plain; charset="utf-8"
Message-ID: <rt-4.0.18-13470-1501382566-208.122648-0-0@rt.cpan.org>
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
X-RT-Encrypt: 0
X-RT-Sign: 0
Content-Length: 1992
On Sat Jul 29 22:22:20 2017, jkeenan@pobox.com wrote:
Show quoted text
> In commit 4b54a837 in mid-2015 a statement was added to the > documentation for File::Path::remove_tree() which erroneously claimed > that remove_tree() accepted only directories: > > ##### > diff --git a/lib/File/Path.pm b/lib/File/Path.pm > index 3ee17bc..4e8fd8a 100644 > --- a/lib/File/Path.pm > +++ b/lib/File/Path.pm > @@ -717,11 +717,14 @@ return value of the function is otherwise > identical to make_path(). > > The C<remove_tree> function deletes the given directories and any > files and subdirectories they might contain, much like the Unix > -command C<rm -r> or the Windows commands C<rmdir /s> and C<rd /s>. > +command C<rm -r> or the Windows commands C<rmdir /s> and C<rd /s>. The > +only exception to the function similarity is C<remove_tree> accepts > +only directories whereas C<rm -r> also accepts files. > ##### > > While remove_tree() and rmtree() suggest by their names that directories > are their intended arguments, the code has never enforced a prohibition > on passing non-directory filesystem entries as arguments. Indeed, > t/Path.t has long contained the following code: > > ##### > my $file_name = catfile( $tmp_base, 'a', 'delete.me' ); > my $file_count = 0; > if (open OUT, "> $file_name") { > print OUT "this file may be deleted\n"; > close OUT; > ++$file_count; > } > else { > diag( "Failed to create file $file_name: $!" ); > } > > SKIP: { > skip "cannot remove a file we failed to create", 1 > unless $file_count == 1; > my $count = rmtree($file_name); > is($count, 1, "rmtree'ed a file"); > } > ##### > > Other code blocks in t/Path.t demonstrate that symlinks can be passed as > arguments to these functions. > > The documentation should change to reflect the actual behavior. > > Thank you very much. > Jim Keenan
Fixed in commit 97ffbf88181d6d0358eec796e28d2e40d6f0e328. Uploaded version 2.15 to CPAN. Marking ticket resolved.


This service runs on Request Tracker, is sponsored by The Perl Foundation, and maintained by Best Practical Solutions.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.