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-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 03F571FA12 for ; Mon, 4 Jan 2021 04:16:25 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 2/2] lei: improve idempotent "init" error message Date: Mon, 4 Jan 2021 04:16:24 +0000 Message-Id: <20210104041624.17510-3-e@80x24.org> In-Reply-To: <20210104041624.17510-1-e@80x24.org> References: <20210104041624.17510-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: Showing "leistore.dir= already initialized" because $cur is undefined isn't useful. --- lib/PublicInbox/LEI.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/PublicInbox/LEI.pm b/lib/PublicInbox/LEI.pm index 50453dde..9a3b1ee3 100644 --- a/lib/PublicInbox/LEI.pm +++ b/lib/PublicInbox/LEI.pm @@ -505,7 +505,7 @@ sub lei_init { $dir //= _store_path($env); $dir = File::Spec->rel2abs($dir, $env->{PWD}); # PWD is symlink-aware my @cur = stat($cur) if defined($cur); - $cur = File::Spec->canonpath($cur) if $cur; + $cur = File::Spec->canonpath($cur // $dir); my @dir = stat($dir); my $exists = "I: leistore.dir=$cur already initialized" if @dir; if (@cur) {