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. --- t/init.t | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 't/init.t') diff --git a/t/init.t b/t/init.t index 5c021be7..b8f17b5c 100644 --- a/t/init.t +++ b/t/init.t @@ -49,6 +49,14 @@ sub quiet_fail { ok(unlink("$cfgfile.lock"), '-init did not unlink lock on failure'); } +{ + my $rdr = { 2 => \(my $err = '') }; + my $cmd = [ '-init', 'alist', "$tmpdir/a\nlist", + qw(http://example.com/alist alist@example.com) ]; + ok(!run_script($cmd, undef, $rdr), + 'public-inbox-init rejects LF in inboxdir'); + like($err, qr/`\\n' not allowed in `/s, 'reported \\n'); +} SKIP: { require_mods(qw(DBD::SQLite Search::Xapian::WritableDatabase), 2); -- cgit v1.2.3-24-ge0c7