Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the SVN-Notify CPAN distribution.

Report information
The Basics
Id: 17680
Status: resolved
Priority: 0/
Queue: SVN-Notify

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

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



Subject: 0.031 seems to have a hardcoded path to svn and svnlook
Thanks much for fixing 17649! I've downloaded 0.031, Build runs fine, nearly all tests fail. On a quick inspection, the error messages all look a bit like this: Can't exec "/usr/local/bin/svnlook": No such file or directory at /usr/local/share/perl/5.8.7/SVN/Notify.pm line 1526. Cannot exec /usr/local/bin/svnlook: No such file or directory Use of uninitialized value in substitution (s///) at /usr/local/share/perl/5.8.7/SVN/Notify.pm line 764. Use of uninitialized value in substitution (s///) at /usr/local/share/perl/5.8.7/SVN/Notify.pm line 765. Child process exited: 512 My svn and svnlook are in /usr/bin/
In an email from John Peacock I got the explanation which I want to disclose to interested parties: Show quoted text
> This is hardcoded in SVN::Notify here:
Show quoted text
> # Set up default values. > $params{svnlook} ||= $ENV{SVNLOOK} || '/usr/local/bin/svnlook';
I think I would call it a bug if the PATH environment is not honoured when trying to execute an external command. When I come to think if it, I'm also surprised that SVN::Notify passed its test suite. Is the test suite too forgiving or too intelligent?
RT-Send-CC: John Peacock <jpeacock [...] rowman.com>
On Fri Feb 17 04:42:19 2006, ANDK wrote: Show quoted text
> > $params{svnlook} ||= $ENV{SVNLOOK} || '/usr/local/bin/svnlook';
From this snippet I got the impression that I can run SVN::Notify::Mirror's test suite with SVNLOOK=svnlook SVN=svn ./Build test This is not the case. So I start to believe that somebody under the hooks might set $params{svnlook}. Besides I do not understand why the usual incantation to run single test scripts does not find SVN::Notify::Mirror as in this try: ~/.cpan/build/SVN-Notify-Mirror-0.031% perl -Mblib t/001_basic.t |& head ok 1 - Directories are consistent at rev: 1 Can't locate SVN/Notify/Mirror.pm in @INC (@INC contains: /etc/perl /usr/local/lib/perl/5.8.7 /usr/local/share/perl/5.8.7 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.8 /usr/share/perl/5.8 /usr/local/lib/site_perl /usr/local/lib/perl/5.8.4 /usr/local/share/perl/5.8.4 .) at (eval 1) line 3. not ok 2 - Directories are consistent at rev: 2
Subject: Re: [rt.cpan.org #17680] SVN::Notify seems to have a hardcoded path to svn and svnlook
Date: Fri, 17 Feb 2006 06:09:56 -0500
To: bug-SVN-Notify [...] rt.cpan.org
From: John Peacock <jpeacock [...] rowman.com>
Andreas Koenig via RT wrote: Show quoted text
> On Fri Feb 17 04:42:19 2006, ANDK wrote: >
>>> $params{svnlook} ||= $ENV{SVNLOOK} || '/usr/local/bin/svnlook';
> > From this snippet I got the impression that I can run > SVN::Notify::Mirror's test suite with > > > SVNLOOK=svnlook SVN=svn ./Build test > > This is not the case. So I start to believe that somebody under the > hooks might set $params{svnlook}.
WFM: $ sudo mv /usr/local/bin/svnlook /usr/local/bin/svnlook.bad $ SVNLOOK=svnlook.bad ./Build test t/001_basic........ok t/002_config.......ok t/003_sshtest......ok t/004_rsynctest....ok All tests successful. Files=4, Tests=117, 54 wallclock secs ( 8.13 cusr + 1.68 csys = 9.81 CPU) Oh, I see. SVNLOOK is an overrideable option in SVN::Notify, but SVN is not. That I can fix; give me a moment... Show quoted text
> > Besides I do not understand why the usual incantation to run single test > scripts does not find SVN::Notify::Mirror as in this try: > > ~/.cpan/build/SVN-Notify-Mirror-0.031% perl -Mblib t/001_basic.t |& head > ok 1 - Directories are consistent at rev: 1 > Can't locate SVN/Notify/Mirror.pm in @INC (@INC contains: /etc/perl > /usr/local/lib/perl/5.8.7 /usr/local/share/perl/5.8.7 /usr/lib/perl5 > /usr/share/perl5 /usr/lib/perl/5.8 /usr/share/perl/5.8 > /usr/local/lib/site_perl /usr/local/lib/perl/5.8.4 > /usr/local/share/perl/5.8.4 .) at (eval 1) line 3. > not ok 2 - Directories are consistent at rev: 2 >
WFM $ perl -Mblib t/001_basic.t ok 1 - Directories are consistent at rev: 1 ok 2 - Updated project1/trunk to correct revision: 2 ok 3 - Correct files updated in project1/trunk at rev: 2 ok 4 - Directories are consistent at rev: 2 ok 5 - No changes in project1/tags/TRUNK-1135534439 at revision: 3 ... FWIW, running single tests with Module::Build is usually done $ ./Build test --test_files t/001_basic.t but the other way should work too... :( John -- John Peacock Director of Information Research and Technology Rowman & Littlefield Publishing Group 4720 Boston Way Lanham, MD 20706 301-459-3366 x.5010 fax 301-429-5747
Subject: Re: [rt.cpan.org #17680] SVN::Notify seems to have a hardcoded path to svn and svnlook
Date: Fri, 17 Feb 2006 10:14:37 -0800
To: bug-SVN-Notify [...] rt.cpan.org
From: David Wheeler <dwheeler [...] cpan.org>
On Feb 17, 2006, at 01:42, Andreas Koenig via RT wrote: Show quoted text
>> This is hardcoded in SVN::Notify here:
>
>> # Set up default values. >> $params{svnlook} ||= $ENV{SVNLOOK} || '/usr/local/bin/ >> svnlook';
> > I think I would call it a bug if the PATH environment is not honoured > when trying to execute an external command.
Well, I made it default to /usr/local/bin/svnlook because, when SVN::Notify is run from Apache (as is common with subversion), it could not find anything in the path, because there is no PATH environment variable there. I don't know about when it's running outside of Apache, though. Show quoted text
> When I come to think if it, I'm also surprised that SVN::Notify passed > its test suite. Is the test suite too forgiving or too intelligent?
I guess it's too intelligent. The tests all point to t/bin/ testsvnlook, which is a Perl script that mimics svnlook. Same with sendmail. On Feb 17, 2006, at 03:10, John Peacock via RT wrote: Show quoted text
> Oh, I see. SVNLOOK is an overrideable option in SVN::Notify, but > SVN is not. > That I can fix; give me a moment...
Yes, SVN::Notify doesn't use svn, just svnlook. Show quoted text
> WFM > $ perl -Mblib t/001_basic.t > ok 1 - Directories are consistent at rev: 1 > ok 2 - Updated project1/trunk to correct revision: 2 > ok 3 - Correct files updated in project1/trunk at rev: 2 > ok 4 - Directories are consistent at rev: 2 > ok 5 - No changes in project1/tags/TRUNK-1135534439 at revision: 3 > ... > > FWIW, running single tests with Module::Build is usually done > > $ ./Build test --test_files t/001_basic.t > > but the other way should work too... :(
As should prove t/001_basic.t. Anyway, what is the upshot here with regard to SVN::Notify? Should I just make it default to 'svnlook' instead of '/usr/local/bin/ svnlook'? That may well break installations for folks who rely on the default path, but it'll only take a second for them to fix it. Opinions welcome. Best, David
CC: ANDK [...] cpan.org
Subject: Re: [rt.cpan.org #17680] SVN::Notify seems to have a hardcoded path to svn and svnlook
Date: Sat, 18 Feb 2006 08:51:33 +0100
To: bug-SVN-Notify [...] rt.cpan.org
From: andreas.koenig.gmwojprw [...] franz.ak.mind.de (Andreas J. Koenig)
Show quoted text
>>>>> On Fri, 17 Feb 2006 13:15:37 -0500 (EST), "David Wheeler via RT" <bug-SVN-Notify@rt.cpan.org> said:
Show quoted text
> On Feb 17, 2006, at 01:42, Andreas Koenig via RT wrote:
>>> This is hardcoded in SVN::Notify here:
>>
>>> # Set up default values. >>> $params{svnlook} ||= $ENV{SVNLOOK} || '/usr/local/bin/ >>> svnlook';
>> >> I think I would call it a bug if the PATH environment is not honoured >> when trying to execute an external command.
Show quoted text
> Well, I made it default to /usr/local/bin/svnlook because, when > SVN::Notify is run from Apache (as is common with subversion), it > could not find anything in the path, because there is no PATH > environment variable there. I don't know about when it's running > outside of Apache, though.
I read your explanation later in the docs somewhere. I'm sorry that I did not find it earlier. Show quoted text
>> When I come to think if it, I'm also surprised that SVN::Notify passed >> its test suite. Is the test suite too forgiving or too intelligent?
Show quoted text
> I guess it's too intelligent. The tests all point to t/bin/ > testsvnlook, which is a Perl script that mimics svnlook. Same with > sendmail.
Ok, for sendmail this makes a lot of sense, not sure for svnlook. If people have no svnlook, your tests should probably fail. Show quoted text
> On Feb 17, 2006, at 03:10, John Peacock via RT wrote:
Show quoted text
>> Oh, I see. SVNLOOK is an overrideable option in SVN::Notify, but >> SVN is not. >> That I can fix; give me a moment...
Show quoted text
> Yes, SVN::Notify doesn't use svn, just svnlook.
Show quoted text
>> WFM >> $ perl -Mblib t/001_basic.t >> ok 1 - Directories are consistent at rev: 1 >> ok 2 - Updated project1/trunk to correct revision: 2 >> ok 3 - Correct files updated in project1/trunk at rev: 2 >> ok 4 - Directories are consistent at rev: 2 >> ok 5 - No changes in project1/tags/TRUNK-1135534439 at revision: 3 >> ... >> >> FWIW, running single tests with Module::Build is usually done >> >> $ ./Build test --test_files t/001_basic.t >> >> but the other way should work too... :(
Show quoted text
> As should prove t/001_basic.t.
John sent me a prerelease of the next version and with that I had neither this or the other problem, so from my point of view all bugs appear fixed. Show quoted text
> Anyway, what is the upshot here with regard to SVN::Notify? Should I > just make it default to 'svnlook' instead of '/usr/local/bin/ > svnlook'? That may well break installations for folks who rely on the > default path, but it'll only take a second for them to fix it.
Show quoted text
> Opinions welcome.
CPAN::FirstTime has a find_exe routine: sub find_exe { my($exe,$path) = @_; my($dir); #warn "in find_exe exe[$exe] path[@$path]"; for $dir (@$path) { my $abs = File::Spec->catfile($dir,$exe); if (($abs = MM->maybe_command($abs))) { return $abs; } } } which is typically used like my(@path) = split /$Config{'path_sep'}/, $ENV{'PATH'}; $exe = find_exe("svnlook",\@path); I think something like that should work quite well and you could even append "usr/local/bin" to he path or help the user to do so. I do not know of a module that contains this functionality. -- andreas
Subject: Re: [rt.cpan.org #17680] SVN::Notify seems to have a hardcoded path to svn and svnlook
Date: Sat, 18 Feb 2006 09:20:43 -0800
To: bug-SVN-Notify [...] rt.cpan.org
From: David Wheeler <david [...] kineticode.com>
On Feb 17, 2006, at 23:52, andreas.koenig.gmwojprw@franz.ak.mind.de via RT wrote: Show quoted text
> I read your explanation later in the docs somewhere. I'm sorry that I > did not find it earlier.
Ah, good, it is there. No problem. Show quoted text
> Ok, for sendmail this makes a lot of sense, not sure for svnlook. If > people have no svnlook, your tests should probably fail.
Or skip. But I thought it best not to skip and to get more control over the location of the script, which is why I wrote it to include in the distribution. Show quoted text
>> As should prove t/001_basic.t.
> > John sent me a prerelease of the next version and with that I had > neither this or the other problem, so from my point of view all bugs > appear fixed.
Ah, great. Show quoted text
> I think something like that should work quite well and you could even > append "usr/local/bin" to he path or help the user to do so. I do not > know of a module that contains this functionality.
Yes, activitymail does something similar, and I wrote a similar function for App::Info. But I avoided that in svnnotify adding the -- svnlook option, so that users could always just point to svnlook. That's the other reason that I wrote the script for testing. But I guess that I could add something like it again to SVN::Notify. It likely doesn't have much overhead--at least, not as much as system calls to svnlook likely do. That said, someday I want to convert all this stuff to use the svn Perl swig modules instead of svnlook, and then the problem will go away. Thanks, David
Subject: Re: [rt.cpan.org #17680] SVN::Notify seems to have a hardcoded path to svn and svnlook
Date: Sun, 19 Feb 2006 10:53:05 -0800
To: bug-SVN-Notify [...] rt.cpan.org
From: David Wheeler <david [...] kineticode.com>
On Feb 18, 2006, at 09:21, David Wheeler via RT wrote: Show quoted text
> But I guess that I could add something like it again to SVN::Notify. > It likely doesn't have much overhead--at least, not as much as system > calls to svnlook likely do.
Okay, I've done it. The new function is: sub _find_exe { my $exe = shift; require File::Spec; for my $path (File::Spec->path, '/usr/local/bin', '/usr/sbin') { $path = File::Spec->catfile($path, $exe); return $path if -x $path && -f _; } return; } and it's called like this: $params{svnlook} ||= $ENV{SVNLOOK} || _find_exe('svnlook'); $params{sendmail} ||= $ENV{SENDMAIL} || _find_exe('sendmail'); Best, David