Package: cvs-mailcommit
Version: 1.19-2
Severity: normal

Hi,

when using --full option, binary files are included into mail. This is
ugly ;-)

Binary files should be skipped.

I'm not a CVS/RCS guru, but I'm using this patch to fix this.
(I'm just checking for "^expand @b@" in given RCS file, and it works :-)

Regards,
Lada Dobias

-- System Information:
Debian Release: 3.1
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i686)
Kernel: Linux 2.6.6-040531
Locale: LANG=czech, LC_CTYPE=czech (charmap=ISO-8859-2)

Versions of packages cvs-mailcommit depends on:
ii  exim-tls [mail-transport-agen 3.35-3     Exim Mailer - with TLS (SSL) suppo
ii  rcs                           5.7-14     The GNU Revision Control System

-- no debconf information
Index: cvs-mailcommit
===================================================================
RCS file: /var/lib/cvs/lado/src/debian/cvs-mailcommit/cvs-mailcommit,v
retrieving revision 1.2
diff -u -p -r1.2 cvs-mailcommit
--- cvs-mailcommit      12 Mar 2005 22:51:34 -0000      1.2
+++ cvs-mailcommit      12 Mar 2005 23:26:22 -0000
@@ -3,7 +3,7 @@
 # cvs-mailcommit - Send CVS commitments via mail
 # Copyright (c) 1998,2004  Martin Schulze <[EMAIL PROTECTED]>
 #
-# $Id: cvs-mailcommit,v 1.2 2005/03/12 22:51:34 xdobiasl Exp $
+# $Id: cvs-mailcommit,v 1.4 2005/03/12 22:59:25 xdobiasl Exp $
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -294,14 +294,19 @@ if (open (M, "|$sendmail -t")) {
                                $year+1900, $mon+1, $mday, $hour,$min,$sec);
 
            if (open (R, "$co -p -r$newver $module_dir/$file 2>/dev/null |")) {
+               $lines = 0;
                printf M "--- %s/%s\t%s\tNONE\n", $module_dir, $file, $date;
                printf M "+++ %s/%s\t%s\t%s\n", $module_dir, $file, $date, 
$newver;
-               while (<R>) {
-                   $lines++;
-                   print M if ($lines <= $opt_maxlines);
+               if (is_binary("$module_dir/$file")) {
+                   print M "\n[binary file - skipped]\n";
+               } else {
+                   while (<R>) {
+                       $lines++;
+                       print M if ($lines <= $opt_maxlines);
+                   }
+                   printf M "\n[%d lines skipped]\n", $lines - $opt_maxlines 
if ($lines > $opt_maxlines);
                }
                close (R);
-               printf M "\n[%d lines skipped]\n", $lines - $opt_maxlines if 
($lines > $opt_maxlines);
            } else {
                print M "Cannot open $co, huh, $!\n";
            }
@@ -311,6 +316,19 @@ if (open (M, "|$sendmail -t")) {
     close (M);
 }
 
+# checks if RCS file has "-kb" flag, i.e. the file is binary
+sub is_binary
+{
+    my $file=shift;
+    $file.=",v"; # add RCS suffix
+    open RCSFILE, $file or return 0;
+    local $/="\n\n";
+    my $header=<RCSFILE>;
+    close RCSFILE;
+    $header =~ /[EMAIL PROTECTED]@;$/m and return 1;
+    return 0;
+}
+
 =head1 CONFIGURATION FILE
 
 B<cvs-mailcommit> supports an additional configuration file

Reply via email to