Skip to content

Invalid character error when referencing definitions in an environment's spec #12095

@paulbry

Description

@paulbry

When leveraging the definitions found int he Spack Stacks enhancement I encounter a Invalid character error after successful concretization. This only occurs in an environment with a definition reference in the spec (e.g. $first from the https://spack.readthedocs.io/en/latest/environments.html#spec-list-references).

This occurs with both Python 2.7.5 and 3.7.3

Steps to reproduce the issue

$ cat spack.yaml
spack:
  definitions:
    - first: [libelf, libdwarf]
    - compilers: ['%gcc@4.8.5']
    - second:
      - $first
      - matrix:
        - [zlib]
        - [$compilers]
  specs:
    - $second
    - cmake

$ spack concretize
==> Error: Invalid character

Error Message

$ spack --debug concretize
...
==> [2019-07-23-09:09:34.269444] LexError: Invalid character
==> [2019-07-23-09:09:34.269503] Error: Invalid character
Traceback (most recent call last):
  File "/Users/pbryant/Development/40-ECP/spack/lib/spack/spack/main.py", line 697, in main
    return _invoke_command(command, parser, args, unknown)
  File "/Users/pbryant/Development/40-ECP/spack/lib/spack/spack/main.py", line 447, in _invoke_command
    return_val = command(parser, args)
  File "/Users/pbryant/Development/40-ECP/spack/lib/spack/spack/cmd/concretize.py", line 22, in concretize
    env.write()
  File "/Users/pbryant/Development/40-ECP/spack/lib/spack/spack/environment.py", line 1242, in write
    Spec(s) in speclist.specs]
  File "/Users/pbryant/Development/40-ECP/spack/lib/spack/spack/spec.py", line 949, in __init__
    spec_list = SpecParser(self).parse(spec_like)
  File "/Users/pbryant/Development/40-ECP/spack/lib/spack/spack/parse.py", line 151, in parse
    self.setup(text)
  File "/Users/pbryant/Development/40-ECP/spack/lib/spack/spack/parse.py", line 148, in setup
    self.push_tokens(self.lexer.lex(text))
  File "/Users/pbryant/Development/40-ECP/spack/lib/spack/spack/parse.py", line 86, in lex
    tokens = self.lex_word(word)
  File "/Users/pbryant/Development/40-ECP/spack/lib/spack/spack/parse.py", line 79, in lex_word
    raise LexError("Invalid character", word, word.index(remainder))
spack.parse.LexError: Invalid character

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions