* [bug#70226] [PATCH] scripts: package: Disable searching with the empty string
@ 2024-04-06 1:05 ` Richard Sent
2024-04-30 17:54 ` [bug#70226] Fwd: I haven't been able to trigger this bug Dale Mellor
0 siblings, 1 reply; 3+ messages in thread
From: Richard Sent @ 2024-04-06 1:05 UTC (permalink / raw)
To: 70226
Cc: Richard Sent, Christopher Baines, Josselin Poiret,
Ludovic Courtès, Mathieu Othacehe, Ricardo Wurmus,
Simon Tournier, Tobias Geerinckx-Rice
Reported in <https://issues.guix.gnu.org/70223>.
* guix/scripts/package.scm (process-query): search operating no longer passes
empty strings to make-regexp to avoid unbounded memory usage.
Change-Id: I8194591f0428c4f88fb101c0226b98f593a55709
---
Hi Guix!
Not sure of the usefulness of small patches like this, but figure it
gives me an excuse to trawl the repo and it's better to send it and
not be needed than the inverse.
I considered adding a --force flag to forcefully allow "" searches,
but since multiple scripts use package.scm and there's a lot of CLI
flags already it didn't seem appropriate to add another one,
particularly if it just results in a system freeze.
guix/scripts/package.scm | 2 ++
1 file changed, 2 insertions(+)
diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm
index a489e06e73..66e5384ddc 100644
--- a/guix/scripts/package.scm
+++ b/guix/scripts/package.scm
@@ -891,6 +891,8 @@ (define (process-query opts)
(('search _)
(let* ((patterns (filter-map (match-lambda
+ ;; https://issues.guix.gnu.org/70223
+ (('query 'search "") #f)
(('query 'search rx) rx)
(_ #f))
opts))
base-commit: 886ed061d7c57eb9d707b2af2c87402b86becf70
--
2.41.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [bug#70226] Fwd: I haven't been able to trigger this bug
2024-04-06 1:05 ` [bug#70226] [PATCH] scripts: package: Disable searching with the empty string Richard Sent
@ 2024-04-30 17:54 ` Dale Mellor
2024-04-30 20:20 ` Richard Sent
0 siblings, 1 reply; 3+ messages in thread
From: Dale Mellor @ 2024-04-30 17:54 UTC (permalink / raw)
To: 70226
Can you give a command-line use-case which actually triggers this bug?
Thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [bug#70226] Fwd: I haven't been able to trigger this bug
2024-04-30 17:54 ` [bug#70226] Fwd: I haven't been able to trigger this bug Dale Mellor
@ 2024-04-30 20:20 ` Richard Sent
0 siblings, 0 replies; 3+ messages in thread
From: Richard Sent @ 2024-04-30 20:20 UTC (permalink / raw)
To: Dale Mellor; +Cc: 70226
Hi!
Dale Mellor <guix-devel-0brg6a@rdmp.org> writes:
> Can you give a command-line use-case which actually triggers this bug?
Certainly. I've replicated this issue on guix a1ffa8a with:
$ guix search ""
$ guix system search ""
$ guix home search ""
guix search "" takes ~30 seconds before the bug occurs. (Once the first
result is printed to stdout.) system search and home search are
basically instant. That's probably due to the smaller pool of
candidates.
Working on this a bit more the problem isn't the regex search itself.
Instead, I'm confident it has to do with the highlighting performed by
display-search-results when passed a list containing a "" regex. The
issue does not occur for system search with just the following diff:
--8<---------------cut here---------------start------------->8---
modified guix/scripts/system/search.scm
@@ -189,5 +189,4 @@ (define (guix-system-search . args)
(leave-on-EPIPE
(display-search-results matches (current-output-port)
#:print service-type->recutils
- #:regexps regexps
#:command "guix system search")))))
--8<---------------cut here---------------end--------------->8---
V1 of this patch shouldn't be merged. The bug should be fixed in
display-search-results's highlighting logic instead.
--
Take it easy,
Richard Sent
Making my computer weirder one commit at a time.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-04-30 20:21 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <c8f353af06d4a9291e11a60e96bf5b4bcab7d33e.camel@rdmp.org>
2024-04-06 1:05 ` [bug#70226] [PATCH] scripts: package: Disable searching with the empty string Richard Sent
2024-04-30 17:54 ` [bug#70226] Fwd: I haven't been able to trigger this bug Dale Mellor
2024-04-30 20:20 ` Richard Sent
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.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).