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

[regression] String formatting has regressed since 0.60. ERROR: Format placeholder @9@ out of range. #9530

Closed
ctrlcctrlv opened this issue Nov 4, 2021 · 4 comments · Fixed by #9532
Assignees
Milestone

Comments

@ctrlcctrlv
Copy link

Describe the bug
There is a regression of as yet unknown cause in Meson's string formatting, as discovered by @alex3kov and diagnosed by myself at libsixel/libsixel#50. This regression causes previously building package to no longer build.

To Reproduce
https://github.com/libsixel/libsixel/blob/v1.10.3/meson.build

Expected behavior
Good build

system parameters

  • Is this a cross build or just a plain native build (for the same computer)?
    Plain build.
  • what operating system (e.g. MacOS Catalina, Windows 10, CentOS 8.0, Ubuntu 18.04, etc.)
    Arch Linux
  • what Python version are you using e.g. 3.8.0
    Python 3.9.7
  • what meson --version
    Versions above 0.59.2 I confirm are affected.
  • what ninja --version if it's a Ninja build
    We do not get to Ninja step, Meson is the cause.
@alex3kov
Copy link

alex3kov commented Nov 4, 2021

0.59.3 works for me. 0.60.0 and 0.60.1 do not.

@dcbaker dcbaker added this to the 0.60.2 milestone Nov 4, 2021
@eli-schwartz
Copy link
Member

eli-schwartz commented Nov 4, 2021

libsixel/libsixel@8039510

pkg_config_path is a null list, and should never have been there to begin with (it makes no sense).

In this case it seems that it's being flattened?

Somewhat predictably, this bisects to commit d93d01b (#9207).

Simple test case:

project('issue 9530')

message('foo list: @0@'.format([]))

In meson 0.59.4, this prints:

Message: foo list: []

It is of debatable usefulness, but what about this?

project('issue 9530')

message('foo list: @0@, bar list: @1@'.format(['--foo', 'barvalue'], ['--bar', 'barvalue']))

0.59.4 output:

Message: foo list: ['--foo', 'foovalue'], bar list: ['--bar', 'barvalue']

0.60.1 output:

Message: foo list: --foo, bar list: foovalue

@eli-schwartz
Copy link
Member

IMHO the absolute last place we should ever be doing list flattening is in .format() and message().

eli-schwartz added a commit to eli-schwartz/meson that referenced this issue Nov 4, 2021
String formatting should validly assume that printing a list means
printing the list itself. Instead, something like this broke:

'one is: @0@ and two is: @1@'.format(['foo',  'bar'], ['baz'])

which would evaluate as:

'one is: foo and two is: bar'

or:

'the value of array option foobar is: @0@'.format(get_option('foobar'))

which should evaluate with '-Dfoobar=[]' as

'the value of array option foobar is: []'

But instead produced:

meson.build:7:0: ERROR: Format placeholder @0@ out of range.

Fixes mesonbuild#9530
@eli-schwartz
Copy link
Member

(I am not even incredibly fond of list flattening everywhere, it's kind of weird and very prone to this sort of problem.)

nirbheek pushed a commit that referenced this issue Nov 25, 2021
String formatting should validly assume that printing a list means
printing the list itself. Instead, something like this broke:

'one is: @0@ and two is: @1@'.format(['foo',  'bar'], ['baz'])

which would evaluate as:

'one is: foo and two is: bar'

or:

'the value of array option foobar is: @0@'.format(get_option('foobar'))

which should evaluate with '-Dfoobar=[]' as

'the value of array option foobar is: []'

But instead produced:

meson.build:7:0: ERROR: Format placeholder @0@ out of range.

Fixes #9530
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants