* [PATCH 6/9] lei: fix rel2abs
2021-04-16 23:10 6% [PATCH 0/9] lei saved search usability improvements Eric Wong
@ 2021-04-16 23:10 7% ` Eric Wong
0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2021-04-16 23:10 UTC (permalink / raw)
To: meta
We don't want pathnames with "GLOB(0xADD12355)" in them.
---
lib/PublicInbox/LEI.pm | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/lib/PublicInbox/LEI.pm b/lib/PublicInbox/LEI.pm
index 52b588a2..ebd0f154 100644
--- a/lib/PublicInbox/LEI.pm
+++ b/lib/PublicInbox/LEI.pm
@@ -68,18 +68,19 @@ sub rel2abs ($$) {
my ($self, $p) = @_;
return $p if index($p, '/') == 0; # already absolute
my $pwd = $self->{env}->{PWD};
+ my $cwd;
if (defined $pwd) {
- my $cwd = $self->{3} // getcwd() // die "getcwd(PWD=$pwd): $!";
+ my $xcwd = $self->{3} //
+ ($cwd = getcwd() // die "getcwd(PWD=$pwd): $!");
if (my @st_pwd = stat($pwd)) {
- my @st_cwd = stat($cwd) or die "stat($cwd): $!";
+ my @st_cwd = stat($xcwd) or die "stat($xcwd): $!";
"@st_pwd[1,0]" eq "@st_cwd[1,0]" or
- $self->{env}->{PWD} = $pwd = $cwd;
+ $self->{env}->{PWD} = $pwd = undef;
} else { # PWD was invalid
- delete $self->{env}->{PWD};
- undef $pwd;
+ $self->{env}->{PWD} = $pwd = undef;
}
}
- $pwd //= $self->{env}->{PWD} = getcwd() // die "getcwd(PWD=$pwd): $!";
+ $pwd //= $self->{env}->{PWD} = $cwd // getcwd() // die "getcwd: $!";
File::Spec->rel2abs($p, $pwd);
}
^ permalink raw reply related [relevance 7%]
* [PATCH 0/9] lei saved search usability improvements
@ 2021-04-16 23:10 6% Eric Wong
2021-04-16 23:10 7% ` [PATCH 6/9] lei: fix rel2abs Eric Wong
0 siblings, 1 reply; 2+ results
From: Eric Wong @ 2021-04-16 23:10 UTC (permalink / raw)
To: meta
Found a few bugfixes along the way, but after thinking it over,
I think "lei up /path/to/maildir/or/mbox/or/IMAP-URI" makes the
most sense.
Eric Wong (9):
lei q: --save preserves relative time queries
lei: expose share_path as a method
lei: saved searches keyed only by path/URL and format
lei_to_mail: cast to URIimap object early
test_common: handle '-C' (chdir) spawn option properly
lei: fix rel2abs
lei up: support output destination as arg
lei q --save: avoid lei.q.format
lei q --save: clobber config file on repeats
lib/PublicInbox/Config.pm | 9 ++++
lib/PublicInbox/LEI.pm | 19 +++++----
lib/PublicInbox/LeiQuery.pm | 2 +-
lib/PublicInbox/LeiSavedSearch.pm | 71 ++++++++++++++++++++++++-------
lib/PublicInbox/LeiToMail.pm | 12 +++---
lib/PublicInbox/LeiUp.pm | 5 +--
lib/PublicInbox/Reply.pm | 10 +----
lib/PublicInbox/TestCommon.pm | 7 +++
t/lei-q-save.t | 36 ++++++++++++++--
9 files changed, 126 insertions(+), 45 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 --
2021-04-16 23:10 6% [PATCH 0/9] lei saved search usability improvements Eric Wong
2021-04-16 23:10 7% ` [PATCH 6/9] lei: fix rel2abs 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).