Share

whatsnewfm

Tracker: Bugs

5 use of unintitialized value in exists - ID: 2797110
Last Update: Comment added ( mastermitch )

cat fm_20090525 | /home/astern/bin/whatsnewfm.pl -c
/home/astern/.whatsnewfmrc
leads to
Use of uninitialized value in exists at /home/astern/bin/whatsnewfm.pl line
779, <STDIN> line 104.
Use of uninitialized value in subroutine entry at
/usr/lib/perl5/BerkeleyDB.pm line 1303, <STDIN> line 104.
...
Use of uninitialized value in exists at /home/astern/bin/whatsnewfm.pl line
779, <STDIN> line 1741.
Use of uninitialized value in subroutine entry at
/usr/lib/perl5/BerkeleyDB.pm line 1303, <STDIN> line 1741.

for each project in the freshmeat mail.
using: whatsnewfm.pl v0.7.0 2009-03-26
This happens since yesterday - I do not see a change in the mailformat - we
upgraded the kernel and did a reboot.
What can I do to help resolving the Problem?
trying to
print "Line: $line\n";
before the line 779
if (($new_app->{'project_id'}) and (exists
$interesting->{$new_app->{'project_id'}})) {
does not show anything in the Output.
A
whatsnewfn.pl view
seems to work correctly.
regards
A.


Andreas Stern ( astern ) - 2009-05-26 22:59

5

Open

Fixed

Christian Garbs

Program

stable branch

Public


Comments ( 6 )




Date: 2009-05-31 09:34
Sender: mastermitchProject Admin

When I take a look at the old code: back in those days it wasn't mine,
either :-)
But I don't have time for a complete rewrite...


Date: 2009-05-30 21:24
Sender: nobody

hi,

a parser really is the more elegant Idea! As you might have guessed, perl
is not my every day language.

Regards

A.


Date: 2009-05-30 20:33
Sender: mastermitchProject Admin

on a second glance at the patch - the mismatch counter is nice!
I'll add something like it to my todo list.


Date: 2009-05-30 20:31
Sender: mastermitchProject Admin

Thanks for the patch, but I've done a partly rewrite of the newsletter
parser that might be able to dodge some small changes in future...

I'll do a proper release tomorrow, for the time being here are updated
Debian sid packages (bug #531104):

http://www.cgarbs.de/tmp/whatsnewfm_0.7.1-1_all.deb
http://www.cgarbs.de/tmp/whatsnewfm_0.7.1-1.diff.gz
http://www.cgarbs.de/tmp/whatsnewfm_0.7.1-1.dsc
http://www.cgarbs.de/tmp/whatsnewfm_0.7.1.orig.tar.gz

Regards
Christian



Date: 2009-05-29 22:17
Sender: nobody

hi Christian,

meanwhile poked around a bit, what do You say to the following patch?

--- /usr/bin/whatsnewfm.pl 2009-03-29 12:21:25.000000000 +0200
+++ bin/whatsnewfm.pl 2009-05-30 00:13:09.000000000 +0200
@@ -573,6 +573,7 @@
my $db_new = 0;

my $releases = 0;
+ my $missed_releases = 0;
my $releases_new = 0;

my $end = 0;
@@ -647,6 +648,7 @@
} elsif ($position == 0) {

### parse an release entry
+ # new Order is : Project Tags: Description: Changes: Release
Tags: License: http://...

# empty line
while ((defined $line) and ($line =~ /^\s*$/)) {
@@ -680,6 +682,26 @@
}
next unless defined $line;

+ # Category
+ if ($line =~ /^Project Tags:/) {
+ chomp $line;
+ $line =~ s/^Project Tags: //;
+ $new_app->{'category'} = $line;
+ while ($line=<STDIN>) {
+ last if (($line =~ /^\s*$/) || ($line =~ /Release Tags:/)) ;
+ chomp $line;
+ $new_app->{'category'} .= "," . $line;
+ }
+ delete $new_app->{'category'} if $new_app->{'category'} eq '';
+ $line=<STDIN>;
+ next unless defined $line;
+
+ # empty line
+ while ((defined $line) and ($line =~ /^\s*$/)) {
+ $line=<STDIN>;
+ }
+ next unless defined $line;
+ }
# about
if ($line =~ /^Description:/) {
$line=<STDIN>;
@@ -701,7 +723,8 @@
$line=<STDIN>;
$new_app->{'changes'} = $line;
while ($line=<STDIN>) {
- last if $line =~ /^\s*$/;
+ # changes sometimes contain empty lines
+ last if $line =~ /^Release Tags:|^License:|^http:/;
$new_app->{'changes'} .= $line;
}
}
@@ -712,34 +735,11 @@
}
next unless defined $line;

- # License
- if ($line =~ /^License:/) {
- chomp $line;
- $line =~ s/^License: //;
- $new_app->{'license'} = $line unless $line =~ /^\s*$/;
- $line=<STDIN>;
- next unless defined $line;
-
- # empty line
- while ((defined $line) and ($line =~ /^\s*$/)) {
- $line=<STDIN>;
- }
- next unless defined $line;
- }
-
-
- # Category
- if ($line =~ /^Project Tags:/) {
- chomp $line;
- $line =~ s/^Project Tags: //;
- $new_app->{'category'} = $line;
- while ($line=<STDIN>) {
- last if (($line =~ /^\s*$/) || ($line =~ /Release Tags:/)) ;
- chomp $line;
- $new_app->{'category'} .= "," . $line;
- }
- delete $new_app->{'category'} if $new_app->{'category'} eq '';
- $line=<STDIN>;
+ # Release Tags
+ if ($line =~ /^Release Tags:/) {
+ while ($line=<STDIN>){
+ last if $line =~ /^License:|^http:/;
+ }
next unless defined $line;

# empty line
@@ -749,15 +749,23 @@
next unless defined $line;
}

- if ($line =~ /^Release Tags:/) {
- chomp $line;
- next unless defined $line;

- # empty line
- while ((defined $line) and ($line =~ /^\s*$/)) {
- $line=<STDIN>;
- }
- next unless defined $line;
+ # License
+ if ($line =~ /^License:/) {
+ #chomp $line;
+ $line =~ s/^License: //;
+ $new_app->{'license'} = $line unless $line =~ /^\s*$/;
+ $line=<STDIN>;
+ while ($line=<STDIN>){
+ last if $line =~ /^License:|^http:/;
+ }
+ next unless defined $line;
+
+ # empty line
+ while ((defined $line) and ($line =~ /^\s*$/)) {
+ $line=<STDIN>;
+ }
+ next unless defined $line;
}

# URL
@@ -771,6 +779,7 @@
next unless defined $line;
}

+ if (! defined $new_app->{'project_id'})
{$missed_releases++;next;}
$releases++;
do_scoring($new_app);

@@ -835,7 +844,7 @@
### send mails

mail_hot_apps($hot_applications, $encoding);
- mail_new_apps($subject, $releases, $releases_new, $hot_written,
$db_new, $db_written, $db_expired, $new_applications, $encoding);
+ mail_new_apps($subject, $releases, $releases_new, $hot_written,
$db_new, $db_written, $db_expired, $new_applications, $encoding,
$missed_releases);

}

@@ -934,20 +943,33 @@
##################[ format summary of a "new" mail
]#########################


-sub format_summary($$$$$$$)
+sub format_summary($$$$$$$$)
{
- my ($releases, $releases_new, $hot_written, $db_new, $db_written,
$db_expired, $score_killed) = @_;
+ my ($releases, $releases_new, $hot_written, $db_new, $db_written,
$db_expired, $score_killed, $missed_releases) = @_;

my $already_seen=@{$skipped_already_seen};
my $difference=$releases-$releases_new-$already_seen;
my $remaining=$releases_new-$score_killed;
- my $summary = << "EOF";
-
- This newsletter has been filtered by:
- $id
+ my $summary;
+ if ($missed_releases > 0 ){
+ my $sum_releases=$releases + $missed_releases;
+ $summary = << "EOF";
+
+ This newsletter has been filtered by:
+ $id
+
+ It contained $sum_releases releases ($missed_releases releases
could not be handled due formating incosistencies).
+EOF
+ } else {
+ $summary = << "EOF";
+
+ This newsletter has been filtered by:
+ $id

- It contained $releases releases.
+ It contained $releases releases.
EOF
+ }
+

if ($releases > 1) { # 1 release is not enough to ensure proper
operation!

@@ -1388,7 +1410,7 @@

sub mail_new_apps($$$$$$$$$)
{
- my ($subject, $releases, $releases_new, $hot_written, $db_new,
$db_written, $db_expired, $new_applications, $encoding) = @_;
+ my ($subject, $releases, $releases_new, $hot_written, $db_new,
$db_written, $db_expired, $new_applications, $encoding, $missed_releases) =
@_;
my $new_app;

### only keep applications with at least minimum score
@@ -1403,7 +1425,7 @@


### get summary
- my $summary = format_summary($releases, $releases_new, $hot_written,
$db_new, $db_written, $db_expired, $score_killed);
+ my $summary = format_summary($releases, $releases_new, $hot_written,
$db_new, $db_written, $db_expired, $score_killed, $missed_releases);


### get warnings


regards
A.


Date: 2009-05-28 19:52
Sender: mastermitchProject Admin

The freshmeat newsletter format has indeed changed again - Project Tags and
License position have moved.
I'm currently looking into it.


Log in to comment.




Attached File

No Files Currently Attached

Change ( 1 )

Field Old Value Date By
resolution_id None 2009-05-30 20:31 mastermitch