user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download mbox.gz: |
* [PATCH 2/2] xt/lei-auth-fail: use valid label name
  @ 2023-01-29 22:58  7% ` Eric Wong
  0 siblings, 0 replies; 4+ results
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	[relevance 7%]

* [PATCH v2] lei_input: disallow uppercase characters for labels
  2021-10-31  9:10  6% ` [PATCH 2/2] lei_input: disallow uppercase characters for labels Eric Wong
@ 2021-10-31  9:26  6%   ` Eric Wong
  0 siblings, 0 replies; 4+ results
From: Eric Wong @ 2021-10-31  9:26 UTC (permalink / raw)
  To: meta

Xapian boolean terms rely on upper-case prefixes, so the terms
themselves need to be all lowercase.
---
 v2: with test updates, all caps labels never worked for search

 lib/PublicInbox/LeiInput.pm |  2 +-
 t/lei-tag.t                 | 14 +++++++++++---
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/lib/PublicInbox/LeiInput.pm b/lib/PublicInbox/LeiInput.pm
index 84fc579dc480..a1dcc907252f 100644
--- a/lib/PublicInbox/LeiInput.pm
+++ b/lib/PublicInbox/LeiInput.pm
@@ -30,7 +30,7 @@ my %ERR = (
 		my ($label) = @_;
 		length($label) >= $L_MAX and
 			return "`$label' too long (must be <= $L_MAX)";
-		$label =~ m{\A[a-z0-9_](?:[a-z0-9_\-\./\@,]*[a-z0-9])?\z}i ?
+		$label =~ m{\A[a-z0-9_](?:[a-z0-9_\-\./\@,]*[a-z0-9])?\z} ?
 			undef : "`$label' is invalid";
 	},
 	kw => sub {
diff --git a/t/lei-tag.t b/t/lei-tag.t
index 44e4659fc226..5941cd0f3da7 100644
--- a/t/lei-tag.t
+++ b/t/lei-tag.t
@@ -84,11 +84,19 @@ test_lei(sub {
 	lei_ok(qw(ls-label));
 	is($lei_out, "nope\nqp\nurgent\n", 'ls-label shows qp');
 
-	lei_ok qw(tag -F eml t/utf8.eml +L:INBOX +L:x);
+	lei_ok qw(tag -F eml t/utf8.eml +L:inbox +L:x);
 	lei_ok qw(q m:testmessage@example.com);
-	$check_kw->([qw(answered seen)], L => [qw(INBOX nope urgent x)]);
+	$check_kw->([qw(answered seen)], L => [qw(inbox nope urgent x)]);
 	lei_ok(qw(ls-label));
-	is($lei_out, "INBOX\nnope\nqp\nurgent\nx\n", 'ls-label shows qp');
+	is($lei_out, "inbox\nnope\nqp\nurgent\nx\n", 'ls-label shows qp');
+
+	lei_ok qw(q L:inbox);
+	is(json_utf8->decode($lei_out)->[0]->{blob},
+		$r2->[0]->{blob}, 'label search works');
+
+	ok(!lei(qw(tag -F eml t/utf8.eml +L:ALLCAPS)), '+L:ALLCAPS fails');
+	lei_ok(qw(ls-label));
+	is($lei_out, "inbox\nnope\nqp\nurgent\nx\n", 'ls-label unchanged');
 
 	if (0) { # TODO label+kw search w/ externals
 		lei_ok(qw(q L:qp), "mid:$mid", '--only', "$ro_home/t2");

^ permalink raw reply related	[relevance 6%]

* [PATCH 2/2] lei_input: disallow uppercase characters for labels
  2021-10-31  9:10  6% [PATCH 0/2] lei: mail-sync docs + compat fix Eric Wong
@ 2021-10-31  9:10  6% ` Eric Wong
  2021-10-31  9:26  6%   ` [PATCH v2] " Eric Wong
  0 siblings, 1 reply; 4+ results
From: Eric Wong @ 2021-10-31  9:10 UTC (permalink / raw)
  To: meta

Xapian boolean terms rely on upper-case prefixes, so the terms
themselves need to be all lowercase.
---
 lib/PublicInbox/LeiInput.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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

^ permalink raw reply related	[relevance 6%]

* [PATCH 0/2] lei: mail-sync docs + compat fix
@ 2021-10-31  9:10  6% Eric Wong
  2021-10-31  9:10  6% ` [PATCH 2/2] lei_input: disallow uppercase characters for labels Eric Wong
  0 siblings, 1 reply; 4+ results
From: Eric Wong @ 2021-10-31  9:10 UTC (permalink / raw)
  To: meta

Eric Wong (2):
  doc: add lei-mail-sync-overview manpage
  lei_input: disallow uppercase characters for labels

 Documentation/lei-export-kw.pod          |  3 ++
 Documentation/lei-forget-mail-sync.pod   |  5 ++-
 Documentation/lei-import.pod             | 34 +++++++++++++---
 Documentation/lei-index.pod              |  5 ++-
 Documentation/lei-ls-label.pod           |  1 +
 Documentation/lei-ls-mail-source.pod     |  5 ++-
 Documentation/lei-ls-watch.pod           |  3 +-
 Documentation/lei-mail-formats.pod       |  5 ++-
 Documentation/lei-mail-sync-overview.pod | 52 ++++++++++++++++++++++++
 Documentation/lei-overview.pod           | 13 +++++-
 Documentation/lei-tag.pod                | 21 +++++++++-
 Documentation/lei.pod                    |  4 +-
 MANIFEST                                 |  1 +
 Makefile.PL                              |  4 +-
 lib/PublicInbox/LeiInput.pm              |  2 +-
 15 files changed, 137 insertions(+), 21 deletions(-)
 create mode 100644 Documentation/lei-mail-sync-overview.pod

^ permalink raw reply	[relevance 6%]

Results 1-4 of 4 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2021-10-31  9:10  6% [PATCH 0/2] lei: mail-sync docs + compat fix Eric Wong
2021-10-31  9:10  6% ` [PATCH 2/2] lei_input: disallow uppercase characters for labels Eric Wong
2021-10-31  9:26  6%   ` [PATCH v2] " Eric Wong
2023-01-29 22:58     [PATCH 0/2] fix xt/lei-auth-fail.t Eric Wong
2023-01-29 22:58  7% ` [PATCH 2/2] xt/lei-auth-fail: use valid label name 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).