Escape special chars in filenames when calling rlog.
Fix minor 'used once' warnings. Bug #258668 r=timeless git-svn-id: svn://10.0.0.236/trunk@162251 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
bee72555f0
commit
46874d60a8
@ -86,6 +86,12 @@ sub url_encode3 {
|
||||
return $s;
|
||||
}
|
||||
|
||||
# Quotify a string, suitable for invoking a shell process
|
||||
sub shell_escape {
|
||||
my ($file) = @_;
|
||||
$file =~ s/([ \"\'\?\$\&\|\!<>\(\)\[\]\;\:])/\\$1/g;
|
||||
return $file;
|
||||
}
|
||||
|
||||
##
|
||||
## Routines to generate html as part of Bonsai
|
||||
|
||||
@ -40,6 +40,7 @@ sub sillyness {
|
||||
$zz = $::query_filetype;
|
||||
$zz = $::query_logexpr;
|
||||
$zz = $::query_whotype;
|
||||
$zz = $::script_type;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -51,10 +51,9 @@ sub sillyness {
|
||||
my $zz;
|
||||
$zz = $::TreeInfo;
|
||||
$zz = $::TreeList;
|
||||
$zz = $::file_description;
|
||||
$zz = $::principal_branch;
|
||||
$zz = $::head_revision;
|
||||
$zz = $::revision_ctime;
|
||||
$zz = %::timestamp;
|
||||
$zz = $::script_type;
|
||||
}
|
||||
|
||||
my $request = new CGI;
|
||||
@ -409,7 +408,9 @@ sub do_log {
|
||||
|
||||
chdir($dir);
|
||||
|
||||
open(RCSLOG, "rlog -r$opt_rev $opt_file |");
|
||||
my $rlog = Param('rlogcommand') . " -r$opt_rev " .
|
||||
shell_escape($opt_file) . " |";
|
||||
open(RCSLOG, "$rlog");
|
||||
|
||||
while (<RCSLOG>) {
|
||||
last if (/^revision $opt_rev$/);
|
||||
|
||||
@ -183,9 +183,9 @@ sub process_cvs_info {
|
||||
for $i (@changed_files, "BEATME.NOW", @added_files ) {
|
||||
if( $i eq "BEATME.NOW" ){ $stat = 'A'; }
|
||||
if($i eq $fn ){
|
||||
$rcsfile = "$envcvsroot/$repository/$fn,v";
|
||||
$rcsfile = shell_escape("$envcvsroot/$repository/$fn,v");
|
||||
if( ! -r $rcsfile ){
|
||||
$rcsfile = "$envcvsroot/$repository/Attic/$fn,v";
|
||||
$rcsfile = shell_escape("$envcvsroot/$repository/Attic/$fn,v");
|
||||
}
|
||||
open(LOG, "$rlogcommand -N -r$rev $rcsfile |")
|
||||
|| print STDERR "dolog.pl: Couldn't run rlog\n";
|
||||
@ -304,3 +304,11 @@ sub mail_notification {
|
||||
print S "QUIT\n";
|
||||
close(S);
|
||||
}
|
||||
|
||||
# Quotify a string, suitable for invoking a shell process
|
||||
sub shell_escape {
|
||||
my ($file) = @_;
|
||||
$file =~ s/([ \"\'\?\$\&\|\!<>\(\)\[\]\;\:])/\\$1/g;
|
||||
return $file;
|
||||
}
|
||||
|
||||
|
||||
@ -37,7 +37,7 @@ require "CGI.pl";
|
||||
|
||||
sub ProcessOneFile {
|
||||
my ($filename) = @_;
|
||||
my $rlog = Param('rlogcommand') . " $filename |";
|
||||
my $rlog = Param('rlogcommand') . " " . shell_escape($filename) . " |";
|
||||
my $doingtags = 0;
|
||||
my $filehead = dirname($filename);
|
||||
my (%branchname, $filerealname, $filetail, $line, $trimmed);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user