Reputation: 2703
I'm using svnnotify
. It works (sends email and all that) but it always outputs some error messages, such as
Use of uninitialized value in substr at /usr/lib/perl5/site_perl/5.8.8/SVN/Notify.pm line 1313. substr outside of string at /usr/lib/perl5/site\_perl/5.8.8/SVN/Notify.pm line 1313. Use of uninitialized value in index at /usr/lib/perl5/site\_perl/5.8.8/SVN/Notify.pm line 1313. Use of uninitialized value in concatenation (.) or string at /usr/lib/perl5/site\_perl/5.8.8/SVN/Notify.pm line 1314.
I've tried running it with > /dev/null
but no luck. I've tried running it > bla
and file bla
comes up empty, and the output is shown on screen. Since svnnotify
does not have a quiet switch, how can I do this?
Upvotes: 1
Views: 1085
Reputation: 132822
It looks like this happens when there is no log message for the commit. Some users may need to have a LART session to fix that. Barring that, the right thing to do is fix the SVN::Notify module and submit the patch to the SVN::Notify RT queue, but too late, I've already submitted the ticket.
Here's the patch:
diff --git a/lib/SVN/Notify.pm b/lib/SVN/Notify.pm index 3f3672b..5387dd2 100644 --- a/lib/SVN/Notify.pm +++ b/lib/SVN/Notify.pm @@ -1308,7 +1308,7 @@ sub prepare_subject { } # Add the first sentence/line from the log message. - unless ($self->{no\_first\_line}) { + if (!$self->{no\_first\_line} and defined $self->{message}[0] and length $self->{message}[0] ) # Truncate to first period after a minimum of 10 characters. my $i = index substr($self->{message}[0], 10), '. '; $self->{subject} .= $i > 0
I think that takes care of the warnings, but I suspect it's only a band-aid because the design around $self->{no\_first\_line}
seems dodgy.
Upvotes: 8
Reputation: 75409
While the accepted answer certainly works, it isn't (in my opinion) the best answer, because one day you're going to have to maintain this code (or worse, someone else will), and getting it to run with no warnings will make your code that much better. Given the warnings, it looks like the problem isn't you, but it's hard (but not impossible) to imagine that a module in version 2.79 would give errors. Maybe your copy of SVN::Notify is old? Maybe your code (or someone's code) is mucking with the module's internals? It's hard to tell with the few warnings I can see, and I have a feeling there's a bit more to this problem than meets the eye.
Upvotes: 2
Reputation: 41306
The error is printed on stderr, you can redirect it to /dev/null
with 2> /dev/null
. Alternatively you can make it not use perl -w
.
Upvotes: 0