chbrown / overdrive

Bash script to download mp3s from the OverDrive audiobook service

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Process substitution not supported by Alpine Linux on iOS

vesten23 opened this issue · comments

I’ve successfully run this great script on macOS, and I’m attempting to run in an iOS environment via Alpine Linux.

I’ve been able to install all of the requisite packages via apk add, and while the script runs, I get the following error when trying to run the download command: “ line 264: /dev/fd/63: No such file or directory”

When running in verbose mode, the error seems to occur as each of the parts are being iterated for download; that is, the directory is successfully made, the part file names are identified, but the download process does not start, nor does it throw a download fail error. Any thoughts?

Alpine on iOS — huh, didn't know that was a thing.

Based on that very terse error message, I'm guessing your bash interpreter doesn't support process substitution, which the script uses in one or two places.

I'd be curious what /usr/bin/env bash --version and/or just bash --version prints out in whatever environment you're trying to run this script in.

bash --version
GNU bash, version 5.1.16(1)-release (i586-alpine-linux-musl)

Looking through various forums with the /dev/fd/* error, I agree process substitution is a likely issue here. So far, I have been going down the permission/library route, trying to verify in my environment the requisite elements in the download sequence, but to no avail. Is it possible to replace the process substitutions in your script as a workaround?

Welp, that's the current bash. Maybe depends on how it was built?

Yeah, seems like there's no immediate need for the while loop(s) to use that form. That's just what I usually go with since it avoids running them inside a subshell, which would usually isolate the variables inside. But here, that's totally fine. Try changing that first loop to:

extract_filenames "$1" | while read -r path; do
  ...
done

and then just delete the second loop; you don't really need the cover.

Lmk if that fixes it. Even though that's a pretty weird edge case you've got, might as well accommodate it if it's that easy.

That did the trick, thanks!