guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#51791] [PATCH 0/2]: Update guile-bash


From: david larsson
Subject: [bug#51791] [PATCH 0/2]: Update guile-bash
Date: Fri, 12 Nov 2021 14:56:27 +0100

Hi,

The following 2 patches update the guile-bash source url and home-page, and adds a patch for it that does 2 things:
  - fixes a bug, see below
- enables reading newline- or null-separated arguments via stdin to guile-bash-defined bash functions.

The bug is that guile-bash can't read string args with whitespaces in it. Example:
------------------------
~$ enable -f ~/.guix-profile/lib/bash/libguile-bash.so scm
~$ scm /tmp/printargs
~$ printargs "apa bepa" cepa
In procedure printargs: scm-function called from Bash with args (apa bepa cepa) failed to match signature (file1 file2)
~$ cat /tmp/printargs
(use-modules
 (gnu bash))
(define-bash-function (printargs file1 file2)
    (display file1)
    (display "\n")
    (display file2)
    (display "\n"))
-------------------------

After this patch, you can read args "as normal", or via stdin that are either newline- or null-separated:
-------------------------
~$ printargs "apa bepa" cepa
apa bepa
cepa
~$ echo "$apa"
aba
aca
~$ printf '%s\0' "$apa" bepa | printargs -z
aba
aca
bepa
~$ echo "$apa" | printargs
aba
aca
-------------------------

Best regards,
David





reply via email to

[Prev in Thread] Current Thread [Next in Thread]