New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
File::Spec treatment of "..." and "no_upwards" #14468
Comments
From @xdgWhile investigating a Mojolicious security issue ( (1) File::Spec::Win32::canonpath changes "..." to "..\.." This is apparently a legacy DOS (COMMAND.COM) convention that is no longer I propose removing that "..." translation behavior and that we backport (2) File::Spec's "no_upwards" method is either buggy or poorly documented. Given a list of file names, strip out those that refer to a parent In fact, it *only* removes "." and ".." and will happily leave It appears intended to be used like this: @dirs = File::Spec->no_upwards( readdir $dirhandle ); I propose changing the documentation to clarify that only "." and ".." are Regards, -- |
From @iabynOn Tue, Feb 03, 2015 at 08:11:52AM -0800, David Golden wrote:
Hmmm, this ticket appears to have been studiously ignored for 2 years! I personally don't feel qualified to pontificate on win323 issues, but Can you supply the wording? -- |
The RT System itself - Status changed from 'new' to 'open' |
From @xdgSee here: https://gist.github.com/xdg/0d4840a388db440ea232638fafbd66e9 On Sat, Feb 4, 2017 at 11:20 AM, Dave Mitchell via RT <
-- |
From @iabynOn Thu, Feb 23, 2017 at 02:19:33PM -0500, David Golden wrote:
That looks good to me. I see no reason for you not to apply that to blead Having re-read the ticket more closely, I see that part (1) about '...'
-- |
From @iabynOn Mon, Feb 27, 2017 at 12:59:41PM +0000, Dave Mitchell wrote:
For the record, that's been added as v5.25.10-45-gdaa6050 -- |
From @tonycozOn Mon, 27 Feb 2017 05:00:15 -0800, davem wrote:
Maybe the attached. It doesn't try to preserve the ... behaviour for NetWare and Symbian. Tony |
From @tonycoz0001-perl-123724-don-t-translate-.-to-.-.-on-Win32.patchFrom 5729b13ebe0634f0c9954e4ecb30cf0ec6511597 Mon Sep 17 00:00:00 2001
From: Tony Cook <tony@develop-help.com>
Date: Thu, 1 Nov 2018 13:43:17 +1100
Subject: (perl #123724) don't translate ... to ..\.. on Win32
Apparently this was a command.com thing that Win32 doesn't support.
---
dist/PathTools/lib/File/Spec/Win32.pm | 10 ----------
dist/PathTools/t/Spec.t | 4 ++--
2 files changed, 2 insertions(+), 12 deletions(-)
diff --git a/dist/PathTools/lib/File/Spec/Win32.pm b/dist/PathTools/lib/File/Spec/Win32.pm
index 43f96b892f..b87e529dd1 100644
--- a/dist/PathTools/lib/File/Spec/Win32.pm
+++ b/dist/PathTools/lib/File/Spec/Win32.pm
@@ -407,16 +407,6 @@ sub _canon_cat # @path -> path
)+ # performance boost -- I do not know why
}{\\}gx;
- # XXX I do not know whether more dots are supported by the OS supporting
- # this ... annotation (NetWare or symbian but not MSWin32).
- # Then .... could easily become ../../.. etc:
- # Replace \.\.\. by (\.\.\.+) and substitute with
- # { $1 . ".." . "\\.." x (length($2)-2) }gex
- # ... --> ../..
- $path =~ s{ (\A|\\) # at begin or after a slash
- \.\.\.
- (?=\\|\z) # at end or followed by slash
- }{$1..\\..}gx;
# xx\yy\..\zz --> xx\zz
while ( $path =~ s{(?:
(?:\A|\\) # at begin or after a slash
diff --git a/dist/PathTools/t/Spec.t b/dist/PathTools/t/Spec.t
index 76ade747c7..5f6719067a 100644
--- a/dist/PathTools/t/Spec.t
+++ b/dist/PathTools/t/Spec.t
@@ -277,9 +277,9 @@ my @tests = (
[ "Win32->canonpath('//a/b/../../c')", '\\\\a\\b\\c' ],
[ "Win32->canonpath('//a/b/c/../d')", '\\\\a\\b\\d' ],
[ "Win32->canonpath('//a/b/c/../../d')",'\\\\a\\b\\d' ],
-[ "Win32->canonpath('//a/b/c/.../d')", '\\\\a\\b\\d' ],
+[ "Win32->canonpath('//a/b/c/.../d')", '\\\\a\\b\\c\\...\\d' ],
[ "Win32->canonpath('/a/b/c/../../d')", '\\a\\d' ],
-[ "Win32->canonpath('/a/b/c/.../d')", '\\a\\d' ],
+[ "Win32->canonpath('/a/b/c/.../d')", '\\a\\b\\c\\...\\d' ],
[ "Win32->canonpath('\\../temp\\')", '\\temp' ],
[ "Win32->canonpath('\\../')", '\\' ],
[ "Win32->canonpath('\\..\\')", '\\' ],
--
2.14.1.windows.1
|
From @tonycozOn Wed, 31 Oct 2018 20:12:06 -0700, tonyc wrote:
Applied as 97fc2df. Tony |
@tonycoz - Status changed from 'open' to 'pending release' |
From @khwilliamsonThank you for filing this report. You have helped make Perl better. With the release today of Perl 5.30.0, this and 160 other issues have been Perl 5.30.0 may be downloaded via: If you find that the problem persists, feel free to reopen this ticket. |
@khwilliamson - Status changed from 'pending release' to 'resolved' |
Migrated from rt.perl.org#123724 (status was 'resolved')
Searchable as RT123724$
The text was updated successfully, but these errors were encountered: