runrev/livecode — pull request #1331 by peter-b (2014-10-23 12:46:43+00:00)
Title: Sanitise environment before calling out to system shell

On OS X Yosemite, the system sets the environment variable `$PATH` multiple times. This causes undefined behaviour in software that uses the `$PATH` environment variable, because the POSIX specification does not specify which value should be used.

In particular, it was found that `put ":/usr/local/bin" after $PATH; put shell("env")` showed that the LiveCode was modifying the first occurrence of $PATH in the environment, but `bash` was using the last.

To address this, use execle(3) rather than execl(3) and provide an explicit environment variable array using the environment values from LiveCode's global variables.