about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2016-07-27 22:28:26 +0000
committerEric Wong <e@80x24.org>2016-07-27 22:28:51 +0000
commite0b7cf5eb5e6828d07094fa44be67e2d7d63e722 (patch)
tree7e83f74f701cdbf5e6a31520871ab1457813555d
parent6cf4ed00cfe766141572511d4ab2016cd6dafe46 (diff)
downloadpublic-inbox-e0b7cf5eb5e6828d07094fa44be67e2d7d63e722.tar.gz
Callers may have localized $/ to something else, so make sure
we chomp the expected character(s) when calling chomp.
-rw-r--r--lib/PublicInbox/Import.pm1
-rw-r--r--lib/PublicInbox/Inbox.pm2
-rw-r--r--lib/PublicInbox/NNTP.pm1
-rw-r--r--lib/PublicInbox/SaPlugin/ListMirror.pm2
4 files changed, 6 insertions, 0 deletions
diff --git a/lib/PublicInbox/Import.pm b/lib/PublicInbox/Import.pm
index 27f36a7e..bb0811a5 100644
--- a/lib/PublicInbox/Import.pm
+++ b/lib/PublicInbox/Import.pm
@@ -38,6 +38,7 @@ sub gfi_start {
 
         # wait for other processes to be done
         flock($lockfh, LOCK_EX) or die "lock failed: $!\n";
+        local $/ = "\n";
         chomp($self->{tip} = $git->qx(qw(rev-parse --revs-only), $self->{ref}));
 
         my @cmd = ('git', "--git-dir=$git_dir", qw(fast-import
diff --git a/lib/PublicInbox/Inbox.pm b/lib/PublicInbox/Inbox.pm
index 23b77213..4fbbb522 100644
--- a/lib/PublicInbox/Inbox.pm
+++ b/lib/PublicInbox/Inbox.pm
@@ -106,6 +106,7 @@ sub description {
         my $desc = $self->{description};
         return $desc if defined $desc;
         $desc = try_cat("$self->{mainrepo}/description");
+        local $/ = "\n";
         chomp $desc;
         $desc =~ s/\s+/ /smg;
         $desc = '($GIT_DIR/description missing)' if $desc eq '';
@@ -118,6 +119,7 @@ sub cloneurl {
         return $url if $url;
         $url = try_cat("$self->{mainrepo}/cloneurl");
         my @url = split(/\s+/s, $url);
+        local $/ = "\n";
         chomp @url;
         $self->{cloneurl} = \@url;
 }
diff --git a/lib/PublicInbox/NNTP.pm b/lib/PublicInbox/NNTP.pm
index 5b055bca..0c61dd8a 100644
--- a/lib/PublicInbox/NNTP.pm
+++ b/lib/PublicInbox/NNTP.pm
@@ -125,6 +125,7 @@ sub process_line ($$) {
         my $res = eval { $req->($self, @args) };
         my $err = $@;
         if ($err && !$self->{closed}) {
+                local $/ = "\n";
                 chomp($l);
                 err($self, 'error from: %s (%s)', $l, $err);
                 $res = '503 program fault - command not performed';
diff --git a/lib/PublicInbox/SaPlugin/ListMirror.pm b/lib/PublicInbox/SaPlugin/ListMirror.pm
index 10101887..3808196c 100644
--- a/lib/PublicInbox/SaPlugin/ListMirror.pm
+++ b/lib/PublicInbox/SaPlugin/ListMirror.pm
@@ -37,6 +37,7 @@ sub check_list_mirror_received {
         foreach my $cfg (@{$pms->{conf}->{list_mirror_check}}) {
                 my ($hdr, $hval, $host_re, $addr_re) = @$cfg;
                 my $v = $pms->get($hdr) or next;
+                local $/ = "\n";
                 chomp $v;
                 next if $v ne $hval;
                 return 1 if $recvd !~ $host_re;
@@ -53,6 +54,7 @@ sub check_list_mirror_bcc {
                 my ($hdr, $hval, $host_re, $addr_re) = @$cfg;
                 defined $addr_re or next;
                 my $v = $pms->get($hdr) or next;
+                local $/ = "\n";
                 chomp $v;
                 next if $v ne $hval;
                 return 1 if !$tocc || $tocc !~ $addr_re;