* [PATCH 0/4] "lei q" rawstr fallout + fixes
@ 2021-11-10 10:25 6% Eric Wong
2021-11-10 10:28 7% ` [PATCH 3/4] lei q: disallow "\n" in argv[] elements 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%]
* [PATCH 3/4] lei q: disallow "\n" in argv[] elements
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
I don't expect this to be hit in real-world use via normal
interactive shells. However, somebody could accidentally add
"\n" in languages (e.g. Perl, C) where it's easy to pass "\n"
in argv[].
---
lib/PublicInbox/LeiQuery.pm | 1 +
t/lei.t | 3 +++
2 files changed, 4 insertions(+)
diff --git a/lib/PublicInbox/LeiQuery.pm b/lib/PublicInbox/LeiQuery.pm
index 352ee60131aa..51ee3d9c83e4 100644
--- a/lib/PublicInbox/LeiQuery.pm
+++ b/lib/PublicInbox/LeiQuery.pm
@@ -141,6 +141,7 @@ no query allowed on command-line with --stdin
PublicInbox::InputPipe::consume($self->{0}, \&qstr_add, $self);
return;
}
+ chomp(@argv) and $self->qerr("# trailing `\\n' removed");
$mset_opt{q_raw} = [ @argv ]; # copy
$mset_opt{qstr} =
$self->{lse}->query_argv_to_string($self->{lse}->git, \@argv);
diff --git a/t/lei.t b/t/lei.t
index f7de1b711a83..b10c9b59c72b 100644
--- a/t/lei.t
+++ b/t/lei.t
@@ -143,6 +143,9 @@ my $test_fail = sub {
lei('-C', '/dev/null', 'q', 'whatever');
is($? >> 8, 1, 'chdir at beginning fails to /dev/null');
+ lei_ok('q', "foo\n");
+ like($lei_err, qr/trailing `\\n' removed/s, "noted `\\n' removal");
+
for my $lk (qw(ei inbox)) {
my $d = "$home/newline\n$lk";
mkdir $d;
^ permalink raw reply related [relevance 7%]
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 3/4] lei q: disallow "\n" in argv[] elements 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).