Subject: Re: warning: '.desktop' file refers to '', which cannot be found

From: Brendan Tildesley <[email-masked]>
Date: Fri, 9 Apr 2021 13:53:25 +0200 (CEST)

> On 04/09/2021 1:23 PM Pierre Neidhardt <[email-masked]> wrote:
> 
>  
> Thanks for the investigation.  Would you like to send a patch?

I'm not sure what the right way to fix it is. I may have come up with a brilliant idea. Untested patch attached.

From 64c200f3630de13ec3487cb5c756b47b133c6ecf Mon Sep 17 00:00:00 2001
From: Brendan Tildesley <[email-masked]>
Date: Fri, 9 Apr 2021 21:43:54 +1000
Subject: [PATCH] build: gnu-build-system: Improve patch-dot-desktop-files.

* guix/build/gnu-build-system.scm (patch-dot-desktop-files):
When patching .desktop files, Exec= values beginning with '/', (or
spaces or newline characters) will result in the 'binary' symbol
matching an empty string. Changing *, meaning 0 or more, to +, meaning 1
or more ensures it will match a binary of atleast 1 length, or nothing.
---
 guix/build/gnu-build-system.scm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/guix/build/gnu-build-system.scm b/guix/build/gnu-build-system.scm
index 2e7dff2034..99636c442a 100644
--- a/guix/build/gnu-build-system.scm
+++ b/guix/build/gnu-build-system.scm
@@ -725,9 +725,9 @@ which cannot be found~%"
                      ;; UTF-8-encoded.
                      (with-fluids ((%default-port-encoding "UTF-8"))
                        (substitute* files
-                         (("^Exec=([^/[:blank:]\r\n]*)(.*)$" _ binary rest)
+                         (("^Exec=([^/[:blank:]\r\n]+)(.*)$" _ binary rest)
                           (string-append "Exec=" (which binary) rest))
-                         (("^TryExec=([^/[:blank:]\r\n]*)(.*)$" _ binary rest)
+                         (("^TryExec=([^/[:blank:]\r\n]+)(.*)$" _ binary rest)
                           (string-append "TryExec="
                                          (which binary) rest)))))))))
             outputs)
-- 
2.31.1