[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Perl can't find my libraries when run via the subversion post-commit script

From: Kris Deugau <kdeugau_at_vianet.ca>
Date: Thu, 04 Mar 2010 13:28:32 -0500

Craig Thayer wrote:
> David,
>
> Thank you for your reply.
>
> Yes, I have tested the script on the Subversion server and it runs just fine.

As root, or as the user the repo is accessed as?

/root isn't usually accessible by any user *other* than root in my
experience, and most of the documentation assumes that svnserve or
Apache (and therefore, all of your hook scripts) are running as one of:
-> dedicated svn user
-> Apache runtime user
-> various non-root users if using svn+ssh with system users

> And I agree it is obvious that Perl is including the directories to my libraries (so the use lib statements are working as designed as you stated). However, it is Perl that is complaining that it can't find my libraries even though they are clearly in the @INC path. I have never run into this situation before and I believe it has to do with the fact that the Subversion hook is running with no environment defined, but why it makes Perl not able to find my libs ONLY when it runs as a Subversion hook I haven't a clue.

I tried a quick test creating an empty module in /root:

===
package Testme;

our $foobar = "foo!";
===

then ran

perl -e 'use lib "/root"; use Testme;'

as root and as non-root.

Running as root succeeded, non-root failed with "Can't locate Testme.pm
in @INC...".

I suspect you'd still have the issue even if you hardcoded the absolute
path; Perl can't find the module because it can't read the directory
it's in.

> I have temporarily resolved the problem by moving my libraries to the /usr/lib/perl5/site_perl path (which I didn't want to do) which is predefined by my Perl installation in @INC. The script now runs via the Subversion hook and finds my libraries just fine. I would, however, like to understand what causes Perl to not recognize my added paths to @INC when it runs as a Subversion hook.

perl -V should show you the standard include paths; custom local
modules intended for general use should usually go somewhere under
/usr/local/lib, and I've usually seen custom modules for specific uses
get bundled into /usr/share/<app> or /usr/lib/<app>, along with a
matching "use lib" in the executables.

-kgd
Received on 2010-03-04 19:29:09 CET

This is an archived mail posted to the Subversion Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.