unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: Maxime Devos <maximedevos@telenet.be>
To: 54469@debbugs.gnu.org
Subject: bug#54469: home-environment-variables-service-type does not quote things
Date: Sat, 19 Mar 2022 22:04:59 +0100	[thread overview]
Message-ID: <8edc244df527278786d4d0e1dfb33afce441546d.camel@telenet.be> (raw)

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

Hi guix,

Consider the following home configuration:

(use-modules (gnu home) (gnu packages) (gnu home services)
             (gnu services) (guix gexp) (gnu home services shells))

(define formula-of-the-day
   ;; TODO: add some more formulae, randomise
   "$US dollar/€euro = 1.11")

(home-environment
  (packages '())
  (services
    (list (simple-service 'extra-environment-variables
                        home-environment-variables-service-type
                        `(("formula of the (reconfiguration) day" . ,formula-of-the-day))))))

Now start a container with this configuration with "guix home container":

$ guix home container home-configuration.scm

[start output block]
WARNING: (guile-user): imported module (guix build utils) overrides
core binding `delete'
/gnu/store/[...]/setup-environment: line 33: syntax error near
unexpected token `('
/gnu/store/[...]/setup-environment: line 33: `export formula of the
(reconfiguration) day=$US dollar/€euro = 1.11'
Backtrace:
In ice-9/boot-9.scm:
  1752:10 11 (with-exception-handler _ _ #:unwind? _ # _)
In unknown file:
          10 (apply-smob/0 #<thunk 7f8d3bd36f40>)
In ice-9/boot-9.scm:
    724:2  9 (call-with-prompt _ _ #<procedure default-prompt-handle?>)
In ice-9/eval.scm:
    619:8  8 (_ #(#(#<directory (guile-user) 7f8d3bd30c80>)))
In ice-9/command-line.scm:
   185:18  7 (_ #<input: string 7f8d3bd29850>)
In unknown file:
           6 (eval (begin (use-modules (guix build utils) (# ?) ?) ?)
?)
In ice-9/eval.scm:
    619:8  5 (_ #f)
In unknown file:
           4 (primitive-load "/gnu/store/6xn1fyljn05cjgx3sakhmds88sc?")
In ice-9/eval.scm:
   293:34  3 (_ #(#(#(#(#(#(#(#(#<directory ?> ?) ?) ?) ?) ?) ?) ?) ?))
    159:9  2 (_ #(#(#(#(#(#(#(#(#<directory ?> ?) ?) ?) ?) ?) ?) ?) ?))
    159:9  1 (_ #(#(#(#(#(#(#(#(#<directory ?> ?) ?) ?) ?) ?) ?) ?) ?))
In unknown file:
           0 (string-split #<eof> #\nul)

ERROR: In procedure string-split:
In procedure string-split: Wrong type argument in position 1 (expecting
string): #<eof>
[end output block]

To investigate, I took a look at 'setup-environment':

   [lots of exports]
   export formula of the (reconfiguration) day=$US dollar/€euro = 1.11

There are at least two issues here:

  * The variable 'formula of the (reconfiguration) day' was not quoted.

    I don't know how to do this in bash though, if it is even possible
    at all.  If it turns out not to be possible, I'd prefer that to
    be mentioned by a nice error message, e.g. "environment variable
    names may not contain FOOs" or "environment variable names must
    consist of BARs".

  * The value '$US dollar/€euro' was not quoted, so bash would
    expand $US (to the empty string, since $US is not defined).

Greetings,
Maxime.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

             reply	other threads:[~2022-03-19 21:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-19 21:04 Maxime Devos [this message]
2022-07-13 23:13 ` bug#54469: home-environment-variables-service-type does not quote things Ludovic Courtès
2022-07-21 12:30   ` Maxime Devos

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8edc244df527278786d4d0e1dfb33afce441546d.camel@telenet.be \
    --to=maximedevos@telenet.be \
    --cc=54469@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).