[Toybox] Would someone please explain what bash is doing here?
rob at landley.net
Sat May 30 22:54:29 PDT 2020
On 5/29/20 1:09 PM, Chet Ramey wrote:
> On 5/28/20 6:41 PM, Rob Landley wrote:
>>> If you're worried about leaving stray background jobs around, end your
>>> test script with `wait'.
>> Which will hang if the background job is hung.
> It's pretty easy to send yourself a signal from a subshell after a period
> of time as a cheap alarm.
I can do various forms of cleanup, yes. But individual whack-a-mole will always
have something else it misses (you can sing "a signal won't always kill zombies"
to the tune of "my bonnie lies over the ocean"), so I want more systematic cleanup.
I was looking at containers, but now I'm running the test in a temporary qemu
system that not only does cleanup but lets me run test as root in a known
environment where I know what processes are running and rivers are loaded and
filesystems are mounted and everything. (Hard to test things like "mount" and
>>> But you can always save a background job's pid
>>> by saving $!, so you can always have a handle to the background jobs you
>> In theory jobs -p should do it, in practice I've hit background-from-subshell
>> cases where it wasn't in the list...
> Sure, you can defeat anything. I've done stuff like that myself to avoid
> processes being killed by the shell at exit.
When running over a thousand tests that do weird stuff, things leak. (Then add
tests that need to run as root... :)
>>> Bash-5.1 will change the way it does $SECONDS to use gettimeofday(), btw.
>> Meanwhile, I'm fielding:
> Ironically, gettimeofday() is more portable.
I know. I didn't say I accepted the pull request. I just found it, as you said,
More information about the Toybox