Eric Bavier <[email protected]> skribis:

> I found an unfortunate bug in the last patch I made to
> patch-makefile-SHELL that would leave a trailing ' ' at the end of SHELL
> assignments.  This is fine for most packages, but caused
> gobject-introspection to fail building for me just now (for the curious:
> it effectively does an "(apply system* (string-split (string-append SHELL
> " " "./libtool") #\space))" which causes sh to try to execute "")

AFAIK trailing whitespace in assignments is ignored by ‘make’.

I grepped gobject-introspection out of curiosity and couldn’t find any
suspicious SHELL assignment.  Do you still have it around?

> --- a/guix/build/utils.scm
> +++ b/guix/build/utils.scm
> @@ -590,7 +590,7 @@ When KEEP-MTIME? is true, the atime/mtime of FILE are 
> kept unchanged."
>            (format (current-error-port)
>                    "patch-makefile-SHELL: ~a: changing `SHELL' from `~a' to 
> `~a'~%"
>                    file old new))
> -        (string-append "SHELL = " new " " args))))
> +        (string-append "SHELL = " new (if (string=? args "\n") "" " ") 
> args))))

The (string=? args "\n") seems specific and non-obvious.

Wouldn’t this work better:

diff --git a/guix/build/utils.scm b/guix/build/utils.scm
index f38b2ca..057dcd2 100644
--- a/guix/build/utils.scm
+++ b/guix/build/utils.scm
@@ -582,7 +582,7 @@ When KEEP-MTIME? is true, the atime/mtime of FILE are kept unchanged."
 
   (let ((st (stat file)))
    (substitute* file
-     (("^ *SHELL[[:blank:]]*=[[:blank:]]*([[:graph:]]*/)([[:graph:]]+)[[:blank:]]*(.*)$"
+     (("^ *SHELL[[:blank:]]*=[[:blank:]]*([[:graph:]]*/)([[:graph:]]+)(.*)$"
        _ dir shell args)
       (let* ((old (string-append dir shell))
              (new (or (find-shell shell) old)))
Thanks,
Ludo’.

Reply via email to