Duplicate file in cvs-all commit causes problems

Greetings from southern Florida. If you haven’t heard, I moved to Jupiter, Florida. Yes, PGCon and BSDCan will be in Ottawa in 2008. My relocation does not affect those events.

It was this commit to print/gutenprint that caused the problem. You will notice that one file is touched twice by that commit. It is best demonstrated by the last two lines of the log message:

  1.32      +1 -8      ports/print/gutenprint/Makefile
  1.33      +0 -0      ports/print/gutenprint/Makefile

FreshPorts was long ago coded to reject any such messages. The code in question is:

if (defined($TrackDuplicates{$path})) {
   FreshPorts::Utilities::ReportError('err', 
      "Duplicate file name ('$path') found in commit message (" . 
       GetMessage_Id($message) . ").\n\nIs this a corrupted commit or email?", 1)
} else {
   $TrackDuplicates{$path} = 1;
}

This code uses a hash/array with the file pathname as the key/index. It also invokes ReportError() with a final parameter of 1, which means fatal error.

I decided this wasn’t a fatal error any more. I changed the 1 to a 0 and tried processing the commit again. I started thinking there was an error somewhere else in the code, because I was getting this error:

syntax error at line 1, column 0, byte 0 at /usr/local/lib/perl5/site_perl/5.8.8/mach/XML/Parser.pm line 187

I started playing around with the XML file in case duplicate entries were a problem there. It was then that I noticed the problem (but not immediately). The XML file contained non-xml. At the top of the file was:

Duplicate file name ('ports/print/gutenprint/Makefile') found in commit message (200706261507.l5QF7lEE060586@repoman.freebsd.org).

Is this a corrupted commit or email?

OK, I’m printing out error messages and they are being piped to the file. I know a simple way around that. Don’t print, email. There is already a function that will email me the error message as well as log it via syslog. I’ll use that instead. Problem is, that prints too. So I crreated a new function and used it. This diff shows what I did:

utilities patch

This creates a new function, ReportErrorEmailNoPrint(), and adds a new parameter to _ReportErrorHelper(). This allows for the conditional printing of the error message.

The XML processing code changed to:

process_cvs_mail.pl patch

Tested. Fixed. Done. And soon to be in production so that commit message can be processed.

Website Pin Facebook Twitter Myspace Friendfeed Technorati del.icio.us Digg Google StumbleUpon Premium Responsive

Leave a Comment

Scroll to Top