jameslittle230 / stork

🔎 Impossibly fast web search, made for static sites.
https://stork-search.net
Apache License 2.0
2.73k stars 56 forks source link

Reproducible build output #261

Closed ArsenArsen closed 2 years ago

ArsenArsen commented 2 years ago

Currently, build outputs inconsistent results. This makes diffing for errors among other things harder. I'm unsure what the builds depend on (time maybe?).

while :; do 2>/dev/null stork build --input config.json --output test.st && sha256sum test.st; done
jameslittle230 commented 2 years ago

Interesting. I can reproduce this and will work on fixing it. Builds should be consistent and (as far as I know) have no dependence on time. I suspect that this is due to a list somewhere getting serialized with an undefined order.

ArsenArsen commented 2 years ago

I didn't consider that since I'd expect FS order to be stable-ish. I expected it to be some hash function being seeded with randomness or something of that nature. But sorting the order of the output is a very good idea regardless (since FS order is unstable across machines at the very least).