diff mbox series

[bug#39156] gnu: nim: Fix substitution in stdlib_osproc.c

Message ID 20200116221441.mu62k4v3u6ekemn4@zdrowyportier.kadziolka.net
State Accepted
Headers show
Series [bug#39156] gnu: nim: Fix substitution in stdlib_osproc.c | expand

Checks

Context Check Description
cbaines/applying patch success Successfully applied

Commit Message

Maja Kądziołka Jan. 16, 2020, 10:14 p.m. UTC
* gnu/packages/nim.scm (nim)[arguments](patch-more-shebangs): Patch the
  string length too.
---
 gnu/packages/nim.scm | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

Comments

Maja Kądziołka Jan. 21, 2020, 5:53 p.m. UTC | #1
I realized that I was somewhat unclear on what benefit this patch
brings. Without the patch, compiling any nim programs is broken, for
example:

~/tmp$ cat > hello.nim
echo("Hello")
~/tmp$ ~/guix/pre-inst-env guix environment --ad-hoc nim -- nim c
hello.nim
Hint: used config file
'/gnu/store/k19xvhqgh3x0f7ax25r15l5bw16lzism-nim-0.17.2/config/nim.cfg'
[Conf]
Hint: system [Processing]
Hint: hello [Processing]
CC: hello
Error: invocation of external compiler program failed. File exists
Additional info: Could not find command: '/gnu/st'. OS error: No such
file or directory 17
ashish.is--- via Guix-patches" via Jan. 21, 2020, 8:30 p.m. UTC | #2
Jakub,

Jakub Kądziołka 写道:
> * gnu/packages/nim.scm (nim)[arguments](patch-more-shebangs): 
> Patch the
>   string length too.

Thanks!  Pushed as 79e074ea10875ff75ca613179c70de12d64b19f5.

I tweaked only the commit message a bit, removing the 
unconventional ‘(patch-more-shebangs)’.  Now I see that Ludo' 
didn't seem to mind in 489703898380ab1a0db86f82c4861a33bf97b5fd. 
Oh well.

Kind regards,

T G-R
diff mbox series

Patch

diff --git a/gnu/packages/nim.scm b/gnu/packages/nim.scm
index 5694eae63b..22dac0b58a 100644
--- a/gnu/packages/nim.scm
+++ b/gnu/packages/nim.scm
@@ -50,10 +50,12 @@ 
                  #t)))
            (add-after 'patch-source-shebangs 'patch-more-shebangs
              (lambda _
-               (substitute* (append '("tests/stdlib/tosprocterminate.nim"
-                                      "lib/pure/osproc.nim")
-                                    (find-files "c_code" "stdlib_osproc.c"))
-                 (("/bin/sh") (which "sh")))
+               (let ((sh (which "sh")))
+                 (substitute* '("tests/stdlib/tosprocterminate.nim"
+                                        "lib/pure/osproc.nim")
+                   (("/bin/sh") sh))
+                 (substitute* (find-files "c_code" "stdlib_osproc.c")
+                   (("\"/bin/sh\", 7") (format "~s, ~s" sh (string-length sh)))))
                #t))
            (replace 'build
              (lambda _