Skip to content

Unclear error message on parsing cross and native files #12025

Closed

Description

@glingy

Parsing of a cross file with a missing value causes unclear error messages about what the issue is:

cross.ini:

[constants]
test = 
Traceback (most recent call last):
  File "/opt/homebrew/lib/python3.11/site-packages/mesonbuild/mesonmain.py", line 194, in run
    return options.run_func(options)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/mesonbuild/msetup.py", line 318, in run
    app.generate()
  File "/opt/homebrew/lib/python3.11/site-packages/mesonbuild/msetup.py", line 189, in generate
    env = environment.Environment(self.source_dir, self.build_dir, self.options)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/mesonbuild/environment.py", line 519, in __init__
    config = coredata.parse_machine_files(self.coredata.cross_files)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/mesonbuild/coredata.py", line 1014, in parse_machine_files
    parser = MachineFileParser(filenames)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/mesonbuild/coredata.py", line 968, in __init__
    self.sections[s] = self._parse_section(s)
                       ^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/mesonbuild/coredata.py", line 981, in _parse_section
    res = self._evaluate_statement(ast.lines[0])
                                   ~~~~~~~~~^^^
IndexError: list index out of range

ERROR: Unhandled python exception

    This is a Meson bug and should be reported!

system parameters
Cross-build, macOS Ventura, python 3.11.4, meson 1.2.0

Activity

  1. changed the title [-]Unclear error messages on parsing cross and native files[/-] [+]Unclear error message on parsing cross and native files[/+] on Jul 22, 2023
  2. added 2 commits that reference this issue on Aug 6, 2023
    33bf9f2
    52f85f0
  3. added a commit that references this issue on Aug 7, 2023
    142dd17
  4. added a commit that references this issue on Aug 7, 2023
    a3d5ec0
  5. added a commit that references this issue on Aug 25, 2023
    7223542
  6. added a commit that references this issue on May 1, 2025
    de5781b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions