Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trying to set nested subproject option in native file results in unhandled Python exception #14222

Open
meator opened this issue Feb 4, 2025 · 2 comments · May be fixed by #14223
Open

Trying to set nested subproject option in native file results in unhandled Python exception #14222

meator opened this issue Feb 4, 2025 · 2 comments · May be fixed by #14223
Labels
exception Major bug that raises a python-level exception options Meson configuration options

Comments

@meator
Copy link
Contributor

meator commented Feb 4, 2025

Describe the bug
Trying to set nested subproject option in native file results in unhandled Python exception.

Traceback (most recent call last):
  File "/home/meator/git/meson/mesonbuild/mesonmain.py", line 193, in run
    return options.run_func(options)
           ~~~~~~~~~~~~~~~~^^^^^^^^^
  File "/home/meator/git/meson/mesonbuild/msetup.py", line 365, in run
    app.generate()
    ~~~~~~~~~~~~^^
  File "/home/meator/git/meson/mesonbuild/msetup.py", line 181, in generate
    env = environment.Environment(self.source_dir, self.build_dir, self.options)
  File "/home/meator/git/meson/mesonbuild/environment.py", line 634, in __init__
    self._load_machine_file_options(
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
        config, properties.build,
        ^^^^^^^^^^^^^^^^^^^^^^^^^
        MachineChoice.BUILD if self.coredata.cross_files else MachineChoice.HOST)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/meator/git/meson/mesonbuild/environment.py", line 721, in _load_machine_file_options
    subproject, section = section.split(':')
    ^^^^^^^^^^^^^^^^^^^
ValueError: too many values to unpack (expected 2)

ERROR: Unhandled python exception

    This is a Meson bug and should be reported!

native_file.ini (also included in the archive below):

[mylib:sublib:project options]
verbose-summary = true

To Reproduce
meson-repro-subproject-tree.tar.gz

Expected behavior
This either being possible or a descriptive error message being printed (and the exception being handled).

system parameters

  • native build
  • Void Linux
  • Python 3.13.1
  • tested both Meson 1.7.0 and 0e6e687 (current HEAD)
  • Ninja 1.12.1
@bonzini bonzini added the options Meson configuration options label Feb 4, 2025
@dcbaker
Copy link
Member

dcbaker commented Feb 4, 2025

I think that should just be [sublib:project options], since Meson will promote nested subprojects. But we should definitely catch that and give a better error.

dcbaker added a commit to dcbaker/meson that referenced this issue Feb 4, 2025
…subproject

Instead of having a raw python exception, provide a helpful error
message that `[sub:sub1:project options]` should just be `[sub1:project
options]`

No test is provided as this is basic error handling, and I felt it was
not worth adding to our test runtime to test that we don't raise a raw
exception.

Fixes: mesonbuild#14222
@dcbaker
Copy link
Member

dcbaker commented Feb 4, 2025

I opened a linked PR that should fix this issue.

@bonzini bonzini added the exception Major bug that raises a python-level exception label Feb 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
exception Major bug that raises a python-level exception options Meson configuration options
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants