Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
var/loop: cheat so bash in POSIX mode can use process substitution
Modernish 0.16.x always enables POSIX mode for bash upon init. Unfortunately, bash disables process substitution in POSIX mode, so PROCSUBST is not detected. Therefore, let's cheat. This cheat is important because Solaris and derivatives have a nasty race condition with the named pipes (FIFOs) that the portable version uses (ref.: https://www.illumos.org/issues/10179), which may cause bash to hang when using modernish loops under high system load. The "reset everything and retry" workaround in the portable version is effective for dash and some other shells, but not bash. Thus, by avoiding FIFOs, this cheat makes modernish loops work reliably on bash on Solaris and illumos-based systems. lib/modernish/mdl/var/loop.mm: - If bash and POSIX mode are detected, redo the PROCSUBST feature test with POSIX mode disabled. If that detects process substitution, use a cheat version of _Msh_loopgen() that turns off POSIX mode just long enough to launch the iteration generator using process substitution. Of course POSIX mode is also turned back on for the iteration generator process.
- Loading branch information