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/4] lei up: infer rawstr from old searches via trailing "\n"
  2021-11-10 10:25  6% [PATCH 0/4] "lei q" rawstr fallout + fixes Eric Wong
@ 2021-11-10 10:28  7% ` Eric Wong
  0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2021-11-10 10:28 UTC (permalink / raw)
  To: meta

For --stdin searches created prior to commit 666dde69a3f6 (lei
q|up: fix saved searches for single-phrase search, 2021-11-08)
we still want to be able to run "lei up" on them without
regressions.  So assume nobody manages to enter "\n" as an
argv[] element and consider the presence of "\n" as a previous
--stdin use.

This fixes errors from "lei up" such as:

  lei_xsearch 2 wq_worker: Exception: Key too long: length was 840 bytes,
  maximum length of a key is 255 bytes at ../PublicInbox/IPC.pm line 250.

Fixes: 666dde69a3f6 ("lei q|up: fix saved searches for single-phrase search")
---
 lib/PublicInbox/LeiUp.pm | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/PublicInbox/LeiUp.pm b/lib/PublicInbox/LeiUp.pm
index d7873a3f3469..b8a9836075ba 100644
--- a/lib/PublicInbox/LeiUp.pm
+++ b/lib/PublicInbox/LeiUp.pm
@@ -29,7 +29,9 @@ sub up1 ($$) {
 	my $q = $lss->{-cfg}->get_all('lei.q') //
 				die("lei.q unset in $f (out=$out)\n");
 	my $lse = $lei->{lse} // die 'BUG: {lse} missing';
-	if ($lss->{-cfg}->{'lei.internal.rawstr'}) {
+	my $rawstr = $lss->{-cfg}->{'lei.internal.rawstr'} //
+		(scalar(@$q) == 1 && substr($q->[0], -1) eq "\n");
+	if ($rawstr) {
 		scalar(@$q) > 1 and
 			die "$f: lei.q has multiple values (@$q) (out=$out)\n";
 		$lse->query_approxidate($lse->git, $mset_opt->{qstr} = $q->[0]);

^ permalink raw reply related	[relevance 7%]

* [PATCH 0/4] "lei q" rawstr fallout + fixes
@ 2021-11-10 10:25  6% Eric Wong
  2021-11-10 10:28  7% ` [PATCH 2/4] lei up: infer rawstr from old searches via trailing "\n" Eric Wong
  0 siblings, 1 reply; 2+ results
From: Eric Wong @ 2021-11-10 10:25 UTC (permalink / raw)
  To: meta

The recent rawstr fix caused some errors for existing
--stdin searches, these patches fix them and make some
minor improvements along the way.

Eric Wong (4):
  ipc: note failing sub name
  lei up: infer rawstr from old searches via trailing "\n"
  lei q: disallow "\n" in argv[] elements
  lei q: make HTTP(S) query strings even less ugly

 lib/PublicInbox/IPC.pm        | 2 +-
 lib/PublicInbox/LeiQuery.pm   | 1 +
 lib/PublicInbox/LeiUp.pm      | 4 +++-
 lib/PublicInbox/LeiXSearch.pm | 2 +-
 t/lei.t                       | 3 +++
 5 files changed, 9 insertions(+), 3 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-11-10 10:25  6% [PATCH 0/4] "lei q" rawstr fallout + fixes Eric Wong
2021-11-10 10:28  7% ` [PATCH 2/4] lei up: infer rawstr from old searches via trailing "\n" 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).