From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id B37BB1F934 for ; Sat, 11 Sep 2021 00:19:17 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 2/3] lei: pass client stderr to git-config in more places Date: Sat, 11 Sep 2021 00:19:16 +0000 Message-Id: <20210911001917.1310-3-e@80x24.org> In-Reply-To: <20210911001917.1310-1-e@80x24.org> References: <20210911001917.1310-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: This should improve the users' chances of seeing errors in various git config files we use. --- lib/PublicInbox/Config.pm | 4 ++-- lib/PublicInbox/LEI.pm | 2 +- lib/PublicInbox/LeiMirror.pm | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/PublicInbox/Config.pm b/lib/PublicInbox/Config.pm index 74a1a6f5..ee5322fe 100644 --- a/lib/PublicInbox/Config.pm +++ b/lib/PublicInbox/Config.pm @@ -19,7 +19,7 @@ sub _array ($) { ref($_[0]) eq 'ARRAY' ? $_[0] : [ $_[0] ] } # returns key-value pairs of config directives in a hash # if keys may be multi-value, the value is an array ref containing all values sub new { - my ($class, $file) = @_; + my ($class, $file, $errfh) = @_; $file //= default_file(); my $self; if (ref($file) eq 'SCALAR') { # used by some tests @@ -27,7 +27,7 @@ sub new { $self = config_fh_parse($fh, "\n", '='); bless $self, $class; } else { - $self = git_config_dump($class, $file); + $self = git_config_dump($class, $file, $errfh); $self->{'-f'} = $file; } # caches diff --git a/lib/PublicInbox/LEI.pm b/lib/PublicInbox/LEI.pm index 0b4c99dc..aff2bf19 100644 --- a/lib/PublicInbox/LEI.pm +++ b/lib/PublicInbox/LEI.pm @@ -820,7 +820,7 @@ sub _lei_cfg ($;$) { $cur_st = pack('dd', $st[10], $st[7]); qerr($self, "# $f created") if $self->{cmd} ne 'config'; } - my $cfg = PublicInbox::Config->git_config_dump($f); + my $cfg = PublicInbox::Config->git_config_dump($f, $self->{2}); $cfg->{-st} = $cur_st; $cfg->{'-f'} = $f; if ($sto && canonpath_harder($sto_dir // store_path($self)) diff --git a/lib/PublicInbox/LeiMirror.pm b/lib/PublicInbox/LeiMirror.pm index 638add42..8689b825 100644 --- a/lib/PublicInbox/LeiMirror.pm +++ b/lib/PublicInbox/LeiMirror.pm @@ -110,7 +110,7 @@ sub _try_config { } return $lei->err("# @$cmd failed (non-fatal)") if $cerr; rename($f, $ce) or return $lei->err("link($f, $ce): $! (non-fatal)"); - my $cfg = PublicInbox::Config->git_config_dump($f); + my $cfg = PublicInbox::Config->git_config_dump($f, $lei->{2}); my $ibx = $self->{ibx} = {}; for my $sec (grep(/\Apublicinbox\./, @{$cfg->{-section_order}})) { for (qw(address newsgroup nntpmirror)) { @@ -136,7 +136,7 @@ sub index_cloned_inbox { } # force synchronous dwaitpid for v2: local $PublicInbox::DS::in_loop = 0; - my $cfg = PublicInbox::Config->new; + my $cfg = PublicInbox::Config->new(undef, $lei->{2}); my $env = PublicInbox::Admin::index_prepare($opt, $cfg); local %ENV = (%ENV, %$env) if $env; PublicInbox::Admin::progress_prepare($opt, $lei->{2});