Finally got time to work on my Sandstorm-based ebook reader. It's
basically a front-end that accepts books via upload, runs the Calibre
ebook-convert utility to transform them to htmlz, then serves up the
resulting HTML/CSS/images along with a quick-and-dirty table listing the
books you've uploaded.
I've tested this on my Linux laptop and it works well enough, but in
Sandstorm the exec of the Calibre ebook-convert utility fails with:
events.js:72
throw er; // Unhandled 'error' event
^
Error: spawn ENOENT
at errnoException (child_process.js:1011:11)
at Process.ChildProcess._handle.onexit (child_process.js:802:34)
Here is the library I'm using to do the conversion:
https://github.com/sethvincent/ebook-convert
It doesn't do anything fancy, just spawns the ebook-convert utility and
add a few event handlers for its output.
Here are some things I've investigated of the "is it plugged in?" variety:
1. Again, this works well enough without Sandstorm that I'm ready to
build an SPK for personal use. Didn't think it would fail to spin up the
ebook-convert utility.
2. ebook-convert is present on the VM in /usr/bin.
3. /usr/bin appears to be in the PATH set by sandstorm-pkgdef.
4. The app uses node-temp and temporary directories. I thought perhaps
I'd need to set TMPDIR, but either it is getting set somewhere or
node-temp has a fallback to /tmp. Various stages in the
upload/conversion process write to temporary files/directories and these
all seem to get created, if the functions that create them not failing
is any indication.
5. I've caught all events that the ebook-convert library claims to emit,
but it doesn't seem to output any errors. Looks like it isn't running at
all, but I thought I'd be thorough. It seems like if it couldn't find an
input file for instance, then it'd output something on stderr rather
than fail in a way that looks like the binary itself can't be found.
To be clear, this is in vagrant-spk dev, so it should be able to find
ebook-convert as installed in setup.sh AFAIK.
Is there something in the Sandstorm security model or sandbox that might
prevent grains from spawning new processes? If not, thoughts on why this
might work fine locally but fail in Sandstorm? I can share my code if
there's no obvious reason this should fail--it isn't pretty but it's not
complex either. :)
Thanks.