Skip to content

Conversation

@bonzini
Copy link
Collaborator

@bonzini bonzini commented Sep 30, 2025

Revised version of #15061

Boolean options need to be translated from string "true" to True and so on, otherwise we will get an assertion later when trying to set the value:

Traceback (most recent call last):
  File "meson.git/mesonbuild/mesonmain.py", line 193, in run
    return options.run_func(options)
           ~~~~~~~~~~~~~~~~^^^^^^^^^
  File "meson.git/mesonbuild/msetup.py", line 395, in run
    app.generate()
    ~~~~~~~~~~~~^^
  File "meson.git/mesonbuild/msetup.py", line 194, in generate
    return self._generate(env, capture, vslite_ctx)
           ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "meson.git/mesonbuild/msetup.py", line 282, in _generate
    captured_compile_args = intr.backend.generate(capture, vslite_ctx)
  File "meson.git/mesonbuild/backend/ninjabackend.py", line 647, in generate
    self.generate_target(t)
    ~~~~~~~~~~~~~~~~~~~~^^^
  File "meson.git/mesonbuild/backend/ninjabackend.py", line 1099, in generate_target
    elem = self.generate_link(target, outname, final_obj_list, linker, pch_objects, stdlib_args=stdlib_args)
  File "meson.git/mesonbuild/backend/ninjabackend.py", line 3632, in generate_link
    base_link_args = compilers.get_base_link_args(target,
                                                  linker,
                                                  self.environment)
  File "meson.git/mesonbuild/compilers/compilers.py", line 405, in get_base_link_args
    option_enabled(linker.base_options, target, env, 'b_lundef')):
    ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "meson.git/mesonbuild/compilers/compilers.py", line 234, in option_enabled
    assert isinstance(ret, bool), 'must return bool'  # could also be str
           ~~~~~~~~~~^^^^^^^^^^^
AssertionError: must return bool

This assertion is being hit because the vo-aacenc wrap sets b_lundef=true in default_options: in project(), which ends up in self.augments when the project is being invoked as a subproject.

The fix is to use set_option even for pending subproject options. This will follow this path:

    new_value = opt.validate_value(new_value)
    old_value = self.augments.get(key, opt.value)
    self.augments[key] = new_value

This regressed in 2bafe7d.

First noticed at: https://github.com/mesonbuild/wrapdb/actions/runs/18123699172/job/51573947286?pr=2425

Boolean options need to be translated from string "true" to True and
so on, otherwise we will get an assertion later when trying to set the
value:

```
Traceback (most recent call last):
  File "meson.git/mesonbuild/mesonmain.py", line 193, in run
    return options.run_func(options)
           ~~~~~~~~~~~~~~~~^^^^^^^^^
  File "meson.git/mesonbuild/msetup.py", line 395, in run
    app.generate()
    ~~~~~~~~~~~~^^
  File "meson.git/mesonbuild/msetup.py", line 194, in generate
    return self._generate(env, capture, vslite_ctx)
           ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "meson.git/mesonbuild/msetup.py", line 282, in _generate
    captured_compile_args = intr.backend.generate(capture, vslite_ctx)
  File "meson.git/mesonbuild/backend/ninjabackend.py", line 647, in generate
    self.generate_target(t)
    ~~~~~~~~~~~~~~~~~~~~^^^
  File "meson.git/mesonbuild/backend/ninjabackend.py", line 1099, in generate_target
    elem = self.generate_link(target, outname, final_obj_list, linker, pch_objects, stdlib_args=stdlib_args)
  File "meson.git/mesonbuild/backend/ninjabackend.py", line 3632, in generate_link
    base_link_args = compilers.get_base_link_args(target,
                                                  linker,
                                                  self.environment)
  File "meson.git/mesonbuild/compilers/compilers.py", line 405, in get_base_link_args
    option_enabled(linker.base_options, target, env, 'b_lundef')):
    ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "meson.git/mesonbuild/compilers/compilers.py", line 234, in option_enabled
    assert isinstance(ret, bool), 'must return bool'  # could also be str
           ~~~~~~~~~~^^^^^^^^^^^
AssertionError: must return bool
```

This assertion is being hit because the vo-aacenc wrap sets
`b_lundef=true` in `default_options:` in `project()`, which ends up in
`self.augments` when the project is being invoked as a subproject.

The fix is to use set_option even for pending subproject options.  This
will follow this path:

        new_value = opt.validate_value(new_value)
        old_value = self.augments.get(key, opt.value)
        self.augments[key] = new_value

This regressed in 2bafe7d.

First noticed at: https://github.com/mesonbuild/wrapdb/actions/runs/18123699172/job/51573947286?pr=2425

[Commit message by Nirbheek Chauhan <nirbheek@centricular.com>]
@bonzini bonzini requested a review from jpakkane as a code owner September 30, 2025 15:38
@bonzini bonzini added regression options Meson configuration options labels Sep 30, 2025
@nirbheek nirbheek added this to the 1.9.2 milestone Sep 30, 2025
@nirbheek nirbheek merged commit c0a5e92 into mesonbuild:master Sep 30, 2025
32 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

options Meson configuration options regression

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants