Skip Menu |

This queue is for tickets about the Data-Session CPAN distribution.

Report information
The Basics
Id: 111844
Status: resolved
Priority: 0/
Queue: Data-Session

People
Owner: Nobody in particular
Requestors: SREZIC [...] cpan.org
Cc:
AdminCc:

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



Subject: get_my_drivers fails in strange directories
If a parent directory of Data/Session.pm has a component containing ".pm", then a call to get_my_drivers() fails. This can easily be reproduced by creating a directory like "/tmp/builddir.pm", configure CPAN.pm to use this directory for building, e.g.: 'build_dir' => q[/tmp/builddir.pm] and try to test Data::Session within CPAN.pm Maybe something like this happened here: http://www.cpantesters.org/cpan/report/271947e6-77dd-11e5-ae6c-7ce06f53cd79 http://www.cpantesters.org/cpan/report/902e0450-beec-11e5-91ab-40d00259f3db I was able to create such a fail report which should appear in a few hours at CPAN Testers. Regards, Slaven
On 2016-02-07 02:46:02, SREZIC wrote: Show quoted text
> If a parent directory of Data/Session.pm has a component containing > ".pm", then a call to get_my_drivers() fails. This can easily be > reproduced by creating a directory like "/tmp/builddir.pm", configure > CPAN.pm to use this directory for building, e.g.: > > 'build_dir' => q[/tmp/builddir.pm] > > and try to test Data::Session within CPAN.pm > > Maybe something like this happened here: > http://www.cpantesters.org/cpan/report/271947e6-77dd-11e5-ae6c- > 7ce06f53cd79 > http://www.cpantesters.org/cpan/report/902e0450-beec-11e5-91ab- > 40d00259f3db > > I was able to create such a fail report which should appear in a few > hours at CPAN Testers. > > Regards, > Slaven
Problem is this code snippet: my($path) = File::Spec -> catdir($INC{'Data/Session.pm'}, 'Driver'); $path =~ s/.pm//; Probably it's better to write this as (untested): my($path) = $INC{'Data/Session.pm'}; $path =~ s/\.pm$//; $path = File::Spec -> catdir($path, 'Driver');
Subject: Re: [rt.cpan.org #111844] get_my_drivers fails in strange directories
Date: Mon, 8 Feb 2016 08:43:29 +1100
To: bug-Data-Session [...] rt.cpan.org
From: Ron Savage <ron [...] savage.net.au>
Hi Slaven Thank you for the report and diagnosis. I confess the thought of a dir name ending in '.pm' had never occurred to me. And yes, the use of '$' in the regexp is what I should have used in the first place. And the lack of escaping on the '.' suggests carelessness too :-(. On 07/02/16 19:03, Slaven_Rezic via RT wrote: Show quoted text
> Queue: Data-Session > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=111844 > > > On 2016-02-07 02:46:02, SREZIC wrote:
>> If a parent directory of Data/Session.pm has a component containing >> ".pm", then a call to get_my_drivers() fails. This can easily be >> reproduced by creating a directory like "/tmp/builddir.pm", configure >> CPAN.pm to use this directory for building, e.g.: >> >> 'build_dir' => q[/tmp/builddir.pm] >> >> and try to test Data::Session within CPAN.pm >> >> Maybe something like this happened here: >> http://www.cpantesters.org/cpan/report/271947e6-77dd-11e5-ae6c- >> 7ce06f53cd79 >> http://www.cpantesters.org/cpan/report/902e0450-beec-11e5-91ab- >> 40d00259f3db >> >> I was able to create such a fail report which should appear in a few >> hours at CPAN Testers. >> >> Regards, >> Slaven
> > Problem is this code snippet: > > my($path) = File::Spec -> catdir($INC{'Data/Session.pm'}, 'Driver'); > $path =~ s/.pm//; > > Probably it's better to write this as (untested): > > my($path) = $INC{'Data/Session.pm'}; > $path =~ s/\.pm$//; > $path = File::Spec -> catdir($path, 'Driver'); >
-- Ron Savage - savage.net.au
Subject: Re: [rt.cpan.org #111844] get_my_drivers fails in strange directories
Date: Mon, 8 Feb 2016 09:33:38 +1100
To: bug-Data-Session [...] rt.cpan.org
From: Ron Savage <ron [...] savage.net.au>
Hi Slaven Agggghhh. No! The original code was correct. Tests fail with your patch. But after undoing it, tests fall with a 'mv' error. I have to start $work now, it's 9:30am. -- Ron Savage - savage.net.au
RT-Send-CC: ron [...] savage.net.au
On 2016-02-07 16:43:45, ron@savage.net.au wrote: Show quoted text
> Hi Slaven > > Thank you for the report and diagnosis. I confess the thought of a dir > name ending in '.pm' had never occurred to me.
It doesn't have to be exactly ".pm" at the end. CPAN.pm adds a random part to the extracted distribution directory, and having something Data-Session-1.16-olpmVQ may already trigger the problem. Show quoted text
> And yes, the use of '$' > in the regexp is what I should have used in the first place. And the > lack of escaping on the '.' suggests carelessness too :-(. > > On 07/02/16 19:03, Slaven_Rezic via RT wrote:
> > Queue: Data-Session > > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=111844 > > > > > On 2016-02-07 02:46:02, SREZIC wrote:
> >> If a parent directory of Data/Session.pm has a component containing > >> ".pm", then a call to get_my_drivers() fails. This can easily be > >> reproduced by creating a directory like "/tmp/builddir.pm", > >> configure > >> CPAN.pm to use this directory for building, e.g.: > >> > >> 'build_dir' => q[/tmp/builddir.pm] > >> > >> and try to test Data::Session within CPAN.pm > >> > >> Maybe something like this happened here: > >> http://www.cpantesters.org/cpan/report/271947e6-77dd-11e5-ae6c- > >> 7ce06f53cd79 > >> http://www.cpantesters.org/cpan/report/902e0450-beec-11e5-91ab- > >> 40d00259f3db > >> > >> I was able to create such a fail report which should appear in a few > >> hours at CPAN Testers. > >> > >> Regards, > >> Slaven
> > > > Problem is this code snippet: > > > > my($path) = File::Spec -> catdir($INC{'Data/Session.pm'}, 'Driver'); > > $path =~ s/.pm//; > > > > Probably it's better to write this as (untested): > > > > my($path) = $INC{'Data/Session.pm'}; > > $path =~ s/\.pm$//; > > $path = File::Spec -> catdir($path, 'Driver'); > >
RT-Send-CC: ron [...] savage.net.au
On 2016-02-07 17:33:53, ron@savage.net.au wrote: Show quoted text
> Hi Slaven > > Agggghhh. No! The original code was correct. Tests fail with your patch. > But after undoing it, tests fall with a 'mv' error. I have to start > $work now, it's 9:30am. >
Probably you missed the last line in my proposal or so. Please see the attached patch. Tests pass on my system, even with a problematic build dir.
Subject: 0001-fix-for-RT-111844.patch
From ed8405e62399a4eed9e938271061213aa86b3224 Mon Sep 17 00:00:00 2001 From: Slaven Rezic <slaven@rezic.de> Date: Tue, 9 Feb 2016 06:27:51 +0000 Subject: [PATCH] fix for RT #111844 --- lib/Data/Session.pm | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/lib/Data/Session.pm b/lib/Data/Session.pm index 596d0ae..a934af6 100644 --- a/lib/Data/Session.pm +++ b/lib/Data/Session.pm @@ -280,8 +280,7 @@ sub flush sub get_my_drivers { my($self) = @_; - my($path) = File::Spec -> catdir($INC{'Data/Session.pm'}, 'Driver'); - $path =~ s/.pm//; + my $path = _get_pm_path('Driver'); # Warning: Use sort map{} read_dir, not map{} sort read_dir. But, why? @@ -300,8 +299,7 @@ sub get_my_drivers sub get_my_id_generators { my($self) = @_; - my($path) = File::Spec -> catdir($INC{'Data/Session.pm'}, 'ID'); - $path =~ s/.pm//; + my $path = _get_pm_path('ID'); # Warning: Use sort map{} read_dir, not map{} sort read_dir. But, why? @@ -320,8 +318,7 @@ sub get_my_id_generators sub get_my_serializers { my($self) = @_; - my($path) = File::Spec -> catdir($INC{'Data/Session.pm'}, 'Serialize'); - $path =~ s/.pm//; + my $path = _get_pm_path('Serialize'); # Warning: Use sort map{} read_dir, not map{} sort read_dir. But, why? @@ -906,6 +903,15 @@ sub validate_time # ----------------------------------------------- +sub _get_pm_path { + my $subdir = shift; + my($path) = $INC{'Data/Session.pm'}; + $path =~ s/\.pm$//; + return File::Spec -> catdir($path, $subdir); +} + +# ----------------------------------------------- + 1; =pod -- 1.7.10.4
Subject: Re: [rt.cpan.org #111844] get_my_drivers fails in strange directories
Date: Wed, 10 Feb 2016 09:21:27 +1100
To: bug-Data-Session [...] rt.cpan.org
From: Ron Savage <ron [...] savage.net.au>
Hi Slaven With that patch I finally begin to see your point. Thanx for persisting. On 09/02/16 17:33, Slaven_Rezic via RT wrote: Show quoted text
> Queue: Data-Session > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=111844 > > > On 2016-02-07 17:33:53, ron@savage.net.au wrote:
>> Hi Slaven >> >> Agggghhh. No! The original code was correct. Tests fail with your patch. >> But after undoing it, tests fall with a 'mv' error. I have to start >> $work now, it's 9:30am. >>
> > Probably you missed the last line in my proposal or so. Please see the attached patch. Tests pass on my system, even with a problematic build dir. >
-- Ron Savage - savage.net.au
Subject: Re: [rt.cpan.org #111844] get_my_drivers fails in strange directories
Date: Sun, 14 Feb 2016 09:57:36 +1100
To: bug-Data-Session [...] rt.cpan.org
From: Ron Savage <ron [...] savage.net.au>
Hi Slaven I've released Data::Session V 1.17 and it's on CPAN, with your patch of course. Thanx! -- Ron Savage - savage.net.au