On Wed, Nov 5, 2008 at 8:45 AM, David Holroyd <span dir="ltr">&lt;<a href="mailto:dave@badgers-in-foil.co.uk">dave@badgers-in-foil.co.uk</a>&gt;</span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
I don&#39;t remember ever having seen something like this.<br>
<br>
Could it somehow be related to end-of-line-sequence handling (i.e. &nbsp;are<br>
extra windows-style carriage-return characters at the end of the line in<br>
question)?<br>
</blockquote><div><br>It doesn&#39;t seem to be the case.<br><br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>
I seem to recall that the Ruby &#39;puts&#39; method doesn&#39;t append a newline to<br>
the string if there&#39;s one there already -- maybe windows line endings<br>
cause this logic to foul up in one of the code paths?</blockquote><div><br>I&#39;m not saying it&#39;s impossible, but it doesn&#39;t seem to me to be related: basically a line from one file gets mingled in the diff of another file.<br>
I&#39;m more and more inclined to think that this is because of concurrent execution in background, but it&#39;s not clear to me how.<br>&nbsp;<br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Would be good to see the actual data, if possible? &nbsp;(If you want to send<br>
a private mail, I can treat it in confidence).</blockquote><div><br>I&#39;ll send you some data privately.<br><br>Here I can show the changes that I&#39;ve made to collect_diffs.rb and cvsspam.rb, together with the shell script that is invoked when a commit is made (triggered by a configuration line in loginfo).<br>
<br><br><span style="font-family: courier new,monospace;">--- cvsspam-0.2.12/collect_diffs.rb.original&nbsp;&nbsp;&nbsp; 2008-10-17 12:07:37.000000000 -0400</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+++ collect_diffs.rb&nbsp;&nbsp;&nbsp; 2008-10-31 12:29:07.000000000 -0400</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">@@ -147,7 +147,7 @@</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;&nbsp; raise &quot;missing data dir (#{$tmpdir}/#{$dirtemplate}-XXXXXX)&quot; if $datadir==nil</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">-&nbsp; line = $stdin.gets</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+&nbsp; line = $inputfile.gets</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">&nbsp;&nbsp; unless line =~ /^Update of (.+)/</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp; fail &quot;Log preamble looks suspect (doesn&#39;t start &#39;Update of ...&#39;)&quot;</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">&nbsp;&nbsp; end</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">@@ -167,7 +167,7 @@</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">&nbsp;&nbsp; end</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;&nbsp; # look for the start of the user&#39;s comment</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">-&nbsp; $stdin.each do |line|</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+&nbsp; $inputfile.each do |line|</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp; break if line =~ /^Log Message/</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;&nbsp; end</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">@@ -176,14 +176,14 @@</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;&nbsp; end</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;&nbsp; File.open(&quot;#{$datadir}/logfile&quot;, File::WRONLY|File::CREAT|File::APPEND) do |file|</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">-&nbsp;&nbsp;&nbsp; $stdin.each do |line|</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+&nbsp;&nbsp;&nbsp; $inputfile.each do |line|</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # remove any trailing whitespace; we don&#39;t want the split() below to</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # produce empty trailing items due to &#39;\r&#39; at the end of the line</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # (if input is &#39;DOS&#39; style),</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; line.sub!(/\s*$/, &quot;&quot;)</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # &#39;Mac&#39; clients sending logs to a unix server may denote end-of-line with</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # a carriage-return, defeating the $stdin.each above (i.e. the whole log</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # a carriage-return, defeating the $inputfile.each above (i.e. the whole log</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # message will appear as a single line containing &#39;\r&#39;s).&nbsp; We handle this</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # case explicitly here, so that cvsspam.rb&#39;s Subject header generation</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # doesn&#39;t break,</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">@@ -264,8 +264,19 @@</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp; end</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;&nbsp; end</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+&nbsp; remove_inputfile()</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;end</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+def remove_inputfile()</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+&nbsp; if $inputfile != $stdin</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+&nbsp;&nbsp;&nbsp; blah &quot;Closing inputfile&quot;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+&nbsp;&nbsp;&nbsp; $inputfile.close</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+&nbsp; end</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+&nbsp; unless $filename.nil?</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+&nbsp;&nbsp;&nbsp; blah &quot;If I wasn&#39;t debugging I&#39;d have removed #{$filename}&quot;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+&nbsp;&nbsp;&nbsp; File.delete($filename) unless $debug</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+&nbsp; end</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+end</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">&nbsp;# sometimes, CVS would exit with an error like,</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;#</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">@@ -334,7 +345,9 @@</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;$config = nil</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">&nbsp;$cvs_prog = &quot;cvs&quot;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">-$debug = false</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+$debug = true</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+$inputfile = $stdin</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+$filename = nil</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;$diff_ignore_keywords = false</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">&nbsp;$task_keywords = []</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">@@ -342,7 +355,6 @@</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">&nbsp;&nbsp; fail &quot;$CVSROOT not defined.&nbsp; It should be when I am invoked from CVSROOT/loginfo&quot;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;end</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">-</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;def handle_operation?(args)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">&nbsp;&nbsp; # The CVS 1.12.x series pass an argument with the value &quot;- New directory&quot;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;&nbsp; # whereas previous versions passed &quot;some/path - New directory&quot;.&nbsp; The newer</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">@@ -360,12 +372,6 @@</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;end</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">-unless handle_operation?(ARGV)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">-&nbsp; consume_stdin()</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">-&nbsp; exit</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">-end</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">-</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">-</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">&nbsp;require &#39;getoptlong&#39;</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;opts = GetoptLong.new(</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">@@ -373,7 +379,8 @@</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;&nbsp; [ &quot;--config&quot;, &quot;-c&quot;, GetoptLong::REQUIRED_ARGUMENT ],</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">&nbsp;&nbsp; [ &quot;--debug&quot;,&nbsp; &quot;-d&quot;, GetoptLong::NO_ARGUMENT ],</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;&nbsp; [ &quot;--from&quot;,&nbsp;&nbsp; &quot;-u&quot;, GetoptLong::REQUIRED_ARGUMENT ],</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">-&nbsp; [ &quot;--charset&quot;,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; GetoptLong::REQUIRED_ARGUMENT ]</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+&nbsp; [ &quot;--charset&quot;,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; GetoptLong::REQUIRED_ARGUMENT ],</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+&nbsp; [ &quot;--file&quot;,&nbsp;&nbsp; &quot;-f&quot;, GetoptLong::OPTIONAL_ARGUMENT ]</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;)</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;# arguments to pass though to &#39;cvsspam.rb&#39;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">@@ -387,6 +394,17 @@</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">&nbsp;&nbsp; end</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;&nbsp; $config = arg if opt==&quot;--config&quot;</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">&nbsp;&nbsp; $debug = true if opt == &quot;--debug&quot;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+&nbsp; if opt == &quot;--file&quot;</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+&nbsp;&nbsp;&nbsp; $filename = arg</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+&nbsp;&nbsp;&nbsp; $inputfile = File.new(arg)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+&nbsp;&nbsp;&nbsp; blah &quot;inputfile is #{$inputfile.path}&quot;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+&nbsp; end</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+end</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+unless handle_operation?(ARGV)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+&nbsp; consume_stdin()</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+&nbsp; remove_inputfile()</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+&nbsp; exit</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;end</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;blah(&quot;CVSROOT is #{ENV[&#39;CVSROOT&#39;]}&quot;)</span><br><br><br><br><br><br><br><br><br><br><span style="font-family: courier new,monospace;">--- cvsspam-0.2.12/cvsspam.rb.original&nbsp; 2008-10-17 12:40:22.000000000 -0400</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+++ cvsspam.rb&nbsp; 2008-10-31 12:36:36.000000000 -0400</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">@@ -226,7 +226,9 @@</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp; @line = @io.gets</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp; return false if @line == nil</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp; unless @line[0,1] == &quot;#&quot;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; raise &quot;#{$logfile}:#{@io.lineno} line did not begin with &#39;#&#39;: #{@line}&quot;</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; raise &quot;#{$logfile}:#{@io.lineno} line did not begin with &#39;#&#39;: #{@line}&quot; unless $debug</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; blah&nbsp; &quot;#{$logfile}:#{@io.lineno} line did not begin with &#39;#&#39; =&gt; SKIPPING: #{@line}&quot;</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return advance</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp; end</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp; return true</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;&nbsp; end</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">@@ -1281,7 +1283,6 @@</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;&nbsp; $arg_charset = arg if opt == &quot;--charset&quot;</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">&nbsp;end</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">-</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">&nbsp;if ARGV.length != 1</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;&nbsp; if ARGV.length &gt; 1</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp; $stderr.puts &quot;extra arguments not needed: #{ARGV[1, ARGV.length-1].join(&#39;, &#39;)}&quot;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">@@ -1761,10 +1762,11 @@</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp; unless from.address =~ /@/</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; from.address = &quot;#{from.address}@#{$hostname}&quot;</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp; end</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">-&nbsp;&nbsp;&nbsp; smtp = Net::SMTP.new(@smtp_host)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+&nbsp;&nbsp;&nbsp; smtp = Net::SMTP.new(@smtp_host, 25)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp; blah(&quot;connecting to &#39;#{@smtp_host}&#39;&quot;)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">-&nbsp;&nbsp;&nbsp; smtp.start()</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">-&nbsp;&nbsp;&nbsp; smtp.ready(from.address, recipients.map{|addr| addr.address}) do |mail|</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+&nbsp;&nbsp;&nbsp; #smtp.set_debug_output $stderr</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+&nbsp;&nbsp;&nbsp; smtp.start(&#39;__omissis__&#39;, &#39;__omissis__&#39;, &#39;__omissis__&#39;, :login)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+&nbsp;&nbsp;&nbsp; smtp.ready(&#39;__omissis__&#39;, recipients.map{|addr| addr.address}) do |mail|</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ctx = MailContext.new(IOAdapter.new(mail))</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ctx.header(&quot;To&quot;, recipients.map{|addr| addr.encoded}.join(&#39;,&#39;))</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; blah(&quot;Mail From: &lt;#{from}&gt;&quot;)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">@@ -1772,6 +1774,7 @@</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ctx.header(&quot;Date&quot;, Time.now.utc.strftime(DATE_HEADER_FORMAT))</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; yield ctx</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp; end</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+&nbsp;&nbsp;&nbsp; smtp.finish</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;&nbsp; end</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">&nbsp;end</span><br style="font-family: courier new,monospace;"><br><br><br><br><br><br><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">[cvsspam]# cat collect_diffs_in_background.sh</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">#!/bin/bash</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">date &gt;&gt; $CVSROOT/collect_diffs.log</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">echo $USER &gt;&gt; $CVSROOT/collect_diffs.log</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">echo $1 &gt;&gt; $CVSROOT/collect_diffs.log</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">tmpfile=&quot;/tmp/tempfile.$$.${RANDOM%1000}&quot;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">cat &gt; &quot;$tmpfile&quot;</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">echo &quot;$tmpfile&quot; &gt;&gt; $CVSROOT/collect_diffs.log</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">nohup /usr/local/lib/cvsspam/collect_diffs.rb --debug --file &quot;$tmpfile&quot; --from $USER &quot;$@&quot; &gt;&gt; $CVSROOT/collect_diffs.log 2&gt;&amp;1 &amp;</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">[cvsspam]#</span><br style="font-family: courier new,monospace;"><br><br><br></div></div>So as you can see the differences are:<br>*) Upon commit the script collect_diffs_in_background.sh is called (the relevant line in loginfo looks like the following)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ALL /usr/local/lib/cvsspam/collect_diffs_in_background.sh %{sVv}<br>*) I use SMTP with recipients configured in the conf file (I have omitted the credentials in the diff above, of course)<br>*) In order to collect input from cvs and pass it to collect_diffs.rb in background I use a temporary file with a random name ==&gt; collect_diffs.rb then reads from the file rather than from stdin<br>
*) In debugging mode, if a line doesn&#39;t begin with &#39;#&#39; I simply skip to the next one<br><br>After avoiding to raise an exception and turning debugging on the issue happened again once. I&#39;ll send you the relevant files privately.<br>
<br>Thanks<br>Giuliano<br>