Dobrica Pavlinusic via RT wrote:
Show quoted text> <URL:
http://rt.cpan.org/Ticket/Display.html?id=16774 >
>
> On Wed Jan 25 06:38:30 2006, dpavlin@rot13.org wrote:
>> I think that File::Copy is to blame:
>
> Quick chat to PerlMonks chatterbox proved me wrong. It seems that
> File::Copy should be only blamed for not returning error, while
> directory handling is just not task for it :-)
OK, that makes sense.
The problem is that svnweb-install doesn't use File::Copy to copy
directories -- it creates the directory itself.
Here's the relevant code from svnweb-install:
find({ wanted => sub {
my $dst_path = $File::Find::name;
$dst_path =~ s/$path/$to/;
if(-d $File::Find::name) {
mkdir $dst_path;
} else {
copy($File::Find::name, $dst_path);
}
}, no_chdir => 1 }, $path);
As you can see, if $dst_path is a directory then mkdir() is used, otherwise
File::Copy::copy() is used to copy the file.
I've just released SVN::Web 0.43 to CPAN. Could you try that, and please
verify that you're using the svnweb-install that ships with 0.43.
If that doesn't work, please try the attached svnweb-install. It's almost
identical to the one that ships with 0.43, it just emits some extra
debugging information. Please run that version, and send me a copy of the
output.
I've attached a copy of the output I get when I run it. Each block of
output that starts:
Found: /path/to/file
indicates a file or directory that's been found in the svnweb distribution.
As you can see from my run, directories are found first, created, and then
all files in that directory are copied. I suspect it's not happening in
that order on your installation for some reason.
The output also includes the versions of Perl, File::Copy, and File::Find
that work on my system. If you're using an earlier version of these
(especially if it's an earlier version of File::Find) can you try upgrading
to at least the same version that I'm running, and see if that fixes the
problem.
And there's one more thing to try. If the attached svnweb-install doesn't
work, could you edit it. Find the line that looks like this:
}, no_chdir => 1 }, $path);
(line #62) and change it to:
}, no_chdir => 1, bydepth => 0 }, $path);
Then re-run svnweb-install.
That shouldn't make any difference. But if it does then I think it's a bug
(or an incompatability between different versions) in File::Find.
Thanks for your help in tracking this down.
N
svnweb-install
Using SVN::Web 0.43
Using Perl 5.8.7
Using File::Copy 2.08
Using File::Find 1.09
Loaded SVN::Web from /usr/home/nik/svk/local/jc/CPAN/SVN-Web/trunk/s/../blib/lib/SVN/Web.pm
Installing I18N -> po
Base path is now /usr/home/nik/svk/local/jc/CPAN/SVN-Web/trunk/s/../blib/lib/SVN/Web/I18N
Found: /usr/home/nik/svk/local/jc/CPAN/SVN-Web/trunk/s/../blib/lib/SVN/Web/I18N
dst_path is now: po
Directory, making it
Found: /usr/home/nik/svk/local/jc/CPAN/SVN-Web/trunk/s/../blib/lib/SVN/Web/I18N/en.po
dst_path is now: po/en.po
File, copying to po/en.po
Found: /usr/home/nik/svk/local/jc/CPAN/SVN-Web/trunk/s/../blib/lib/SVN/Web/I18N/fr.po
dst_path is now: po/fr.po
File, copying to po/fr.po
Found: /usr/home/nik/svk/local/jc/CPAN/SVN-Web/trunk/s/../blib/lib/SVN/Web/I18N/zh_cn.po
dst_path is now: po/zh_cn.po
File, copying to po/zh_cn.po
Found: /usr/home/nik/svk/local/jc/CPAN/SVN-Web/trunk/s/../blib/lib/SVN/Web/I18N/zh_tw.po
dst_path is now: po/zh_tw.po
File, copying to po/zh_tw.po
Installing Style -> css
Base path is now /usr/home/nik/svk/local/jc/CPAN/SVN-Web/trunk/s/../blib/lib/SVN/Web/Style
Found: /usr/home/nik/svk/local/jc/CPAN/SVN-Web/trunk/s/../blib/lib/SVN/Web/Style
dst_path is now: css
Directory, making it
Found: /usr/home/nik/svk/local/jc/CPAN/SVN-Web/trunk/s/../blib/lib/SVN/Web/Style/common.css
dst_path is now: css/common.css
File, copying to css/common.css
Found: /usr/home/nik/svk/local/jc/CPAN/SVN-Web/trunk/s/../blib/lib/SVN/Web/Style/styles-hlb.css
dst_path is now: css/styles-hlb.css
File, copying to css/styles-hlb.css
Found: /usr/home/nik/svk/local/jc/CPAN/SVN-Web/trunk/s/../blib/lib/SVN/Web/Style/trac
dst_path is now: css/trac
Directory, making it
Found: /usr/home/nik/svk/local/jc/CPAN/SVN-Web/trunk/s/../blib/lib/SVN/Web/Style/trac/browser.css
dst_path is now: css/trac/browser.css
File, copying to css/trac/browser.css
Found: /usr/home/nik/svk/local/jc/CPAN/SVN-Web/trunk/s/../blib/lib/SVN/Web/Style/trac/changeset.css
dst_path is now: css/trac/changeset.css
File, copying to css/trac/changeset.css
Found: /usr/home/nik/svk/local/jc/CPAN/SVN-Web/trunk/s/../blib/lib/SVN/Web/Style/trac/code.css
dst_path is now: css/trac/code.css
File, copying to css/trac/code.css
Found: /usr/home/nik/svk/local/jc/CPAN/SVN-Web/trunk/s/../blib/lib/SVN/Web/Style/trac/diff.css
dst_path is now: css/trac/diff.css
File, copying to css/trac/diff.css
Found: /usr/home/nik/svk/local/jc/CPAN/SVN-Web/trunk/s/../blib/lib/SVN/Web/Style/trac/file.png
dst_path is now: css/trac/file.png
File, copying to css/trac/file.png
Found: /usr/home/nik/svk/local/jc/CPAN/SVN-Web/trunk/s/../blib/lib/SVN/Web/Style/trac/filedeny.png
dst_path is now: css/trac/filedeny.png
File, copying to css/trac/filedeny.png
Found: /usr/home/nik/svk/local/jc/CPAN/SVN-Web/trunk/s/../blib/lib/SVN/Web/Style/trac/folder.png
dst_path is now: css/trac/folder.png
File, copying to css/trac/folder.png
Found: /usr/home/nik/svk/local/jc/CPAN/SVN-Web/trunk/s/../blib/lib/SVN/Web/Style/trac/folderdeny.png
dst_path is now: css/trac/folderdeny.png
File, copying to css/trac/folderdeny.png
Found: /usr/home/nik/svk/local/jc/CPAN/SVN-Web/trunk/s/../blib/lib/SVN/Web/Style/trac/parent.png
dst_path is now: css/trac/parent.png
File, copying to css/trac/parent.png
Found: /usr/home/nik/svk/local/jc/CPAN/SVN-Web/trunk/s/../blib/lib/SVN/Web/Style/trac/svnweb.css
dst_path is now: css/trac/svnweb.css
File, copying to css/trac/svnweb.css
Found: /usr/home/nik/svk/local/jc/CPAN/SVN-Web/trunk/s/../blib/lib/SVN/Web/Style/trac/text-diff-html.css
dst_path is now: css/trac/text-diff-html.css
File, copying to css/trac/text-diff-html.css
Found: /usr/home/nik/svk/local/jc/CPAN/SVN-Web/trunk/s/../blib/lib/SVN/Web/Style/trac/trac.css
dst_path is now: css/trac/trac.css
File, copying to css/trac/trac.css
Installing Template -> template
Base path is now /usr/home/nik/svk/local/jc/CPAN/SVN-Web/trunk/s/../blib/lib/SVN/Web/Template
Found: /usr/home/nik/svk/local/jc/CPAN/SVN-Web/trunk/s/../blib/lib/SVN/Web/Template
dst_path is now: template
Directory, making it
Found: /usr/home/nik/svk/local/jc/CPAN/SVN-Web/trunk/s/../blib/lib/SVN/Web/Template/plain
dst_path is now: template/plain
Directory, making it
Found: /usr/home/nik/svk/local/jc/CPAN/SVN-Web/trunk/s/../blib/lib/SVN/Web/Template/plain/browse
dst_path is now: template/plain/browse
File, copying to template/plain/browse
Found: /usr/home/nik/svk/local/jc/CPAN/SVN-Web/trunk/s/../blib/lib/SVN/Web/Template/plain/diff
dst_path is now: template/plain/diff
File, copying to template/plain/diff
Found: /usr/home/nik/svk/local/jc/CPAN/SVN-Web/trunk/s/../blib/lib/SVN/Web/Template/plain/footer
dst_path is now: template/plain/footer
File, copying to template/plain/footer
Found: /usr/home/nik/svk/local/jc/CPAN/SVN-Web/trunk/s/../blib/lib/SVN/Web/Template/plain/header
dst_path is now: template/plain/header
File, copying to template/plain/header
Found: /usr/home/nik/svk/local/jc/CPAN/SVN-Web/trunk/s/../blib/lib/SVN/Web/Template/plain/list
dst_path is now: template/plain/list
File, copying to template/plain/list
Found: /usr/home/nik/svk/local/jc/CPAN/SVN-Web/trunk/s/../blib/lib/SVN/Web/Template/plain/log
dst_path is now: template/plain/log
File, copying to template/plain/log
Found: /usr/home/nik/svk/local/jc/CPAN/SVN-Web/trunk/s/../blib/lib/SVN/Web/Template/plain/revision
dst_path is now: template/plain/revision
File, copying to template/plain/revision
Found: /usr/home/nik/svk/local/jc/CPAN/SVN-Web/trunk/s/../blib/lib/SVN/Web/Template/plain/view
dst_path is now: template/plain/view
File, copying to template/plain/view
Found: /usr/home/nik/svk/local/jc/CPAN/SVN-Web/trunk/s/../blib/lib/SVN/Web/Template/plain/x
dst_path is now: template/plain/x
File, copying to template/plain/x
Found: /usr/home/nik/svk/local/jc/CPAN/SVN-Web/trunk/s/../blib/lib/SVN/Web/Template/trac
dst_path is now: template/trac
Directory, making it
Found: /usr/home/nik/svk/local/jc/CPAN/SVN-Web/trunk/s/../blib/lib/SVN/Web/Template/trac/browse
dst_path is now: template/trac/browse
File, copying to template/trac/browse
Found: /usr/home/nik/svk/local/jc/CPAN/SVN-Web/trunk/s/../blib/lib/SVN/Web/Template/trac/diff
dst_path is now: template/trac/diff
File, copying to template/trac/diff
Found: /usr/home/nik/svk/local/jc/CPAN/SVN-Web/trunk/s/../blib/lib/SVN/Web/Template/trac/footer
dst_path is now: template/trac/footer
File, copying to template/trac/footer
Found: /usr/home/nik/svk/local/jc/CPAN/SVN-Web/trunk/s/../blib/lib/SVN/Web/Template/trac/header
dst_path is now: template/trac/header
File, copying to template/trac/header
Found: /usr/home/nik/svk/local/jc/CPAN/SVN-Web/trunk/s/../blib/lib/SVN/Web/Template/trac/list
dst_path is now: template/trac/list
File, copying to template/trac/list
Found: /usr/home/nik/svk/local/jc/CPAN/SVN-Web/trunk/s/../blib/lib/SVN/Web/Template/trac/log
dst_path is now: template/trac/log
File, copying to template/trac/log
Found: /usr/home/nik/svk/local/jc/CPAN/SVN-Web/trunk/s/../blib/lib/SVN/Web/Template/trac/revision
dst_path is now: template/trac/revision
File, copying to template/trac/revision
Found: /usr/home/nik/svk/local/jc/CPAN/SVN-Web/trunk/s/../blib/lib/SVN/Web/Template/trac/view
dst_path is now: template/trac/view
File, copying to template/trac/view
Found: /usr/home/nik/svk/local/jc/CPAN/SVN-Web/trunk/s/../blib/lib/SVN/Web/Template/trac/x
dst_path is now: template/trac/x
File, copying to template/trac/x
SVN::Web now installed! please see config.yaml
#!/usr/bin/perl
use strict;
use Config;
use File::Copy;
use File::Basename;
use File::Find;
BEGIN {
# This is a nasty hack. SVN::Core has a bug. "perl -MSVN::Core -c -e 1"
# will dump core. Something to do with the interaction between "-c"
# running BEGIN blocks but not running END blocks, or similar.
#
# Anyway, we want to test to make sure this script compiles cleanly.
# And we want to use SVN::Web. Since the two are mutually exclusive,
# only use SVN::Web (and hence SVN::Core) if we're not compiling.
if(! $^C) {
require SVN::Web;
}
}
die "already have config.yaml" if -e 'config.yaml';
print "svnweb-install\n";
print "Using SVN::Web $SVN::Web::VERSION\n";
print "Using Perl "; printf("%vd\n", $^V);
print "Using File::Copy $File::Copy::VERSION\n";
print "Using File::Find $File::Find::VERSION\n";
print "\n";
open my $fh, ">config.yaml";
my %targets = (
Template => 'template',
I18N => 'po',
Style => 'css',
);
my $svnweb_path = $INC{'SVN/Web.pm'};
print "Loaded SVN::Web from $svnweb_path\n";
while (my ($from, $to) = each %targets) {
my $path = $svnweb_path;
print "Installing $from -> $to\n";
$path =~ s{.pm$}{/$from}i or next;
print " Base path is now $path\n";
find({ wanted => sub {
my $dst_path = $File::Find::name;
print " Found: $dst_path\n";
$dst_path =~ s/$path/$to/;
print " dst_path is now: $dst_path\n";
if(-d $File::Find::name) {
print " Directory, making it\n";
mkdir $dst_path;
} else {
print " File, copying to $dst_path\n";
copy($File::Find::name, $dst_path);
}
}, no_chdir => 1 }, $path);
}
print $fh <<END;
# Actions, and the classes that implement them.
actions:
browse:
class: SVN::Web::Browse
checkout:
class: SVN::Web::Checkout
diff:
class: SVN::Web::Diff
list:
class: SVN::Web::List
log:
class: SVN::Web::Log
revision:
class: SVN::Web::Revision
rss:
class: SVN::Web::RSS
view:
class: SVN::Web::View
# Suggested minimum filters to run log messages through. Note that
# it is not fatal if one of these filters is not installed.
log_msg_filters:
- name: standard
filter: html
- name: standard
filter: html_line_break
- name: Clickable
filter: clickable
- name: Clickable::Email
filter: filter
# set your repository path below:
#
#repos:
# test: '/tmp/svnweb-test'
# test2: '/tmp/svnweb-test2'
#
# or a parent path contains repositories
#
#reposparent: '/path/to/repositories'
#
# if you set a parent you can block specific repositories
# like this:
#
#block:
# - 'blocked1'
# - 'blocked2'
#
END
close $fh;
open $fh, '>index.cgi';
print $fh <<"END";
$Config::Config{startperl} -w
#use lib '.';
#use lib '../lib';
use CGI::Carp qw(fatalsToBrowser);
use SVN::Web;
SVN::Web::run_cgi();
END
close $fh;
chmod 0755,'index.cgi';
# XXX: export the template too
print "SVN::Web now installed! please see config.yaml\n";