Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#150 ext:run-program not working on cygwin because of broken form

open
nobody
None
5
2012-07-25
2011-05-28
Anonymous
No

ext:run-program not working on cygwin because of broken form() system call

What happens is that cygwin is faking "fork()". Windows does not have it, so what Cygwin does is to reload the whole executable file and all shared libraries and copy the memory content to fake a "duplicate" of the original executable image. The problem is that when loading the executable file and the shared libraries, they have to end up at the same positions, but cygwin fails to do it properly and thus the copy that is produced cannot function.

This is solely a cygwin problem and we run into it because of the use of fork(). We need it for ext:run-program, and all the functionality it provides -- redirection of child's input/output/error channels, waiting for processes, etc.

An alternative is to reuse the Windows code instead of fork+execve. I have tried this today but there are other problems
- Almost all cygwin executables are symlinked in a way that is not open to Windows, thus "gcc" is actually found through two symlinks that are internal to cygwin, not expose to the operating system libraries.
- This would force us to code a function that searches the "PATH" for the program we want to run.
- But things do not stop there, because when cygwin invokes a program it does some massaging of the environment (PATH from posix to Windows syntax, remapping other environment variables, mapping arguments to execve to the right pathname convention...)

Discussion


Anonymous


Cancel   Add attachments