=================================================================== RCS file: /cvs/cvsweb/cvsweb.cgi,v retrieving revision 4.28 retrieving revision 4.29 diff -u -p -r4.28 -r4.29 --- cvsweb/cvsweb.cgi 2019/11/26 12:14:38 4.28 +++ cvsweb/cvsweb.cgi 2019/11/29 13:39:50 4.29 @@ -1,5 +1,5 @@ #!/usr/bin/perl -# $Id: cvsweb.cgi,v 4.28 2019/11/26 12:14:38 schwarze Exp $ +# $Id: cvsweb.cgi,v 4.29 2019/11/29 13:39:50 schwarze Exp $ # $knu: cvsweb.cgi,v 1.299 2010/11/13 16:37:18 simon # # cvsweb - a CGI interface to CVS trees. @@ -67,8 +67,7 @@ use vars qw ( $is_links $is_lynx $is_w3m $is_msie $is_mozilla3 $is_textbased %input $query $barequery $sortby $bydate $byrev $byauthor $bylog $byfile $defaultDiffType $logsort $cvstree $cvsroot - $charset $output_filter - @command_path %CMD $allow_compress $backicon $diricon $fileicon + $charset $output_filter %CMD $allow_compress $backicon $diricon $fileicon $fullname $logo $defaulttitle $address $binfileicon $long_intro $short_instruction $shortLogLen $show_author $tablepadding $hr_breakable $showfunc $hr_ignwhite $hr_ignkeysubst @@ -129,6 +128,8 @@ EOM $MimeTypes = undef if $@; $CheckoutMagic = '~checkout~'; + $CMD{$_} = "/usr/bin/$_" for (qw(cvs gzip rcsdiff rlog)); + $CMD{tar} = "/bin/tar"; } # ----------------------------------------------------------------------------- @@ -644,12 +645,8 @@ if ($input{tarball}) { 'You cannot download the top level directory.'); } - my $istar = $ext eq '.tar.gz' || $ext eq '.tgz'; - if ($istar) { - fatal('500 Internal Error', 'tar command not found.') unless $CMD{tar}; - fatal('500 Internal Error', 'gzip command not found.') unless $CMD{gzip}; - } else { - fatal('500 Internal Error', 'Unsupported archive type.'); + unless ($ext eq '.tar.gz' || $ext eq '.tgz') { + fatal('404 Not Found', 'Unsupported archive type.'); } my $tmpexportdir; @@ -688,12 +685,10 @@ if ($input{tarball}) { local (*TAR_OUT); my (@cmd, $ctype); - if ($istar) { my @tar = ($CMD{tar}, @tar_options, '-cf', '-', $basedir); my @gzip = ($CMD{gzip}, @gzip_options, '-c'); push(@cmd, \@tar, '|', \@gzip); $ctype = 'application/x-gzip'; - } push(@cmd, '>pipe', \*TAR_OUT); my ($h, $err) = startproc(@cmd); @@ -1094,8 +1089,7 @@ EOF if ($allow_tar && $filesfound) { my ($basefile) = ($where =~ m,(?:.*/)?([^/]+),); - my $havetar = $CMD{tar} && $CMD{gzip}; - if (defined($basefile) && $basefile ne '' && $havetar) { + if (defined($basefile) && $basefile ne '') { my $q = ($query ? "$query;" : '?') . 'tarball=1'; print "
\n", '
Download this directory in '; @@ -1572,20 +1566,6 @@ sub safeglob($) # -# Searches @command_path for the given executable file. -# -sub search_path($) -{ - my ($command) = @_; - for my $d (@command_path) { - my $cmd = catfile($d, $command); - return $cmd if (-x $cmd && !-d _); - } - return ''; -} - - -# # Gets the MIME type for the given file name. # sub getMimeType($;$) @@ -2424,10 +2404,9 @@ sub getDirLogs($$@) if ($linesread == 0) { fatal('500 Internal Error', - 'Failed to spawn rlog on "%s".

Did you set the @command_path in your configuration file correctly? (Currently: "%s")', - htmlquote(join(', ', @files)), join(':', @command_path)); + 'Failed to spawn rlog on "%s"', + htmlquote(join(', ', @files))); } - return @unreadable; }