Skip to content

build: fix indeterminacy of icu_locales value

Rodrigo Muino Tomonari requested to merge github/fork/3ap/patch-1 into master

icu_locales is generated by joining values from set data structure. However, set doesn't guarantee an order, so the result of icu_locales is not determined. For example, the result value could be 'en,root' or 'root,en'. This fix make it deterministic.

The main reason of this fix is to restore the reproducibility of the build because the value of icu_locales is embedded into node binary.

The minimal code below could show you the issue:

default = 'root,en'
locs = set(default.split(','))
locs.add('root')
result = ','.join(str(loc) for loc in locs)

print(result)

Even after several runs of this script the problem occurs:

→ python test.py
en,root
→ python test.py
root,en
→ python test.py
en,root

Merge request reports

Loading