cvs-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Cvs-cvs] ccvs/contrib ChangeLog log_accum.pl


From: Derek Robert Price
Subject: [Cvs-cvs] ccvs/contrib ChangeLog log_accum.pl
Date: Tue, 27 Jun 2006 01:57:57 +0000

CVSROOT:        /cvsroot/cvs
Module name:    ccvs
Changes by:     Derek Robert Price <dprice>     06/06/27 01:57:57

Modified files:
        contrib        : ChangeLog log_accum.pl 

Log message:
        * log_accum.pl: Shrink attributions, referring reader to ChangeLog.
        (write_file): Create empty files.
        (cleanup_tmpfiles): Fix regexp & untaint result before deleting.
        (main): Don't worry about empty log files.
        (Original patch from Sylvain Beucler <address@hidden>.)

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/ccvs/contrib/ChangeLog?cvsroot=cvs&r1=1.206&r2=1.207
http://cvs.savannah.gnu.org/viewcvs/ccvs/contrib/log_accum.pl?cvsroot=cvs&r1=1.42&r2=1.43

Patches:
Index: ChangeLog
===================================================================
RCS file: /cvsroot/cvs/ccvs/contrib/ChangeLog,v
retrieving revision 1.206
retrieving revision 1.207
diff -u -b -r1.206 -r1.207
--- ChangeLog   7 Jun 2006 14:35:26 -0000       1.206
+++ ChangeLog   27 Jun 2006 01:57:57 -0000      1.207
@@ -1,3 +1,11 @@
+2006-06-26  Derek Price  <address@hidden>
+
+       * log_accum.pl: Shrink attributions, referring reader to ChangeLog.
+       (write_file): Create empty files.
+       (cleanup_tmpfiles): Fix regexp & untaint result before deleting.
+       (main): Don't worry about empty log files.
+       (Original patch from Sylvain Beucler <address@hidden>.)
+
 2006-06-07  Derek Price  <address@hidden>
 
        * log_accum.pl (set_defaults): Don't dereference undefined value.

Index: log_accum.pl
===================================================================
RCS file: /cvsroot/cvs/ccvs/contrib/log_accum.pl,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -b -r1.42 -r1.43
--- log_accum.pl        7 Jun 2006 14:35:26 -0000       1.42
+++ log_accum.pl        27 Jun 2006 01:57:57 -0000      1.43
@@ -42,30 +42,9 @@
 # ALL /usr/local/bin/log_accum -T ccvs_1 --config /etc/log_accum.config 
--mail-to address@hidden --send-diff %p %{sVv}
 # ^prog1\(/\|$\) /usr/local/bin/log_accum -T ccvs_2 --config 
/etc/log_accum.config -m address@hidden %p %{sVv}
 #
-# Contributed by David Hampton <address@hidden>
-# Roy Fielding removed useless code and added log/mail of new files
-# Ken Coar added special processing (i.e., no diffs) for binary files
-# Changes by Sylvain Beucler <address@hidden> (2006-05-08):
-# - option -T added again to support multiple log_accum hooks
-# - used 'use strict' and added compatibility for 'perl -T' switch
-# (and found a ghost variable!)
-# - documented some more
-# - fixed a bug in processing -u in log_accum
-# - cleaned-up the temporary filenames
-# - fixed support for UseNewInfoFmtStrings
-# - test if files are empty, so they are not reported as binary
-# - -r now also accepts 'HEAD' as argument (clearer than '')
-# - viewcvs URL's for binary files now use application/octet-stream
-# content type; diff URLs are also more compatible with viewcvs
-# (removed '.diff')
-# - do not perform a diff if a file is added or removed
-# Derek Price (2006-05-08):
-# - Perform the diff if added or removed unless -E is specified.
-# - Accept and process config files.
-# - Send one diff per file when requested.
-# - Tidy and perform some performance optimization.
-# - Format output.
-# - Use short cvsweb URLs.
+# Brought to you by David Hampton <address@hidden>, Roy Fielding,
+# Ken Coar, Sylvain Beucler <address@hidden> and Derek Price -- check
+# ChangeLog for precise credits.
 
 use strict;
 
@@ -1137,14 +1116,12 @@
 
 
 
-# Blindly dump @lines into a file.  Noop if @lines is empty.  Otherwise,
-# creates the file, overwriting existing files.
+# Blindly dump @lines into a file.  Creates the file, overwriting existing
+# files.
 sub write_file
 {
     my ($filename, @lines) = @_;
 
-    return unless @lines;
-
     open FILE, ">$filename" or die "Cannot open file $filename: $!";
     print FILE join ("\n", @lines), "\n";
     close FILE;
@@ -1226,13 +1203,16 @@
     die "$tmpdir does not exist" unless -d $tmpdir;
     opendir DIR, $tmpdir or die "Can't read $tmpdir: $!";
 
-    push @files, grep /^#\Q$prefix\E\.$id.*\.$/, readdir DIR;
-    closedir DIR;
-
-    foreach (@files)
+    while (readdir DIR)
     {
-        unlink "$tmpdir/$_";
+       # Matching a subpattern of a regexp untaints the file names...
+       /^(#\Q$prefix\E\.$id\..*)$/;
+       push @files, $1;
     }
+    closedir DIR;
+
+    # Delete the files.
+    map { unlink "$tmpdir/$_" } @files;
 }
 
 
@@ -1376,13 +1356,11 @@
        $REMOVED_REV_BASE) = get_temp_files $TMPDIR, $config->{'file-text'},
                                            $id;
 
-    my @text;
     my $i;
     for ($i = 0; ; $i++)
     {
        last if !-e "$LOG_BASE.$i";
-       @text = read_logfile "$LOG_BASE.$i";
-       last if address@hidden;
+       my @text = read_logfile "$LOG_BASE.$i";
        print STDERR "comparing: {", join (" ", @$log_lines), "} and {",
                     join (" ", @text), "}\n"
            if $debug;
@@ -1393,7 +1371,7 @@
     #
     # Spit out the information gathered in this pass.
     #
-    write_file "$LOG_BASE.$i", @$log_lines if !-e "$LOG_BASE.$i" or 
address@hidden;
+    write_file "$LOG_BASE.$i", @$log_lines if !-e "$LOG_BASE.$i";
     append_files_to_file "$BRANCH_BASE.$i",  $module, @$branch_lines;
     append_files_to_file "$CHANGED_BASE.$i", $module, @$changed_files;
     append_files_to_file "$ADDED_BASE.$i",   $module, @$added_files;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]