Skip to content

Once you have a syntax error in spack.yaml, you can't use 'spack config edit' to fix it.  #41470

@pbisbal1

Description

@pbisbal1

Steps to reproduce

Edit spack.yaml, with 'spack config edit', like leaving off a closing quote, or listing the same package twice in the packages section. For example:
@alalazo

spack:
  definitions:
  - core_compiler:
    - '%[email protected]

Save file and then try to edit again with 'spack config edit'. This will fail with the error below.

Error message

==> Error: Invalid environment configuration detected: error parsing YAML: near /usr/lynx/spack/stacks/lynx/spack.yaml, 9, 7: found character '%' that cannot start any token

While it's great to check the YAML files for valid syntax before parsing them, the commands used to edit those YAML files should not fail because of bad syntax, as that means we now have to call our editor directly with the path to the YAML file in order to correct this problem, when we should be able to use spack edit config to fix these issues.

Ideally, the syntax checker should run after we save changes to these files so that we catch errors immediately after editing them and can the run spack edit again to fix.

Prentice

Information on your system

  • Spack: 0.22.0.dev0 (88e738c)
  • Python: 3.9.16
  • Platform: linux-rhel9-zen2
  • Concretizer: clingo

General information

  • I have run spack debug report and reported the version of Spack/Python/Platform
  • I have searched the issues of this repo and believe this is not a duplicate
  • I have run the failing commands in debug mode and reported the output

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingimpact-lowv1.0.2PRs / Bug fixes to backport for v1.0.2

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions