From d87dd0e6795870439422ee4f0039d0d76d1974b3 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Fri, 17 Jul 2020 06:07:10 +0000 Subject: config: reject `\n' in `inboxdir' "\n" and other characters requiring quoting and/or escaping in in $GIT_DIR/objects/info/alternates was not supported in git 2.11 and earlier; nor does it seem supported at all in libgit2. This will allow us to support sharing git-cat-file or similar endpoints across multiple inboxes via alternates. This breaks an existing use case for anybody wacky enough to put `\n' in the `inboxdir' pathname; but I doubt this affects anybody. --- lib/PublicInbox/Config.pm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/PublicInbox/Config.pm b/lib/PublicInbox/Config.pm index c0e2cc57..67199bb3 100644 --- a/lib/PublicInbox/Config.pm +++ b/lib/PublicInbox/Config.pm @@ -393,7 +393,10 @@ sub _fill { # backwards compatibility: $ibx->{inboxdir} //= $self->{"$pfx.mainrepo"}; - + if (($ibx->{inboxdir} // '') =~ /\n/s) { + warn "E: `$ibx->{inboxdir}' must not contain `\\n'\n"; + return; + } foreach my $k (qw(obfuscate)) { my $v = $self->{"$pfx.$k"}; defined $v or next; -- cgit v1.2.3-24-ge0c7