unofficial mirror of meta@public-inbox.org
 help / color / mirror / Atom feed
From: ebiederm@xmission.com (Eric W. Biederman)
To: Eric Wong <e@80x24.org>
Cc: <meta@public-inbox.org>
Subject: [PATCH] PublicInbox::Inbox.pm: Default unset address to a one element array
Date: Fri, 15 May 2020 16:11:47 -0500	[thread overview]
Message-ID: <871rnkc38s.fsf@x220.int.ebiederm.org> (raw)


PublicInbox::Config.pm::_fill() assumes that address is an array.
Therefore when handling an unset address use an array containing a
single string, instead of a single string.

Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
---

I accidentially created a public inbox without an address at some
point and had some nasty errors because the default value
we game to address is not an array.

 lib/PublicInbox/Inbox.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/PublicInbox/Inbox.pm b/lib/PublicInbox/Inbox.pm
index 617b692b14ca..002b980f4057 100644
--- a/lib/PublicInbox/Inbox.pm
+++ b/lib/PublicInbox/Inbox.pm
@@ -102,7 +102,7 @@ sub _set_limiter ($$$) {
 
 sub new {
 	my ($class, $opts) = @_;
-	my $v = $opts->{address} ||= 'public-inbox@example.com';
+	my $v = $opts->{address} ||= [ 'public-inbox@example.com' ];
 	my $p = $opts->{-primary_address} = ref($v) eq 'ARRAY' ? $v->[0] : $v;
 	$opts->{domain} = ($p =~ /\@(\S+)\z/) ? $1 : 'localhost';
 	my $pi_config = delete $opts->{-pi_config};
-- 
2.20.1


             reply	other threads:[~2020-05-15 21:15 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-15 21:11 Eric W. Biederman [this message]
2020-05-16  7:42 ` [PATCH] PublicInbox::Inbox.pm: Default unset address to a one element array Eric Wong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://public-inbox.org/README

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=871rnkc38s.fsf@x220.int.ebiederm.org \
    --to=ebiederm@xmission.com \
    --cc=e@80x24.org \
    --cc=meta@public-inbox.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).