* [PATCH 1/2] lei: stricter external checks for valid $GIT_DIR/objects
2022-12-01 11:21 6% [PATCH 0/2] lei - expanding relative paths for `lei up' Eric Wong
@ 2022-12-01 11:21 7% ` Eric Wong
0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2022-12-01 11:21 UTC (permalink / raw)
To: meta
I ended up with my $HOME in
~/.cache/lei/all_locals_ever.git/objects/info/alterntes
and am trying to avoid that in the future.
---
lib/PublicInbox/LeiXSearch.pm | 5 +++--
t/lei.t | 3 ++-
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/lib/PublicInbox/LeiXSearch.pm b/lib/PublicInbox/LeiXSearch.pm
index 90cb83b9..8e195c4c 100644
--- a/lib/PublicInbox/LeiXSearch.pm
+++ b/lib/PublicInbox/LeiXSearch.pm
@@ -617,11 +617,12 @@ sub prepare_external {
} elsif ($loc =~ m!\Ahttps?://!) {
require URI;
return add_uri($self, URI->new($loc));
- } elsif (-f "$loc/ei.lock") {
+ } elsif (-f "$loc/ei.lock" && -d "$loc/ALL.git/objects") {
require PublicInbox::ExtSearch;
die "`\\n' not allowed in `$loc'\n" if index($loc, "\n") >= 0;
$loc = PublicInbox::ExtSearch->new($loc);
- } elsif (-f "$loc/inbox.lock" || -d "$loc/public-inbox") {
+ } elsif ((-f "$loc/inbox.lock" && -d "$loc/all.git/objects") ||
+ (-d "$loc/public-inbox" && -d "$loc/objects")) {
die "`\\n' not allowed in `$loc'\n" if index($loc, "\n") >= 0;
require PublicInbox::Inbox; # v2, v1
$loc = bless { inboxdir => $loc }, 'PublicInbox::Inbox';
diff --git a/t/lei.t b/t/lei.t
index b10c9b59..a80143ef 100644
--- a/t/lei.t
+++ b/t/lei.t
@@ -148,7 +148,8 @@ my $test_fail = sub {
for my $lk (qw(ei inbox)) {
my $d = "$home/newline\n$lk";
- mkdir $d;
+ my $all = $lk eq 'ei' ? 'ALL' : 'all';
+ File::Path::mkpath("$d/$all.git/objects");
open my $fh, '>', "$d/$lk.lock" or BAIL_OUT "open $d/$lk.lock";
for my $fl (qw(-I --only)) {
ok(!lei('q', $fl, $d, 'whatever'),
^ permalink raw reply related [relevance 7%]
* [PATCH 0/2] lei - expanding relative paths for `lei up'
@ 2022-12-01 11:21 6% Eric Wong
2022-12-01 11:21 7% ` [PATCH 1/2] lei: stricter external checks for valid $GIT_DIR/objects Eric Wong
0 siblings, 1 reply; 2+ results
From: Eric Wong @ 2022-12-01 11:21 UTC (permalink / raw)
To: meta
I ran `lei q --only ./ -o $MAILDIR $QUERY' at some point from
inside an inboxdir.
Then I got confused when `lei up --all' running from $HOME
started complaining about $HOME/objects being missing from ALE.
It turned out $HOME/public-inbox (one of my worktrees) was
causing $HOME to false-positive as a v1 public-inbox for lei :x.
So this is a two-pronged fix to prevent some weird stuff from
happening.
Eric Wong (2):
lei: stricter external checks for valid $GIT_DIR/objects
lei_saved_search: expand only/include/exclude to absolute paths
lib/PublicInbox/LeiQuery.pm | 23 ++++++++++++++++++++---
lib/PublicInbox/LeiXSearch.pm | 14 ++++++++++----
t/lei-q-save.t | 13 +++++++++----
t/lei.t | 3 ++-
4 files changed, 41 insertions(+), 12 deletions(-)
^ permalink raw reply [relevance 6%]
Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2022-12-01 11:21 6% [PATCH 0/2] lei - expanding relative paths for `lei up' Eric Wong
2022-12-01 11:21 7% ` [PATCH 1/2] lei: stricter external checks for valid $GIT_DIR/objects Eric Wong
Code repositories for project(s) associated with this public inbox
https://80x24.org/public-inbox.git
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).