Dammit. I am indeed wrong in this. I was pretty sure that popen on Unix *didn't* go via 'sh', but after digging deeper, you are completely correct.
We should revert that patch, and I'll write a new separate routine that doesn't use cmd.exe as a gateway. My Apologies. G -----Original Message----- From: Stanislav Malyshev [mailto:s...@zend.com] Sent: Wednesday, August 19, 2009 2:40 PM To: Garrett Serack; Pierre Cc: 'PHP Internals' Subject: [PHP-DEV] Re: [PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/NEWS branches/PHP_5_3/TSRM/tsrm_win32.c trunk/TSRM/tsrm_win32.c Hi! > Initially, this prevents popen_ex from failing when the actual > executable doesn't exist, since "cmd.exe /c c:\foo\bar\xxx.exe" will > *always* successfully start a process. This can be seen in bug > #43327. > > Second, is that by having the intermediate process, I'm pretty sure > there's some extra-buffering of the input/output streams going on > (once for the child proc, and once for the cmd.exe). This (probably > along with a too-small pipe buffer) contributes to the behavior found > in #44994. > > Finally, I can't for the life of me see what benefit this brings to > the table. Other languages don't need to put cmd.exe in the middle > of their children. The only case may be where someone wants to use > built-in cmd.exe commands like 'dir' on popen_ex() , which would not > be right anyway, and they should explicitly include the command > processor in their command line. It's pretty big semantic change, not just a bugfix, so I think it'd be nice to announce and discuss it on the list, not just put it as minor bugfix. Also it means that all output redirections, shell commands, etc. stop working for exec, system, etc. since they all use popen(). I see code out there that uses popen-dependent functions with all this stuff, so it makes serious BC break. Also, on Unix system, popen etc. by default use shell. I recognize there might be a need for calling processes directly, but I think this can and should be done in BC-compatible manner. -- Stanislav Malyshev, Zend Software Architect s...@zend.com http://www.zend.com/ (408)253-8829 MSN: s...@zend.com -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php