=================================================================== RCS file: /cvs/cvsweb/cvsweb.cgi,v retrieving revision 4.36 retrieving revision 4.37 diff -u -p -r4.36 -r4.37 --- cvsweb/cvsweb.cgi 2019/11/29 18:33:24 4.36 +++ cvsweb/cvsweb.cgi 2019/11/29 18:50:15 4.37 @@ -1,5 +1,5 @@ #!/usr/bin/perl -# $Id: cvsweb.cgi,v 4.36 2019/11/29 18:33:24 schwarze Exp $ +# $Id: cvsweb.cgi,v 4.37 2019/11/29 18:50:15 schwarze Exp $ # $knu: cvsweb.cgi,v 1.299 2010/11/13 16:37:18 simon # # cvsweb - a CGI interface to CVS trees. @@ -57,7 +57,7 @@ use vars qw ( $VERSION $CheckoutMagic $MimeTypes $DEBUG $config $allow_version_select @CVSrepositories @CVSROOT %CVSROOT %CVSROOTdescr %DEFAULTVALUE %MTYPES - %DIFF_COMMANDS @DIFFTYPES %DIFFTYPES @LOGSORTKEYS %LOGSORTKEYS + @DIFFTYPES %DIFFTYPES @LOGSORTKEYS %LOGSORTKEYS %alltags %fileinfo %tags @branchnames %nameprinted %symrev %revsym @allrevisions %date %author @revdisplayorder @revisions %state %difflines %log %branchpoint @revorder $keywordsubstitution @@ -86,7 +86,7 @@ use Cwd qw(abs_path); use File::Path qw(rmtree); use File::Spec::Functions qw(canonpath catdir catfile curdir devnull rootdir tmpdir updir); -use File::Temp qw(tempdir tempfile); +use File::Temp qw(tempdir); use IPC::Run qw(); use Time::Local qw(timegm); use URI::Escape qw(uri_escape uri_unescape); @@ -182,7 +182,6 @@ sub link_tags($); sub forbidden($); sub startproc(@); sub runproc(@); -sub checkout_to_temp($$$); # Get rid of unsafe environment vars. Don't do this in the BEGIN block # (think mod_perl)... @@ -198,7 +197,7 @@ $config = '/conf/cvsweb/cvsweb.conf'; ######## Configuration parameters ######### @CVSrepositories = @CVSROOT = %CVSROOT = %DEFAULTVALUE = - %MTYPES = %tags = %alltags = %fileinfo = %DIFF_COMMANDS = (); + %MTYPES = %tags = %alltags = %fileinfo = (); $logo = $defaulttitle = $address = $shortLogLen = $show_author = @@ -2062,60 +2061,6 @@ sub doDiff($$$$$$) my $mimetype = getMimeType($fullname); - # - # Check for per-MIME type diff commands. - # - my $diffcmd = undef; - if (my $diffcmds = $DIFF_COMMANDS{lc($mimetype)}) { - if ($f =~ /^ext(\d*)$/) { - my $n = $1 || 0; - $diffcmd = $diffcmds->[$n]; - } - } - if ($diffcmd && $diffcmd->{cmd} && $diffcmd->{name}) { - - if ($diffcmd->{args} && ref($diffcmd->{args}) ne 'ARRAY') { - fatal('500 Internal Error', - 'Configuration error: arguments to external diff tools must ' . - 'be given as array refs. See "%s" in ' . - '%%DIFF_COMMANDS.', - $diffcmd->{name}); - } - - (my $cvsname = $where) =~ s/\.diff$//; - - # Create two temporary files with the two revisions - my $temp_fn1 = checkout_to_temp($cvsroot, $cvsname, $rev1); - my $temp_fn2 = checkout_to_temp($cvsroot, $cvsname, $rev2); - - # Execute chosen diff binary. - local (*DIFF_OUT); - my @cmd = ($diffcmd->{cmd}); - push(@cmd, @{$diffcmd->{args}}) if $diffcmd->{args}; - push(@cmd, $temp_fn1, $temp_fn2); - my ($h, $err) = startproc(\@cmd, \"", '>pipe', \*DIFF_OUT); - if (!$h) { - unlink($temp_fn1); - unlink($temp_fn2); - fatal('500 Internal Error', - 'Diff failure (exit status %s), output:
%s
', - $? >> 8 || -1, $err); - } - - http_header($diffcmd->{type} || 'text/plain'); - local $/ = undef; - print ; - $h->finish(); - unlink($temp_fn1); - unlink($temp_fn2); - - exit; - } - - # - # Normal CVS diff. - # - $f = $DEFAULTVALUE{f} || 'u' if ($f =~ /^ext\d*$/); my $difftype = $DIFFTYPES{$f}; if (!$difftype) { @@ -2647,13 +2592,6 @@ sub getDiffLinks($$$) &link(htmlquote(lc($DIFFTYPES{$difftype}{descr})), "$url;f=$f")); } } - if (my $extdiffs = $DIFF_COMMANDS{lc($mimetype)}) { - for my $i (0 .. scalar(@$extdiffs)-1) { - my $extdiff = $extdiffs->[$i]; - push(@links, &link(htmlquote($extdiff->{name}), "$url;f=ext$i")) - if ($extdiff->{cmd} && $extdiff->{name}); - } - } return @links; } @@ -3770,37 +3708,6 @@ sub runproc(@) $errormsg = "'@{$_[0]}' failed: $@"; } return ($exitcode, $errormsg); -} - -# -# Check out a file to a temporary file. -# -sub checkout_to_temp($$$) -{ - my ($cvsroot, $cvsname, $rev) = @_; - - # Pipe given cvs file into a temporary place. - my ($temp_fh, $temp_fn) = tempfile('.cvsweb.XXXXXXXX', DIR => tmpdir()); - - my @cmd = ($CMD{cvs}, @cvs_options, '-Qd', $cvsroot, - 'co', '-p', "-r$rev", $cvsname); - - local (*DIFF_OUT); - my ($h, $err) = startproc(\@cmd, \"", '>pipe', \*DIFF_OUT); - if ($h) { - local $/ = undef; - print $temp_fh ; - $h->finish(); - close($temp_fh); - } else { - close($temp_fh); - unlink($temp_fn); - fatal('500 Internal Error', - 'Checkout failure (exit status %s), output:
%s
', - $? >> 8 || -1, $err); - } - - return $temp_fn; } #