[EMAIL PROTECTED] wrote:
On Tue, 26 Aug 2003 09:07:21 -0700, Stas Bekman wrote:

[snip]

As you posted in the followup, this is a problem with
all Apache:: modules. The problem originates within Apache, not us.


FWIW, the cvs version of Apache::Test warns you early
whether this is going to work or not, rather than just failing during 'make
test'.


Ideas how to solve this are *very* welcome.


[snip]


Stas,

One thing we're working on implementing in Apache::PAR
to solve this kind of problem is to use File::Spec's
tmpdir to get the platform specific temp directory. This function appears to be available in File::Spec at
least as of Perl 5.6.0 as part of the distribution.


This could be used (maybe overridable via a env
variable, etc) to determine a temporary directory to
copy the t/ directory to in cases where permissions
would deny reading from the working directory or a
parent directory.  Of course, it would still have to
fail in cases where a temp directory isn't available
(either File::Spec doesn't support the platform or a
new enough version of File::Spec isn't available on an
old version of Perl) and the env variable isn't set,
but should handle almost all common cases.

Once the content is copied, Apache::Test would then use
that directory to serve test files, scripts, etc out
of.  This temporary directory could then also be
cleaned up when the Apache server is shutdown.

Of course, I haven't looked at the code for
Apache::Test enough to know whether this would be
easily implemented, but just thought I would throw out
the idea.

Thanks Nathan,


We have discussed this idea at the dev list, and will probably resort to it if no better solution is found. I didn't mention it on purpose in hope to get some new, better ideas.

The problem with copy and cleanup to a temp dir is that some project may have a pretty big t/ directory (mp2's one is almost 2MB and growing), so copying is going to be quite slow. Another problem is the cleanup, which may not always work very well.

Moreover, let's say that you run under 'root'. Most likely File::Temp/File::Spec::tmpdir will return /root/tmp as the temp dir, so it solves nothing. What we really want is an equivalent of /tmp.

What we could do is prompt root for two inputs: a username of a real user (e.g. 'stas' on my machine) and a dir where 'stas' can write to (e.g. /home/stas/tmp) and then copy the files there and use that username to run the test with.

In my original reply the best advise so far to avoid this problem is to configure your .cpan dir to be under /tmp in which case running tests as root is not a problem. However /tmp is often setup to be cleaned up on reboot, so you may want to configure only 'build_dir' to be on that filesystem, e.g.:

#~/.cpan/CPAN/MyConfig.pm
#------------------------
$CPAN::Config = {
 'cpan_home' => q[/root/.cpan],
 'build_dir' => q[/tmp/.cpan/build],
  ...
};

__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com



--
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html



Reply via email to