On Wed, Jun 15, 2011 at 07:36:32AM -0400, Richard Heck wrote: > On 06/14/2011 06:29 PM, Enrico Forestieri wrote: > > > >> I wonder whether it might be possible for you to file > >> a proper bug report for that, i.e. some minimal, but > >> complete, reproducible example that exhibits that problem > >> on bugreports.qt.nokia.com, product "Qt", component > >> "core: i/o" (or whatever is close). > > I don't have an account (and don't want to have one), so I cannot report > > the bug. Maybe someone with an account could do that. I attach here a > > simple test case exhibiting the problem. > > > I reported it.
I had a look at the Qt sources and can now explain the failure. If the environment is not modified, execvp() is used to start the program, otherwise execve() is used. Now, execvp() is a frontend to execve() and when the process image file is not a valid executable object file (for example, it has not a shebang line) execve() returns the ENOEXEC error. In this case, execvp() use the contents of that file as standard input to the shell, such that execution may succeed. Instead, after execve() fails with ENOEXEC, Qt does not try to feed the file to the shell and simply reports the failure. So, if you use either setEnvironment() or setProcessEnvironment(), there are scripts that cannot be executed. A very good result which is a fine pair with the fact that batch files cannot be executed on Windows... -- Enrico