The pipeline
readelf -d "${dep_file}" | grep -q SONAME
can fail because grep -q closes the output early resulting sigpipe being
sent to readelf. Other possible solutions are to turn off pipefail for
the file or remove the -q grep argument.
Credit to ashish@ for the detective work on discovering the root cause
of this.