lib/PublicInbox/Config.pm | 1 + lib/PublicInbox/Daemon.pm | 1 + lib/PublicInbox/Feed.pm | 2 ++ lib/PublicInbox/Git.pm | 1 + lib/PublicInbox/SearchIdx.pm | 2 ++ t/httpd-corner.psgi | 2 ++ t/httpd-unix.t | 1 + diff --git a/lib/PublicInbox/Config.pm b/lib/PublicInbox/Config.pm index b5f0fcb1d8ef7a0b3ebdd7537748d7b51dc0e462..b38f444362c9b513561d3f2eafe5f65e23443682 100644 --- a/lib/PublicInbox/Config.pm +++ b/lib/PublicInbox/Config.pm @@ -80,6 +80,7 @@ my $cmd = join(' ', @cmd); my $pid = open(my $fh, '-|', @cmd); defined $pid or die "$cmd failed: $!"; my %rv; + local $/ = "\n"; foreach my $line (<$fh>) { chomp $line; my ($k, $v) = split(/=/, $line, 2); diff --git a/lib/PublicInbox/Daemon.pm b/lib/PublicInbox/Daemon.pm index 8de7ff24612881cd43babdc23f5c9120b2f2a702..dc810106563d81c9fdc5c7aa110182bc93cc8e77 100644 --- a/lib/PublicInbox/Daemon.pm +++ b/lib/PublicInbox/Daemon.pm @@ -350,6 +350,7 @@ my ($unlink_pid, $file) = @_; return unless defined $unlink_pid && $unlink_pid == $$; open my $fh, '<', $file or return; + local $/ = "\n"; defined(my $read_pid = <$fh>) or return; chomp $read_pid; if ($read_pid == $unlink_pid) { diff --git a/lib/PublicInbox/Feed.pm b/lib/PublicInbox/Feed.pm index e2df97b142fa59d8a9c56461c4429f12a69fcac7..6ed0085630825fd985564d4c0cf0d202ddcf556d 100644 --- a/lib/PublicInbox/Feed.pm +++ b/lib/PublicInbox/Feed.pm @@ -224,6 +224,7 @@ my $last; my $nr = 0; my ($cur_commit, $first_commit, $last_commit); my ($ts, $subj, $u); + local $/ = "\n"; while (defined(my $line = <$log>)) { if ($line =~ /$addmsg/o) { my $add = $1; @@ -244,6 +245,7 @@ } } if ($last) { + local $/ = "\n"; while (my $line = <$log>) { if ($line =~ /^(${hex}{7,40})/o) { $last_commit = $1; diff --git a/lib/PublicInbox/Git.pm b/lib/PublicInbox/Git.pm index 473cdffa88d4c5d96230c308815fa0b74ea894dc..bc0e5064d7ca5da0e69febb7076d3639baa2c79b 100644 --- a/lib/PublicInbox/Git.pm +++ b/lib/PublicInbox/Git.pm @@ -122,6 +122,7 @@ sub qx { my ($self, @cmd) = @_; my $fh = $self->popen(@cmd); + local $/ = "\n"; return <$fh> if wantarray; local $/; <$fh> diff --git a/lib/PublicInbox/SearchIdx.pm b/lib/PublicInbox/SearchIdx.pm index 9192bb07270d87abc7935e6220b932e2c70095a5..4a4b2bdbc67201a84aea9343b72f1b5fc3f73175 100644 --- a/lib/PublicInbox/SearchIdx.pm +++ b/lib/PublicInbox/SearchIdx.pm @@ -338,6 +338,7 @@ my $log = $git->popen(qw/log --reverse --no-notes --no-color --raw -r --no-abbrev/, $range); my $latest; my $bytes; + local $/ = "\n"; while (defined(my $line = <$log>)) { if ($line =~ /$addmsg/o) { my $mime = do_cat_mail($git, $1, \$bytes) or next; @@ -445,6 +446,7 @@ sub _read_git_config_perm { my ($self) = @_; my @cmd = qw(config core.sharedRepository); my $fh = PublicInbox::Git->new($self->{git_dir})->popen(@cmd); + local $/ = "\n"; my $perm = <$fh>; chomp $perm if defined $perm; $perm; diff --git a/t/httpd-corner.psgi b/t/httpd-corner.psgi index 2f7be8320eaf518cb2772e7a53519df6f245f7c2..222b9e01a058bd82cd102ba46a03957de92c4eef 100644 --- a/t/httpd-corner.psgi +++ b/t/httpd-corner.psgi @@ -30,6 +30,7 @@ if ($path eq '/slow-header') { return sub { open my $f, '<', $fifo or die "open $fifo: $!\n"; + local $/ = "\n"; my @r = <$f>; $_[0]->([200, $h, \@r ]); }; @@ -38,6 +39,7 @@ return sub { my $fh = $_[0]->([200, $h]); open my $f, '<', $fifo or die "open $fifo: $!\n"; + local $/ = "\n"; while (defined(my $l = <$f>)) { $fh->write($l); } diff --git a/t/httpd-unix.t b/t/httpd-unix.t index 00adf13ca9db980aa733f57869f4255747217451..16f7bdd2e9a9bac5899e552c1c02e38db1a56c65 100644 --- a/t/httpd-unix.t +++ b/t/httpd-unix.t @@ -103,6 +103,7 @@ check_sock($unix); ok(-f "$tmpdir/pid", 'pid file written'); open my $fh, '<', "$tmpdir/pid" or die "open failed: $!"; + local $/ = "\n"; my $rpid = <$fh>; chomp $rpid; like($rpid, qr/\A\d+\z/s, 'pid file looks like a pid');