unofficial mirror of meta@public-inbox.org
 help / color / mirror / Atom feed
* [PATCH 0/2] fix xt/lei-auth-fail.t
@ 2023-01-29 22:58 Eric Wong
  2023-01-29 22:58 ` [PATCH 1/2] lei_input: give a hint for upper-case in labels Eric Wong
  2023-01-29 22:58 ` [PATCH 2/2] xt/lei-auth-fail: use valid label name Eric Wong
  0 siblings, 2 replies; 3+ messages in thread
From: Eric Wong @ 2023-01-29 22:58 UTC (permalink / raw)
  To: meta

I need a failing mock IMAP server for this, or remember xt/ exists :<

Eric Wong (2):
  lei_input: give a hint for upper-case in labels
  xt/lei-auth-fail: use valid label name

 lib/PublicInbox/LeiInput.pm | 2 ++
 xt/lei-auth-fail.t          | 7 ++++---
 2 files changed, 6 insertions(+), 3 deletions(-)

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/2] lei_input: give a hint for upper-case in labels
  2023-01-29 22:58 [PATCH 0/2] fix xt/lei-auth-fail.t Eric Wong
@ 2023-01-29 22:58 ` Eric Wong
  2023-01-29 22:58 ` [PATCH 2/2] xt/lei-auth-fail: use valid label name Eric Wong
  1 sibling, 0 replies; 3+ messages in thread
From: Eric Wong @ 2023-01-29 22:58 UTC (permalink / raw)
  To: meta

I just encountered this error in xt/lei-auth-fail.t
---
 lib/PublicInbox/LeiInput.pm | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/PublicInbox/LeiInput.pm b/lib/PublicInbox/LeiInput.pm
index c258f824..b6c2b6bb 100644
--- a/lib/PublicInbox/LeiInput.pm
+++ b/lib/PublicInbox/LeiInput.pm
@@ -30,6 +30,8 @@ my %ERR = (
 		my ($label) = @_;
 		length($label) >= $L_MAX and
 			return "`$label' too long (must be <= $L_MAX)";
+		$label =~ /[A-Z]/ and
+			return "`$label' must be lowercase";
 		$label =~ m{\A[a-z0-9_](?:[a-z0-9_\-\./\@,]*[a-z0-9])?\z} ?
 			undef : "`$label' is invalid";
 	},

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] xt/lei-auth-fail: use valid label name
  2023-01-29 22:58 [PATCH 0/2] fix xt/lei-auth-fail.t Eric Wong
  2023-01-29 22:58 ` [PATCH 1/2] lei_input: give a hint for upper-case in labels Eric Wong
@ 2023-01-29 22:58 ` Eric Wong
  1 sibling, 0 replies; 3+ messages in thread
From: Eric Wong @ 2023-01-29 22:58 UTC (permalink / raw)
  To: meta

Uppercase characters aren't allowed for labels due to Xapian
boolean limitations, so we need to use lowercase labels.

Fixes: 27015c3365fd0690 (lei_input: disallow uppercase characters for labels, 2021-10-31)
---
 xt/lei-auth-fail.t | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/xt/lei-auth-fail.t b/xt/lei-auth-fail.t
index 06cb8533..1ccc2ab2 100644
--- a/xt/lei-auth-fail.t
+++ b/xt/lei-auth-fail.t
@@ -1,7 +1,8 @@
 #!perl -w
-# Copyright (C) 2021 all contributors <meta@public-inbox.org>
+# Copyright (C) all contributors <meta@public-inbox.org>
 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
-use strict; use v5.10.1; use PublicInbox::TestCommon;
+use v5.12;
+use PublicInbox::TestCommon;
 require_mods(qw(Mail::IMAPClient lei));
 
 # TODO: mock IMAP server which fails at authentication so we don't
@@ -13,7 +14,7 @@ test_lei(sub {
 	for my $pfx ([qw(q z:0.. --only), "$ro_home/t1", '-o'],
 			[qw(convert -o mboxrd:/dev/stdout)],
 			[qw(convert t/utf8.eml -o), $imap_fail],
-			['import'], [qw(tag +L:INBOX)]) {
+			['import'], [qw(tag +L:inbox)]) {
 		ok(!lei(@$pfx, $imap_fail), "IMAP auth failure on @$pfx");
 		like($lei_err, qr!\bE:.*?imaps?://.*?!sm, 'error shown');
 		unlike($lei_err, qr!Hunter2!s, 'password not shown');

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-01-29 22:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-29 22:58 [PATCH 0/2] fix xt/lei-auth-fail.t Eric Wong
2023-01-29 22:58 ` [PATCH 1/2] lei_input: give a hint for upper-case in labels Eric Wong
2023-01-29 22:58 ` [PATCH 2/2] xt/lei-auth-fail: use valid label name Eric Wong

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).