File: fix_messageparser_interaction

package info (click to toggle)
libmail-mboxparser-perl 0.55-5
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 440 kB
  • sloc: perl: 1,011; makefile: 2
file content (34 lines) | stat: -rw-r--r-- 817 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
fix_messageparser_interaction

Fix hang during t/3_while test with recent Mail::Mbox::MessageParser.
See Debian bug #395268.
Patch by David Coppit <david@coppit.org>

--- a/MboxParser.pm
+++ b/MboxParser.pm
@@ -519,7 +519,6 @@
 
     return undef if ref(\$p) eq 'SCALAR' or $p->end_of_file;
 
-    seek $self->{READER}, $self->{CURR_POS}, SEEK_SET;
     my $nl = $self->{NL};
     my $mailref = $p->read_next_email;
     my ($header, $body) = split /$nl$nl/, $$mailref, 2;
@@ -793,7 +792,8 @@
     my $self = shift;
     my $h = $self->{READER};
     my $newline;
-    
+
+    my $old_position = tell $h;
     seek $h, 0, SEEK_SET;
     while (sysread $h, (my $c), 1) {
         if (ord($c) == 13) {
@@ -807,6 +807,7 @@
             last;
         }
     }
+    seek($h, $old_position, 0);
     return $newline;
 }