When a rom archive contains many files, it can take some time for
sha1sum to output shas for every file.
The output of sha1sum is piped into an awk that reads a single line
and then immediately exits. This causes a race condition: if sha1sum
is still writing to the pipe but the reader has exited, the kernel sends
it SIGPIPE causing it to exit with code 141.
Since the pipefail option is set, this fails the whole script.
With this change, only the first file in the directory is passed into
sha1sum. This should maintain behavior while eliminating the bug.
So far these changes have fixed the issue I was having with many of my
roms. The issue can be tricky to reproduce because high single core
performance can pretty much eliminate it. I can share the roms that are
causing the issue, let me know.
Fixes #43
When a rom archive contains many files, it can take some time for
sha1sum
to output shas for every file.The output of
sha1sum
is piped into anawk
that reads a single line and then immediately exits. This causes a race condition: ifsha1sum
is still writing to the pipe but the reader has exited, the kernel sends itSIGPIPE
causing it to exit with code 141.Since the pipefail option is set, this fails the whole script.
With this change, only the first file in the directory is passed into
sha1sum
. This should maintain behavior while eliminating the bug.So far these changes have fixed the issue I was having with many of my roms. The issue can be tricky to reproduce because high single core performance can pretty much eliminate it. I can share the roms that are causing the issue, let me know.