* [PATCH] public-inbox-mda: use <sysexits.h> status codes where applicable
@ 2018-06-12 15:36 Leah Neukirchen
2018-06-13 1:18 ` Eric Wong
2023-11-10 18:43 ` Eric Wong
0 siblings, 2 replies; 4+ messages in thread
From: Leah Neukirchen @ 2018-06-12 15:36 UTC (permalink / raw)
To: meta; +Cc: Leah Neukirchen
Many MTA understand these and map them to sensible SMTP error messages.
Inability to find an inbox results in "5.1.1 user unknown".
Misformatted messages are rejected with "5.6.0 data format error".
Unsupported inbox versions are reported as "5.3.5 local configuration error".
All of these are interpreted as permanent failures.
---
script/public-inbox-mda | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/script/public-inbox-mda b/script/public-inbox-mda
index 766d58a..1f1252a 100755
--- a/script/public-inbox-mda
+++ b/script/public-inbox-mda
@@ -38,8 +38,8 @@ my $config = PublicInbox::Config->new;
my $recipient = $ENV{ORIGINAL_RECIPIENT};
defined $recipient or die "ORIGINAL_RECIPIENT not defined in ENV\n";
my $dst = $config->lookup($recipient); # first check
-defined $dst or do_exit(1);
-my $main_repo = $dst->{mainrepo} or do_exit(1);
+defined $dst or do_exit(67); # EX_NOUSER 5.1.1 user unknown
+my $main_repo = $dst->{mainrepo} or do_exit(67);
# pre-check, MDA has stricter rules than an importer might;
do_exit(0) unless PublicInbox::MDA->precheck($simple, $dst->{address});
@@ -73,7 +73,7 @@ if (ref($ret) && $ret->isa('Email::MIME')) { # filter altered message
} elsif ($ret == PublicInbox::Filter::Base::IGNORE) {
do_exit(0); # chuck it to emergency
} elsif ($ret == PublicInbox::Filter::Base::REJECT) {
- $! = $ret;
+ $! = 65; # EX_DATAERR 5.6.0 data format error
die $filter->err, "\n";
} # else { accept
@@ -88,6 +88,7 @@ if ($v == 2) {
my $git = $dst->git;
$im = PublicInbox::Import->new($git, $dst->{name}, $recipient, $dst);
} else {
+ $! = 78; # EX_CONFIG 5.3.5 local configuration error
die "Unsupported inbox version: $v\n";
}
if (defined $im->add($mime)) {
--
2.17.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] public-inbox-mda: use <sysexits.h> status codes where applicable
2018-06-12 15:36 [PATCH] public-inbox-mda: use <sysexits.h> status codes where applicable Leah Neukirchen
@ 2018-06-13 1:18 ` Eric Wong
2023-11-10 18:43 ` Eric Wong
1 sibling, 0 replies; 4+ messages in thread
From: Eric Wong @ 2018-06-13 1:18 UTC (permalink / raw)
To: Leah Neukirchen; +Cc: meta
Leah Neukirchen <leah@vuxu.org> wrote:
> Many MTA understand these and map them to sensible SMTP error messages.
>
> Inability to find an inbox results in "5.1.1 user unknown".
> Misformatted messages are rejected with "5.6.0 data format error".
> Unsupported inbox versions are reported as "5.3.5 local configuration error".
>
> All of these are interpreted as permanent failures.
Thanks, applied along with the Socket6 mention in INSTALL.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] public-inbox-mda: use <sysexits.h> status codes where applicable
2018-06-12 15:36 [PATCH] public-inbox-mda: use <sysexits.h> status codes where applicable Leah Neukirchen
2018-06-13 1:18 ` Eric Wong
@ 2023-11-10 18:43 ` Eric Wong
2023-11-10 21:32 ` Leah Neukirchen
1 sibling, 1 reply; 4+ messages in thread
From: Eric Wong @ 2023-11-10 18:43 UTC (permalink / raw)
To: Leah Neukirchen; +Cc: meta
Leah Neukirchen <leah@vuxu.org> wrote:
> Many MTA understand these and map them to sensible SMTP error messages.
>
> Inability to find an inbox results in "5.1.1 user unknown".
> Misformatted messages are rejected with "5.6.0 data format error".
> Unsupported inbox versions are reported as "5.3.5 local configuration error".
>
> All of these are interpreted as permanent failures.
Resurrecting an ancient topic...
> diff --git a/script/public-inbox-mda b/script/public-inbox-mda
> index 766d58a..1f1252a 100755
> --- a/script/public-inbox-mda
> +++ b/script/public-inbox-mda
> @@ -38,8 +38,8 @@ my $config = PublicInbox::Config->new;
> my $recipient = $ENV{ORIGINAL_RECIPIENT};
> defined $recipient or die "ORIGINAL_RECIPIENT not defined in ENV\n";
Btw, our current code still dies if ORIGINAL_RECIPIENT is unset
instead of using a sysexit.h code.
Should that be changed to EX_USAGE or EX_NOUSER instead of die?
Since we already use EX_NOUSER right below:
> my $dst = $config->lookup($recipient); # first check
> -defined $dst or do_exit(1);
> -my $main_repo = $dst->{mainrepo} or do_exit(1);
> +defined $dst or do_exit(67); # EX_NOUSER 5.1.1 user unknown
> +my $main_repo = $dst->{mainrepo} or do_exit(67);
Just something I noticed this while making unrelated changes to -mda...
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] public-inbox-mda: use <sysexits.h> status codes where applicable
2023-11-10 18:43 ` Eric Wong
@ 2023-11-10 21:32 ` Leah Neukirchen
0 siblings, 0 replies; 4+ messages in thread
From: Leah Neukirchen @ 2023-11-10 21:32 UTC (permalink / raw)
To: Eric Wong; +Cc: meta
Eric Wong <e@80x24.org> writes:
> Leah Neukirchen <leah@vuxu.org> wrote:
>> Many MTA understand these and map them to sensible SMTP error messages.
>>
>> Inability to find an inbox results in "5.1.1 user unknown".
>> Misformatted messages are rejected with "5.6.0 data format error".
>> Unsupported inbox versions are reported as "5.3.5 local configuration error".
>>
>> All of these are interpreted as permanent failures.
>
> Resurrecting an ancient topic...
>
>> diff --git a/script/public-inbox-mda b/script/public-inbox-mda
>> index 766d58a..1f1252a 100755
>> --- a/script/public-inbox-mda
>> +++ b/script/public-inbox-mda
>> @@ -38,8 +38,8 @@ my $config = PublicInbox::Config->new;
>> my $recipient = $ENV{ORIGINAL_RECIPIENT};
>> defined $recipient or die "ORIGINAL_RECIPIENT not defined in ENV\n";
>
> Btw, our current code still dies if ORIGINAL_RECIPIENT is unset
> instead of using a sysexit.h code.
>
> Should that be changed to EX_USAGE or EX_NOUSER instead of die?
I guess EX_NOUSER is appropriate here.
--
Leah Neukirchen <leah@vuxu.org> https://leahneukirchen.org
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-11-10 21:32 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-12 15:36 [PATCH] public-inbox-mda: use <sysexits.h> status codes where applicable Leah Neukirchen
2018-06-13 1:18 ` Eric Wong
2023-11-10 18:43 ` Eric Wong
2023-11-10 21:32 ` Leah Neukirchen
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).