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

Sre crash when it build in some locales #734

Open
BlueCat0 opened this issue Oct 23, 2023 · 1 comment
Open

Sre crash when it build in some locales #734

BlueCat0 opened this issue Oct 23, 2023 · 1 comment
Labels

Comments

@BlueCat0
Copy link

When I build sre from my laptop, it crash when load rule file.
I checked it and found the action file load earlier than base file, which will cause crash here.

function storeFactory(set: RulesJson) {
const name = `${set.locale}.${set.modality}.${set.domain}`;
if (set.kind === 'actions') {
const store = stores.get(name);
store.parse(set);
return store;
}

I found lib/mathmaps was createad by makefiles

$(LOC_DST): $(MINI_DST)
@echo "Creating mappings for locale `basename $@ .json`."
@echo '{' > $@
@for dir in $(MAPS); do\
if [ -d $(JSON_SRC)/`basename $@ .json`/$$dir ]; then \
for i in $(JSON_SRC)/`basename $@ .json`/$$dir/*.min; do\
echo '"'`basename $@ .json`/$$dir/`basename $$i`'": ' >> $@; \
cat $$i >> $@; \
echo ',' >> $@; \
done; \
fi; \
done
@sed '$$d' $@ > $@.tmp
@echo '}' >> $@.tmp
@echo '' >> $@.tmp
@mv $@.tmp $@

it should be noticed that for in loop in bash not guarantee alphabetical order, it depends on locale.

in my case, when LANG was set to zh_CN.UTF-8, the merged json file order will cause crash.

"base/rules/clearspeak_base_actions.min"
"base/rules/clearspeak_base.min"

and when set LC_COLLATE to C, it will has same order with released file.

"base/rules/clearspeak_base.min"
"base/rules/clearspeak_base_actions.min"

add this env to makefile will help.

@zorkow
Copy link
Member

zorkow commented Oct 25, 2023

Thanks for reporting this. I was not aware of the bash feature.

@zorkow zorkow added the bug label Oct 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants