Skip Menu |
 

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

Report information
The Basics
Id: 90452
Status: rejected
Priority: 0/
Queue: File-Path

People
Owner: RICHE [...] cpan.org
Requestors: lschrieber [...] sparkim.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: File::Path qw(remove_tree)
Date: Sun, 17 Nov 2013 11:02:02 -0500
To: bug-File-Path [...] rt.cpan.org
From: "Len Schrieber" <lschrieber [...] sparkim.com>
Download (untitled) / with headers
text/plain 166b
Using perl 5.16.3, windows 7. use File::Path qw(remove_tree); If I say:   remove_tree("a/...");   # (any positive number of dots) it removes directory a.
Download (untitled) / with headers
text/plain 649b
On Sun Nov 17 11:02:21 2013, lschrieber@sparkim.com wrote: Show quoted text
> Using perl 5.16.3, windows 7. > > use File::Path qw(remove_tree); > > If I say: > >   remove_tree("a/...");   # (any positive number of dots) > > it removes directory a. >
This may be Windows-specific. I could not reproduce the problem on Ubuntu Linux 14.04-LTS with perl-5.20.1 and File-Path 2.09. ##### [tmp] 28 $ mkdir -p a/alpha/beta [tmp] 29 $ perl -MFile::Path -e 'File::Path::remove_tree("a/...");' [tmp] 30 $ ls -l a total 4 drwxrwxr-x 3 jkeenan jkeenan 4096 Apr 15 22:10 alpha [tmp] 31 $ ls -l a/alpha/ total 4 drwxrwxr-x 2 jkeenan jkeenan 4096 Apr 15 22:10 beta #####
Subject: Re: [rt.cpan.org #90452] File: : Path qw(remove_tree)
Date: Thu, 16 Apr 2015 09:42:28 -0400
To: bug-File-Path [...] rt.cpan.org
From: "Len Schrieber" <lschrieber [...] sparkim.com>
Yes, it is Windows-specific, as I indicated in the original bug report. Len Schrieber Spark Investment Management LLC Show quoted text
-----Original Message----- From: "James E Keenan via RT" <bug-File-Path@rt.cpan.org> To: lschrieber@sparkim.com Date: 2015-04-15 22:14 Subject: [rt.cpan.org #90452] File::Path qw(remove_tree) <URL: https://rt.cpan.org/Ticket/Display.html?id=90452 > On Sun Nov 17 11:02:21 2013, lschrieber@sparkim.com wrote:
> Using perl 5.16.3, windows 7. > > use File::Path qw(remove_tree); > > If I say: > >   remove_tree("a/...");   # (any positive number of dots) > > it removes directory a. >
This may be Windows-specific.  I could not reproduce the problem on Ubuntu Linux 14.04-LTS with perl-5.20.1 and File-Path 2.09. ##### [tmp] 28 $ mkdir -p a/alpha/beta [tmp] 29 $ perl -MFile::Path -e 'File::Path::remove_tree("a/...");' [tmp] 30 $ ls -l a total 4 drwxrwxr-x 3 jkeenan jkeenan 4096 Apr 15 22:10 alpha [tmp] 31 $ ls -l a/alpha/ total 4 drwxrwxr-x 2 jkeenan jkeenan 4096 Apr 15 22:10 beta #####
Download (untitled) / with headers
text/plain 1.1k
Confirmed this issue as reproducible. On Thu Apr 16 09:42:44 2015, lschrieber@sparkim.com wrote: Show quoted text
> Yes, it is Windows-specific, as I indicated in the original bug > report. > > Len Schrieber > Spark Investment Management LLC > > -----Original Message----- > From: "James E Keenan via RT" <bug-File-Path@rt.cpan.org> > To: lschrieber@sparkim.com > Date: 2015-04-15 22:14 > Subject: [rt.cpan.org #90452] File::Path qw(remove_tree) > > <URL: https://rt.cpan.org/Ticket/Display.html?id=90452 > > > On Sun Nov 17 11:02:21 2013, lschrieber@sparkim.com wrote:
> > Using perl 5.16.3, windows 7. > > > > use File::Path qw(remove_tree); > > > > If I say: > > > >   remove_tree("a/...");   # (any positive number of dots) > > > > it removes directory a. > >
> > This may be Windows-specific.  I could not reproduce the problem on > Ubuntu Linux 14.04-LTS with perl-5.20.1 and File-Path 2.09. > > ##### > [tmp] 28 $ mkdir -p a/alpha/beta > [tmp] 29 $ perl -MFile::Path -e 'File::Path::remove_tree("a/...");' > [tmp] 30 $ ls -l a > total 4 > drwxrwxr-x 3 jkeenan jkeenan 4096 Apr 15 22:10 alpha > [tmp] 31 $ ls -l a/alpha/ > total 4 > drwxrwxr-x 2 jkeenan jkeenan 4096 Apr 15 22:10 beta > #####
Download (untitled) / with headers
text/plain 1.4k
Found that the issue is with lstat/stat. Filed defect with perl core. https://rt.perl.org/Ticket/Display.html?id=124443 On Sat May 02 12:03:43 2015, RICHE wrote: Show quoted text
> Confirmed this issue as reproducible. > > On Thu Apr 16 09:42:44 2015, lschrieber@sparkim.com wrote:
> > Yes, it is Windows-specific, as I indicated in the original bug > > report. > > > > Len Schrieber > > Spark Investment Management LLC > > > > -----Original Message----- > > From: "James E Keenan via RT" <bug-File-Path@rt.cpan.org> > > To: lschrieber@sparkim.com > > Date: 2015-04-15 22:14 > > Subject: [rt.cpan.org #90452] File::Path qw(remove_tree) > > > > <URL: https://rt.cpan.org/Ticket/Display.html?id=90452 > > > > > On Sun Nov 17 11:02:21 2013, lschrieber@sparkim.com wrote:
> > > Using perl 5.16.3, windows 7. > > > > > > use File::Path qw(remove_tree); > > > > > > If I say: > > > > > >   remove_tree("a/...");   # (any positive number of dots) > > > > > > it removes directory a. > > >
> > > > This may be Windows-specific.  I could not reproduce the problem on > > Ubuntu Linux 14.04-LTS with perl-5.20.1 and File-Path 2.09. > > > > ##### > > [tmp] 28 $ mkdir -p a/alpha/beta > > [tmp] 29 $ perl -MFile::Path -e 'File::Path::remove_tree("a/...");' > > [tmp] 30 $ ls -l a > > total 4 > > drwxrwxr-x 3 jkeenan jkeenan 4096 Apr 15 22:10 alpha > > [tmp] 31 $ ls -l a/alpha/ > > total 4 > > drwxrwxr-x 2 jkeenan jkeenan 4096 Apr 15 22:10 beta > > #####
> >
Download (untitled) / with headers
text/plain 1.4k
Found that the issue is with lstat/stat. Filed defect with perl core. https://rt.perl.org/Ticket/Display.html?id=124443 On Sat May 02 12:03:43 2015, RICHE wrote: Show quoted text
> Confirmed this issue as reproducible. > > On Thu Apr 16 09:42:44 2015, lschrieber@sparkim.com wrote:
> > Yes, it is Windows-specific, as I indicated in the original bug > > report. > > > > Len Schrieber > > Spark Investment Management LLC > > > > -----Original Message----- > > From: "James E Keenan via RT" <bug-File-Path@rt.cpan.org> > > To: lschrieber@sparkim.com > > Date: 2015-04-15 22:14 > > Subject: [rt.cpan.org #90452] File::Path qw(remove_tree) > > > > <URL: https://rt.cpan.org/Ticket/Display.html?id=90452 > > > > > On Sun Nov 17 11:02:21 2013, lschrieber@sparkim.com wrote:
> > > Using perl 5.16.3, windows 7. > > > > > > use File::Path qw(remove_tree); > > > > > > If I say: > > > > > >   remove_tree("a/...");   # (any positive number of dots) > > > > > > it removes directory a. > > >
> > > > This may be Windows-specific.  I could not reproduce the problem on > > Ubuntu Linux 14.04-LTS with perl-5.20.1 and File-Path 2.09. > > > > ##### > > [tmp] 28 $ mkdir -p a/alpha/beta > > [tmp] 29 $ perl -MFile::Path -e 'File::Path::remove_tree("a/...");' > > [tmp] 30 $ ls -l a > > total 4 > > drwxrwxr-x 3 jkeenan jkeenan 4096 Apr 15 22:10 alpha > > [tmp] 31 $ ls -l a/alpha/ > > total 4 > > drwxrwxr-x 2 jkeenan jkeenan 4096 Apr 15 22:10 beta > > #####
> >
Download (untitled) / with headers
text/plain 1.8k
On Sat May 02 14:31:46 2015, RICHE wrote: Show quoted text
> Found that the issue is with lstat/stat. > > Filed defect with perl core. > > https://rt.perl.org/Ticket/Display.html?id=124443 > > > On Sat May 02 12:03:43 2015, RICHE wrote:
> > Confirmed this issue as reproducible. > > > > On Thu Apr 16 09:42:44 2015, lschrieber@sparkim.com wrote:
> > > Yes, it is Windows-specific, as I indicated in the original bug > > > report. > > > > > > Len Schrieber > > > Spark Investment Management LLC > > > > > > -----Original Message----- > > > From: "James E Keenan via RT" <bug-File-Path@rt.cpan.org> > > > To: lschrieber@sparkim.com > > > Date: 2015-04-15 22:14 > > > Subject: [rt.cpan.org #90452] File::Path qw(remove_tree) > > > > > > <URL: https://rt.cpan.org/Ticket/Display.html?id=90452 > > > > > > > On Sun Nov 17 11:02:21 2013, lschrieber@sparkim.com wrote:
> > > > Using perl 5.16.3, windows 7. > > > > > > > > use File::Path qw(remove_tree); > > > > > > > > If I say: > > > > > > > >   remove_tree("a/...");   # (any positive number of dots) > > > > > > > > it removes directory a. > > > >
> > > > > > This may be Windows-specific.  I could not reproduce the problem on > > > Ubuntu Linux 14.04-LTS with perl-5.20.1 and File-Path 2.09. > > > > > > ##### > > > [tmp] 28 $ mkdir -p a/alpha/beta > > > [tmp] 29 $ perl -MFile::Path -e 'File::Path::remove_tree("a/...");' > > > [tmp] 30 $ ls -l a > > > total 4 > > > drwxrwxr-x 3 jkeenan jkeenan 4096 Apr 15 22:10 alpha > > > [tmp] 31 $ ls -l a/alpha/ > > > total 4 > > > drwxrwxr-x 2 jkeenan jkeenan 4096 Apr 15 22:10 beta > > > #####
> > > >
>
I've never had occasion to call a function on a path where a path separator is followed by 3 dots. So I know what, say, "ls -l xyz/." means, and I know what "ls -l xyz/.." means. But I don't know (at least in a Unix-based world) what "ls -l xyz/..." in intended to mean? Can you clarify? Thank you very much. Jim Keenan
Hello Jim, This is a Windows platform-specific "side effect". For example, one cannot: - mkdir a/... - echo > a/... But one can: - cd a/... When running remove_tree("a/...") on Linux/OSX, this operation fails (prior to the hackathon, no error would be reported, but this is fixed via RT 39949). A goto label is issued when lstat fails (empty array). When running the same command on Windows, the operation "succeeds". lstat fails back to stat, which does not return an empty array as expected (hence the core RT filing). So the code keeps rolling, and then interprets the path as "destroy a". I think there are two fundamental problems here: 1. The user code is not portable if the user relies on the lstat failing in order to make decisions. I think it's reasonable to rely on stat. 2. The operation can be very destructive - for example if the user has constructed a variable : $f = "$a.$b.$c"; And that actually resolves to: $f = "..."; Then on any platform but Windows the call to remove_tree would not be destructive. But on Windows -- implosion. On Sun May 03 00:03:09 2015, JKEENAN wrote: Show quoted text
> On Sat May 02 14:31:46 2015, RICHE wrote:
> > Found that the issue is with lstat/stat. > > > > Filed defect with perl core. > > > > https://rt.perl.org/Ticket/Display.html?id=124443 > > > > > > On Sat May 02 12:03:43 2015, RICHE wrote:
> > > Confirmed this issue as reproducible. > > > > > > On Thu Apr 16 09:42:44 2015, lschrieber@sparkim.com wrote:
> > > > Yes, it is Windows-specific, as I indicated in the original bug > > > > report. > > > > > > > > Len Schrieber > > > > Spark Investment Management LLC > > > > > > > > -----Original Message----- > > > > From: "James E Keenan via RT" <bug-File-Path@rt.cpan.org> > > > > To: lschrieber@sparkim.com > > > > Date: 2015-04-15 22:14 > > > > Subject: [rt.cpan.org #90452] File::Path qw(remove_tree) > > > > > > > > <URL: https://rt.cpan.org/Ticket/Display.html?id=90452 > > > > > > > > > On Sun Nov 17 11:02:21 2013, lschrieber@sparkim.com wrote:
> > > > > Using perl 5.16.3, windows 7. > > > > > > > > > > use File::Path qw(remove_tree); > > > > > > > > > > If I say: > > > > > > > > > >   remove_tree("a/...");   # (any positive number of dots) > > > > > > > > > > it removes directory a. > > > > >
> > > > > > > > This may be Windows-specific.  I could not reproduce the problem > > > > on > > > > Ubuntu Linux 14.04-LTS with perl-5.20.1 and File-Path 2.09. > > > > > > > > ##### > > > > [tmp] 28 $ mkdir -p a/alpha/beta > > > > [tmp] 29 $ perl -MFile::Path -e > > > > 'File::Path::remove_tree("a/...");' > > > > [tmp] 30 $ ls -l a > > > > total 4 > > > > drwxrwxr-x 3 jkeenan jkeenan 4096 Apr 15 22:10 alpha > > > > [tmp] 31 $ ls -l a/alpha/ > > > > total 4 > > > > drwxrwxr-x 2 jkeenan jkeenan 4096 Apr 15 22:10 beta > > > > #####
> > > > > >
> >
> > I've never had occasion to call a function on a path where a path > separator is followed by 3 dots. So I know what, say, "ls -l xyz/." > means, and I know what "ls -l xyz/.." means. But I don't know (at > least in a Unix-based world) what "ls -l xyz/..." in intended to mean? > > Can you clarify? > > Thank you very much. > Jim Keenan
Download (untitled) / with headers
text/plain 426b
As per comments, this behavior is a reflection of the underlying operating environment. Although Perl abstracts this too a degree for consistency sake, it is not in the position to emulate an operating environment. To be more clear: if this issue was reproducible in the Cygwin environment, then it would be in Cygwin's scope to solve. In such case, this filing is rejected because it is a reflection of how Windows works.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

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