diff mbox series

[bug#70226] scripts: package: Disable searching with the empty string

Message ID 64c782009b2c286cc72513a4a7735bbad650052f.1712365552.git.richard@freakingpenguin.com
State New
Headers show
Series [bug#70226] scripts: package: Disable searching with the empty string | expand

Commit Message

Richard Sent April 6, 2024, 1:05 a.m. UTC
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(+)


base-commit: 886ed061d7c57eb9d707b2af2c87402b86becf70
diff mbox series

Patch

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