* [PATCH 1/7] lei: allow more mbox inode types
2021-01-20 5:04 6% ` [PATCH 0/7] lei: fixes piled higher and deeper Eric Wong
@ 2021-01-20 5:04 7% ` Eric Wong
1 sibling, 0 replies; 2+ results
From: Eric Wong @ 2021-01-20 5:04 UTC (permalink / raw)
To: meta
We may attempt to write an mbox to any terminal, block, or
character device, not just regular files and FIFOs/pipes.
The only thing that is known to not work is a directory.
Sockets may be possible with some OSes (e.g. Plan 9) or
filesystems. This fixes t/lei.t on FreeBSD 11.x
---
lib/PublicInbox/LeiOverview.pm | 6 ++----
lib/PublicInbox/LeiToMail.pm | 4 ++--
t/lei.t | 2 +-
3 files changed, 5 insertions(+), 7 deletions(-)
diff --git a/lib/PublicInbox/LeiOverview.pm b/lib/PublicInbox/LeiOverview.pm
index dcc3088b..cab2b055 100644
--- a/lib/PublicInbox/LeiOverview.pm
+++ b/lib/PublicInbox/LeiOverview.pm
@@ -42,12 +42,10 @@ sub detect_fmt ($$) {
my ($lei, $dst) = @_;
if ($dst =~ m!\A([:/]+://)!) {
$lei->fail("$1 support not implemented, yet\n");
- } elsif (!-e $dst) {
- 'maildir'; # the default
+ } elsif (!-e $dst || -d _) {
+ 'maildir'; # the default TODO: MH?
} elsif (-f _ || -p _) {
$lei->fail("unable to determine mbox family of $dst\n");
- } elsif (-d _) { # TODO: MH?
- 'maildir';
} else {
$lei->fail("unable to determine format of $dst\n");
}
diff --git a/lib/PublicInbox/LeiToMail.pm b/lib/PublicInbox/LeiToMail.pm
index 49b5c8ab..9d9b5748 100644
--- a/lib/PublicInbox/LeiToMail.pm
+++ b/lib/PublicInbox/LeiToMail.pm
@@ -343,8 +343,8 @@ sub new {
"$dst exists and is not a directory\n";
$lei->{ovv}->{dst} = $dst .= '/' if substr($dst, -1) ne '/';
} elsif (substr($fmt, 0, 4) eq 'mbox') {
- -e $dst && !-f _ && !-p _ and die
- "$dst exists and is not a regular file\n";
+ (-d $dst || (-e _ && !-w _)) and die
+ "$dst exists and is not a writable file\n";
$self->can("eml2$fmt") or die "bad mbox --format=$fmt\n";
$self->{base_type} = 'mbox';
} else {
diff --git a/t/lei.t b/t/lei.t
index 64cb5f0e..d49dc01a 100644
--- a/t/lei.t
+++ b/t/lei.t
@@ -187,7 +187,7 @@ my $test_external = sub {
is($? >> 8, 1, 'errored out with exit 1');
ok(!$lei->(qw(q s:prefix -f mboxcl2 -o), $home), 'bad mbox');
- like($err, qr!\Q$home\E exists and is not a regular file!,
+ like($err, qr!\Q$home\E exists and is not a writable file!,
'error shown');
is($? >> 8, 1, 'errored out with exit 1');
^ permalink raw reply related [relevance 7%]
* [PATCH 0/7] lei: fixes piled higher and deeper
@ 2021-01-20 5:04 6% ` Eric Wong
2021-01-20 5:04 7% ` [PATCH 1/7] lei: allow more mbox inode types Eric Wong
1 sibling, 0 replies; 2+ results
From: Eric Wong @ 2021-01-20 5:04 UTC (permalink / raw)
To: meta
1/7 was necessary on my FreeBSD 11.x VM
2/7 fixes TEST_RUN_MODE=0
3/7 fixes a long-standing (well, several weeks) annoyance
4/7 depended on 3/7, sorta
5/7 should've been done ages ago
6/7 oops :x
7/7 belts and suspenders
Eric Wong (7):
lei: allow more mbox inode types
lei: exit code in oneshot mode
overidx: eidx_prep: fix leftover dbh reference
lei q: cleanup store initialization
lei: dump and clear errors.log in daemon mode
lei_xsearch: keep l2m->{-wq_s1} while preparing query
lei_to_mail: call PublicInbox::IPC::DESTROY
lib/PublicInbox/LEI.pm | 32 +++++++++++++++++++++++++++-----
lib/PublicInbox/LeiOverview.pm | 6 ++----
lib/PublicInbox/LeiQuery.pm | 18 ++++++++----------
lib/PublicInbox/LeiToMail.pm | 5 +++--
lib/PublicInbox/LeiXSearch.pm | 4 ++--
lib/PublicInbox/OverIdx.pm | 8 +++-----
t/lei.t | 8 +++++++-
7 files changed, 52 insertions(+), 29 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-01-19 9:34 [PATCH 0/9] lei bugfixes and error handling Eric Wong
2021-01-20 5:04 6% ` [PATCH 0/7] lei: fixes piled higher and deeper Eric Wong
2021-01-20 5:04 7% ` [PATCH 1/7] lei: allow more mbox inode types 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).