bug(variants): empty string variants not processed correctly
openblas-feedstock on ๐ rattler [๐ญโฌ๏ธ ] via ๐ง v0.48.2
โฏ bat recipe/variants.yaml
โโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ File: recipe/variants.yaml
โโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
1 โ zip_keys:
2 โ - [SYMBOLSUFFIX, name_suffix, INTERFACE64]
3 โ
4 โ # gcc 12 cannot handle `-mtune=native` on aarch,
5 โ # gcc 13 causes test failures on ppc
6 โ c_compiler_version:
7 โ - if: linux
8 โ then: 14
9 โ fortran_compiler_version:
10 โ - if: linux
11 โ then: 14
12 โ
13 โ SYMBOLSUFFIX:
14 โ - ""
15 โ - if: not (win or aarch64)
16 โ then: "64_"
17 โ
18 โ name_suffix:
19 โ - ""
20 โ - if: not (win or aarch64)
21 โ then: "-ilp64"
22 โ
23 โ INTERFACE64:
24 โ - 0
25 โ - if: not (win or aarch64)
26 โ then: 1
27 โ
28 โ USE_OPENMP:
29 โ - if: not osx
30 โ then: "0"
31 โ - "1"
โโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
openblas-feedstock on ๐ rattler [โ๐ญ?] via ๐ง v0.48.2
โฏ pixi run rerender
...
Error: ร Zip key elements do not all have same length: INTERFACE64
openblas-feedstock on ๐ rattler [โฌ๏ธ ] via ๐ง v0.48.2 took 4s
โฏ git diff
diff --git a/recipe/variants.yaml b/recipe/variants.yaml
index 8903f69..cfecacc 100644
--- a/recipe/variants.yaml
+++ b/recipe/variants.yaml
@@ -11,12 +11,12 @@ fortran_compiler_version:
then: 14
SYMBOLSUFFIX:
- - ""
+ - "foo"
- if: not (win or aarch64)
then: "64_"
name_suffix:
- - ""
+ - "bar"
- if: not (win or aarch64)
then: "-ilp64"
openblas-feedstock on ๐ rattler [๐จโฌ๏ธ ] via ๐ง v0.48.2
โฏ pixi run rerender
... // no error
Interesting. It's possible that we remove empty strings like this as if they would not exist.
yeah, I'm looking for a fix now
It looks like the problem is in the initial parsing, by the time we get to https://github.com/prefix-dev/rattler-build/blob/5baeaf1bf3ea58e52c3a7b5ce3ffcb51711f1974/src/variant_config.rs#L572-L596 the empty strings are already dropped from the RenderedNodes:
2025-06-26T12:32:20.602508Z DEBUG Finding outputs from recipe: rattler_build::variant_config: "SYMBOLSUFFIX"
2025-06-26T12:32:20.602518Z DEBUG Finding outputs from recipe: rattler_build::variant_config: Sequence(
RenderedSequenceNode {
value: [
Scalar(
RenderedScalarNode {
value: "64_",
},
),
],
},
)
2025-06-26T12:32:20.602527Z DEBUG Finding outputs from recipe: rattler_build::variant_config: Some(
[
"64_",
],
)
2025-06-26T12:32:20.602532Z DEBUG Finding outputs from recipe: rattler_build::variant_config: "name_suffix"
2025-06-26T12:32:20.602535Z DEBUG Finding outputs from recipe: rattler_build::variant_config: Sequence(
RenderedSequenceNode {
value: [
Scalar(
RenderedScalarNode {
value: "-ilp64",
},
),
],
},
)
2025-06-26T12:32:20.602591Z DEBUG Finding outputs from recipe: rattler_build::variant_config: Some(
[
"-ilp64",
],
)
2025-06-26T12:32:20.602608Z DEBUG Finding outputs from recipe: rattler_build::variant_config: "INTERFACE64"
2025-06-26T12:32:20.602612Z DEBUG Finding outputs from recipe: rattler_build::variant_config: Sequence(
RenderedSequenceNode {
value: [
Scalar(
RenderedScalarNode {
value: "0",
},
),
Scalar(
RenderedScalarNode {
value: "1",
},
),
],
},
)
Possibly related:
Error:
ร expected a scalar value.
โญโ[recipe/recipe.yaml:11:17]
10 โ # ILP64_string: ${{ "" if SYMBOLSUFFIX != "64_" else " (ILP64 interface) " }}
11 โ ILP64_string: ""
ยท โโฌ
ยท โฐโโ here
12 โ name_suffix: ""
โฐโโโโ
help: `context` values must always be scalars (booleans, integers or strings) or uniform lists of scalars
switching to ${{ "" }} I see
yaml.constructor.ConstructorError: could not determine a constructor for the tag 'tag:yaml.org,2002:python/object/new:ruamel.yaml.scalarstring.DoubleQuotedScalarString'
EDIT: perhaps a different problem, I seem to see this after removing all ${{ "" }}
rattler-build build works fine with a local conda_build_config.yaml. However, rattler-build build -m fails with the following yaml dumped by rattler_build_conda_compat:
{'python': ['3.12'], 'numpy': ['1.26'], 'perl': ['5.26.2'], 'lua': ['5'], 'r_base': ['3.5'], 'cpu_optimization_target': ['nocona'], 'pin_run_as_build': {'python': {'min_pin': 'x.x', 'max_pin': 'x.x'}, 'r-base': {'min_pin': 'x.x', 'max_pin': 'x.x'}}, 'ignore_version': [], 'ignore_build_only_deps': ['python', 'numpy'], 'extend_keys': ['extend_keys', 'ignore_build_only_deps', 'pin_run_as_build', 'ignore_version'], 'cran_mirror': ['https://cran.r-project.org'], 'target_platform': ['linux-64'], 'c_compiler': ['gcc'], 'cxx_compiler': ['gxx'], 'fortran_compiler': ['gfortran'], 'c_compiler_version': ['14'], 'fortran_compiler_version': ['14'], 'SYMBOLSUFFIX': ['', '64_'], 'name_suffix': ['', '-ilp64'], 'INTERFACE64': ['0', '1'], 'USE_OPENMP': ['0', '1'], 'zip_keys': [['SYMBOLSUFFIX', 'name_suffix', 'INTERFACE64']], 'c_stdlib': ['sysroot'], 'c_stdlib_version': ['2.17']}
that yaml does include the empty string variants, so the problem is hit some time after rattler-build reading the yaml
correct at https://github.com/prefix-dev/rattler-build/blob/d18bacf0a77d5595b63256b6ad299b72e807089c/src/variant_config.rs#L258
ScalarNode {
value: "name_suffix",
}: Sequence(
SequenceNode {
value: [
Simple(
Scalar(
ScalarNode {
value: "",
},
),
),
Simple(
Scalar(
ScalarNode {
value: "-ilp64",
},
),
),
],
},
),
incorrect at https://github.com/prefix-dev/rattler-build/blob/d18bacf0a77d5595b63256b6ad299b72e807089c/src/variant_config.rs#L260
RenderedScalarNode {
value: "name_suffix",
}: Sequence(
RenderedSequenceNode {
value: [
Scalar(
RenderedScalarNode {
value: "-ilp64",
},
),
],
},
),
https://github.com/prefix-dev/rattler-build/blob/d18bacf0a77d5595b63256b6ad299b72e807089c/src/recipe/custom_yaml/rendered.rs#L663-L686 returns a Null node for an empty string variant.
@wolfv do you know if empty ScalarNodes are widely used as null values? https://github.com/prefix-dev/rattler-build/blob/d18bacf0a77d5595b63256b6ad299b72e807089c/src/recipe/custom_yaml.rs#L379-L382 seems to suggest that "null" would be an alternative.
implementing a stricter is_empty for RenderedScalarNode at gh-1764 fixes the immediate issue, but breaks other things
I closed the linked PR as I won't have time to look into it further, but maybe it was going in the right direction, so worth taking a look at if somebody else wants to try tackling this issue