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
F:S->catdir goes wrong with double slash #12021
Comments
From zefram@fysh.orgCreated by zefram@fysh.orgThe logic in File::Spec::Unix->catdir fails to take account of the $ perl -MFile::Spec -lwe '$^O="qnx"; print File::Spec->catdir("/", "foo", "bar")' The correct result would be "/foo/bar", the same as on a non-double-slash Perl Info
|
From @ikegamiOn Tue, Mar 27, 2012 at 10:25 AM, Zefram <perlbug-followup@perl.org> wrote:
A note of caution: Double leading slashes is meaningful in Windows, so |
The RT System itself - Status changed from 'new' to 'open' |
From @demerphqOn 27 March 2012 16:25, Zefram <perlbug-followup@perl.org> wrote:
Hi Zefram, I think this ticket should be closed as not-a-bug. catdir yorton@spud:~$ perl -MFile::Spec -MData::Dumper -e'my @dirs= Therefore the input is incorrect, and the output is the expected Specifically your expectation that "/" is a valid directory name is cheers, -- |
From zefram@fysh.orgdemerphq wrote:
That's a good point, but one could also argue that splitdir needs to
It's the output of canonpath for anything referring to the root directory. -zefram |
From @xdgOn Tue, Mar 27, 2012 at 12:38 PM, demerphq <demerphq@gmail.com> wrote:
The *general* behavior is not a bug (though the docs could be more However, the behavior is "qnx" specific. From File::Spec::Unix::canonpath: # Handle POSIX-style node names beginning with double slash (qnx, nto) On my linux system, I don't get double slashes: $ perl -MFile::Spec::Functions=catdir,canonpath -wE '$^O="qnx"; my $ perl -MFile::Spec::Functions=catdir,canonpath -wE 'my $d = |
From zefram@fysh.orgEric Brine wrote:
This raises a general issue with File::Spec: is the option of externally And a related question: is File::Spec intended to implement system X's I'm actually working on making File::Spec perform better, because it's -zefram |
From @demerphqOn 27 March 2012 18:54, Zefram <zefram@fysh.org> wrote:
On what OS? It wont be the output of canonpath on Windows, nor VMS. On a side note, what I remember is that *nixans tend to not use
I'm not going to argue that what you say here is not the conventional cheers, -- |
From @janduboisOn Tue, 27 Mar 2012, Zefram wrote:
I believe it once was supposed to do that. E.g. abs2rel explicitly But exceptions had to be made for VMS. And tmpdir has to inspect environment variables. But the biggest offender in my mind is case_tolerant() which has been Sorry for the rambling; but I think is shows that there is no overriding Cheers, |
From @ikegamiOn Tue, Mar 27, 2012 at 12:54 PM, Zefram <zefram@fysh.org> wrote:
It's the path to the (unix) root directory. The root directory doesn't have - Eric |
From @ikegamiOn Tue, Mar 27, 2012 at 1:06 PM, Zefram <zefram@fysh.org> wrote:
I think so. I've never seen anything forbidden it, and I've seen people |
From @xdgOn Tue, Mar 27, 2012 at 1:06 PM, Zefram <zefram@fysh.org> wrote:
It's tricky because File::Spec follows Ken William's pattern where So you can subclass, say, File::Spec::Unix and do whatever you need.
The typical pattern is to use the subclass directly.
The use of $^O in File::Spec::Unix is a design flaw, IMO. Those OSes
I'd love to see some sort of caching optimization built into -- David |
From @craigberryOn Tue, Mar 27, 2012 at 12:55 PM, Eric Brine <ikegami@adaelis.com> wrote:
File::Spec's tests run all the variants on all platforms except the The real problem with the module is that whatever design integrity it |
From @rurbanOn Tue, Mar 27, 2012 at 12:31 PM, Jan Dubois <jand@activestate.com> wrote:
Fully agree. case_tolerant is not OS but mount-pount specific, And Module::Build is only so slow because it abuses case_tolerant to |
From @wb8tywOn 3/27/2012 12:06 PM, Zefram wrote:
No good deed will go unpunished. The problem with fixing "bugs" in File::Spec is that there is a body of When working on updating Perl on VMS to handle the newer extended It has been a few years since I directly looked at that section, so from I tried to introduce a fix to one of the tests in perl, (I forget which Some of the problems seem to be from that Win32 and VMS can have VMS has things like VOL:[.DIR]FILE and vol:file, where portions of the Win32 has x:dir\bar, with a different default directory for each volume Regards, |
From @nwc10On Tue, Mar 27, 2012 at 03:26:04PM -0400, David Golden wrote:
Yes, they should. I remember them bugging me. Do we know anyone using QNX or Neutrino?
Can't one just use Memoize on it? Nicholas Clark |
From @nwc10On Tue, Mar 27, 2012 at 02:49:02PM -0500, Craig A. Berry wrote:
That change seems to predate the addition of File::Spec to the core in 1998
The reasoning would have been that Win32 and VMS don't have symlinks, so Nicholas Clark |
From @demerphqOn 28 March 2012 12:25, Nicholas Clark <nick@ccl4.org> wrote:
They have junctions tho, which are pretty close to the same as a Win32 actually has OS level equivalents for most of File::Spec which cheers -- |
From @wb8tywOn 3/28/2012 6:31 AM, demerphq wrote:
VMS has logical names, which are used quite a bit like symlinks are used Calling unixify() on VMS can remove the logical name (a bug) so that And since File::Spec::VMS originally called both of those methods Because I did not want to risk breaking existing programs that depended With VMS 8.2, VMS does have symlinks. Regards, |
From @xdgOn Wed, Mar 28, 2012 at 7:31 AM, demerphq <demerphq@gmail.com> wrote:
I suspect File::Spec's behavior was written before junctions were an That seems like bitrot in File::Spec unrelated to the bug itself, i.e. The issue at hand for perl #112054 is why the heck is there special -- David |
From @janduboisOn Wed, 28 Mar 2012, demerphq wrote:
Junctions have been added to NTFS in Windows 2000, but they aren't NTFS on Windows Vista and later implements another kind of linking Cheers, |
From zefram@fysh.orgDavid Golden wrote:
It's a scheme to allow pathnames to refer to filesystems of other Of course, the modern way is to mount a virtual filesystem *under* -zefram |
From @xdgOn Wed, Mar 28, 2012 at 4:38 PM, Zefram <zefram@fysh.org> wrote:
Ah. It's like "\\brillig\path\somewhere" on Windows. So... would splitting the qnx/nto behavior out to subclasses "resolve" this bug? -- David |
From zefram@fysh.orgDavid Golden wrote:
No. That subclass would exhibit the bug. It's the behaviour for qnx/nto -zefram |
From @nwc10On Wed, Mar 28, 2012 at 09:38:41PM +0100, Zefram wrote:
Your wording being (as usual) very carefully chosen, because of course this But this is a digression from the subject. [But not a digression from File::Spec, as it provides case_tolerant() and Nicholas Clark |
From @demerphqOn 29 March 2012 10:29, Nicholas Clark <nick@ccl4.org> wrote:
Lets be careful we dont fall into the "perfection is the enemy of good In other words, yes it might be true that a function like Yvves -- |
From @ap* demerphq <demerphq@gmail.com> [2012-03-29 10:55]:
I guess the simplest route to making the API allow for perfection is to Plus, an apparently-oxymoronic API just fits Perl’s character. :-) Regards, |
Migrated from rt.perl.org#112054 (status was 'open')
Searchable as RT112054$
The text was updated successfully, but these errors were encountered: