unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH] utils: Clean trailing whitespace at end of SHELL
@ 2014-09-04 14:27 Eric Bavier
  2014-09-04 19:31 ` Ludovic Courtès
  0 siblings, 1 reply; 4+ messages in thread
From: Eric Bavier @ 2014-09-04 14:27 UTC (permalink / raw)
  To: guix-devel

[-- Attachment #1: Type: text/plain, Size: 462 bytes --]

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

The attached patch to core-updates should remedy the problem.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-utils-Clean-trailing-whitespace-at-end-of-SHELL.patch --]
[-- Type: text/x-diff, Size: 969 bytes --]

From c2467a4504737c13435304b1e5c7eb7e4ebf7b70 Mon Sep 17 00:00:00 2001
From: Eric Bavier <bavier@member.fsf.org>
Date: Thu, 4 Sep 2014 09:19:24 -0500
Subject: [PATCH] utils: Clean trailing whitespace at end of SHELL

* guix/build/utils.scm (patch-makefile-SHELL): Remove trailing whitespace.
---
 guix/build/utils.scm |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/guix/build/utils.scm b/guix/build/utils.scm
index f38b2ca..d6365c0 100644
--- 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))))
 
    (when keep-mtime?
      (set-file-time file st))))
-- 
1.7.9.5


[-- Attachment #3: Type: text/plain, Size: 17 bytes --]


-- 
Eric Bavier

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] utils: Clean trailing whitespace at end of SHELL
  2014-09-04 14:27 [PATCH] utils: Clean trailing whitespace at end of SHELL Eric Bavier
@ 2014-09-04 19:31 ` Ludovic Courtès
  2014-09-05  5:05   ` Eric Bavier
  0 siblings, 1 reply; 4+ messages in thread
From: Ludovic Courtès @ 2014-09-04 19:31 UTC (permalink / raw)
  To: Eric Bavier; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 1225 bytes --]

Eric Bavier <ericbavier@gmail.com> 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:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 572 bytes --]

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

[-- Attachment #3: Type: text/plain, Size: 21 bytes --]


Thanks,
Ludo’.

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] utils: Clean trailing whitespace at end of SHELL
  2014-09-04 19:31 ` Ludovic Courtès
@ 2014-09-05  5:05   ` Eric Bavier
  2014-09-05  8:11     ` Ludovic Courtès
  0 siblings, 1 reply; 4+ messages in thread
From: Eric Bavier @ 2014-09-05  5:05 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 941 bytes --]


Ludovic Courtès writes:

> Eric Bavier <ericbavier@gmail.com> 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?

E.g. gobject-introspection-1.38.0/giscanner/utils.py:124

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

I thought so too.  Your suggestion does work.  With this patch, I was
able to bootstrap and build gobject-introspection.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-utils-Clean-trailing-whitespace-at-end-of-SHELL.patch --]
[-- Type: text/x-diff, Size: 1371 bytes --]

From 11459384968f654c42ad7dba4443dada35191f5b Mon Sep 17 00:00:00 2001
From: Eric Bavier <bavier@member.fsf.org>
Date: Thu, 4 Sep 2014 09:19:24 -0500
Subject: [PATCH] utils: Clean trailing whitespace at end of SHELL

* guix/build/utils.scm (patch-makefile-SHELL): Remove trailing whitespace.
---
 guix/build/utils.scm |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/guix/build/utils.scm b/guix/build/utils.scm
index f38b2ca..d169053 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)))
@@ -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 args))))
 
    (when keep-mtime?
      (set-file-time file st))))
-- 
1.7.9.5


[-- Attachment #3: Type: text/plain, Size: 17 bytes --]


-- 
Eric Bavier

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] utils: Clean trailing whitespace at end of SHELL
  2014-09-05  5:05   ` Eric Bavier
@ 2014-09-05  8:11     ` Ludovic Courtès
  0 siblings, 0 replies; 4+ messages in thread
From: Ludovic Courtès @ 2014-09-05  8:11 UTC (permalink / raw)
  To: Eric Bavier; +Cc: guix-devel

Eric Bavier <ericbavier@gmail.com> skribis:

> Ludovic Courtès writes:
>
>> Eric Bavier <ericbavier@gmail.com> 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?
>
> E.g. gobject-introspection-1.38.0/giscanner/utils.py:124

Oh, I see.

>> The (string=? args "\n") seems specific and non-obvious.
>
> I thought so too.  Your suggestion does work.  With this patch, I was
> able to bootstrap and build gobject-introspection.
>
>
> From 11459384968f654c42ad7dba4443dada35191f5b Mon Sep 17 00:00:00 2001
> From: Eric Bavier <bavier@member.fsf.org>
> Date: Thu, 4 Sep 2014 09:19:24 -0500
> Subject: [PATCH] utils: Clean trailing whitespace at end of SHELL
>
> * guix/build/utils.scm (patch-makefile-SHELL): Remove trailing whitespace.

OK to commit!

Thanks,
Ludo’.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-09-05  8:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-04 14:27 [PATCH] utils: Clean trailing whitespace at end of SHELL Eric Bavier
2014-09-04 19:31 ` Ludovic Courtès
2014-09-05  5:05   ` Eric Bavier
2014-09-05  8:11     ` Ludovic Courtès

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