<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">of course :)<div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On 12 Jun 2015, at 13:10, Thierry Goubier &lt;<a href="mailto:thierry.goubier@gmail.com" class="">thierry.goubier@gmail.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">Hi Esteban,<div class=""><br class=""></div><div class="">Can I do a pull request on that one?</div><div class=""><br class=""></div><div class="">There are a few things I'd like to see changed apart from the fork to vfork change, to improve some of the error handling. As the code is now, it is impossible, from Pharo, to make the difference between a git commit with no data to commit and a fail in the chdir.</div><div class=""><br class=""></div><div class="">Thierry<br class=""><div class="gmail_extra"><br class=""><div class="gmail_quote">2015-06-12 11:55 GMT+02:00 Esteban Lorenzano <span dir="ltr" class="">&lt;<a href="mailto:estebanlm@gmail.com" target="_blank" class="">estebanlm@gmail.com</a>&gt;</span>:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">btw… I cherry picked the change for oscog branch, but since I do not have rights I cannot push it back (another argument agains multiple separated repositories)<br class="">
<br class="">
Esteban<br class="">
<span class=""><br class="">
&gt; On 12 Jun 2015, at 04:26, David T. Lewis &lt;<a href="mailto:lewis@mail.msen.com" class="">lewis@mail.msen.com</a>&gt; wrote:<br class="">
&gt;<br class="">
</span><div class=""><div class="h5">&gt; Eliot, Esteban:<br class="">
&gt;<br class="">
&gt; Thiery Goubier has identified and fixed a critical bug in OSProcessPlugin. The<br class="">
&gt; issue was improper use of vfork() in a situation where fork() should be used. I<br class="">
&gt; apparently made this mistake many years ago, and I can't think of any good excuse<br class="">
&gt; for it. But I am very happy that Thiery has figured it out and fixed it after all<br class="">
&gt; this time :-)<br class="">
&gt;<br class="">
&gt; The fix is in VMConstruction-Plugins-OSProcessPlugin-dtl.40 and updated trunk<br class="">
&gt; SVN sources.<br class="">
&gt;<br class="">
&gt; It is important that we get this fix into the oscog and Pharo branches of OSPP,<br class="">
&gt; particularly because Thierry is running a Pharo VM and he needs the updates for<br class="">
&gt; work that he is doing there.<br class="">
&gt;<br class="">
&gt; Thierry provided the fix in the attached MCZ, which is relative to<br class="">
&gt; VMConstruction-Plugins-OSProcessPlugin.oscog-EstebanLorenzano.43 from the Pharo<br class="">
&gt; repository. This is derived from the oscog branch of OSPP, maybe a bit out of<br class="">
&gt; date but that is not important WRT this change.<br class="">
&gt;<br class="">
&gt; @Eliot: My suggestion would be to update to methods in UnixOSProcessPlugin method<br class="">
&gt; category 'primitives - fork and exec' to match the latest in the main branch. Alternatively<br class="">
&gt; you can copy the logic from #primitiveForkExec into the ##forkAndExecInDirectory: in<br class="">
&gt; your oscog branch (that method no longer exists in my main branch). The relevant<br class="">
&gt; snippet is:<br class="">
&gt;<br class="">
&gt;&nbsp; &nbsp; &nbsp; &nbsp;pid := self fork. "cCode: 'fork()' "<br class="">
&gt;&nbsp; &nbsp; &nbsp; &nbsp;pid &lt; 0<br class="">
&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ifTrue: [ self perror: 'fork'.<br class="">
&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;^self primitiveFail ].<br class="">
&gt;&nbsp; &nbsp; &nbsp; &nbsp;pid = 0<br class="">
&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ifFalse:<br class="">
&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[ "Normal return to Smalltalk - this is the old parent process."<br class="">
&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;"Enable the timer again before resuming Smalltalk."<br class="">
&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;self cCode: 'setitimer (ITIMER_REAL, &amp;saveIntervalTimer, 0L)'.<br class="">
&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;interpreterProxy pop: 10; pushInteger: pid<br class="">
&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;"Pop 9 arguments plus receiver, push pid."]<br class="">
&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ifTrue:<br class="">
&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[ "This is the new child process"<br class="">
&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;...<br class="">
&gt;<br class="">
&gt; @Esteban: You will probably want to follow Eliot's branch, but you can provide<br class="">
&gt; an immediate fix for Pharo by using Thierry's MCZ attached.<br class="">
&gt;<br class="">
&gt; Dave<br class="">
&gt;<br class="">
&gt;<br class="">
&gt; On Thu, Jun 11, 2015 at 09:08:16PM +0200, Thierry Goubier wrote:<br class="">
&gt;&gt; Le 11/06/2015 20:07, David T. Lewis a ?crit :<br class="">
&gt;&gt;&gt; Thank you!<br class="">
&gt;&gt;&gt;<br class="">
&gt;&gt;&gt; I am traveling, will follow up as soon as I am able.<br class="">
&gt;&gt;<br class="">
&gt;&gt; No worries, it will take a while to percolate to the final users.<br class="">
&gt;&gt;<br class="">
&gt;&gt; I'm testing it and I now have a nice result: if you enter a non-existent<br class="">
&gt;&gt; target directory for the fork, you will get the chdir error message on<br class="">
&gt;&gt; the stderr pipe inside Pharo :)<br class="">
&gt;&gt;<br class="">
&gt;&gt; Thierry<br class="">
&gt;&gt;<br class="">
&gt;&gt;&gt; Dave<br class="">
&gt;&gt;&gt;<br class="">
&gt;&gt;&gt;&gt; Ok, here is a VMConstruction-Plugins-OSProcessPlugin.oscog mcz... Only<br class="">
&gt;&gt;&gt;&gt; changes are in UnixOSProcessPlugin&gt;&gt;#forkAndExecInDirectory: . I'm using<br class="">
&gt;&gt;&gt;&gt; Esteban's version of the plugin as ancestor.<br class="">
&gt;&gt;&gt;&gt;<br class="">
&gt;&gt;&gt;&gt; I have an account now on squeaksource, at TppG&nbsp; :)<br class="">
&gt;&gt;&gt;&gt;<br class="">
&gt;&gt;&gt;&gt; Thierry<br class="">
&gt;&gt;&gt;&gt;<br class="">
&gt;&gt;&gt;&gt; 2015-06-11 16:32 GMT+02:00 Thierry Goubier &lt;<a href="mailto:thierry.goubier@gmail.com" class="">thierry.goubier@gmail.com</a>&gt;:<br class="">
&gt;&gt;&gt;&gt;<br class="">
&gt;&gt;&gt;&gt;&gt;<br class="">
&gt;&gt;&gt;&gt;&gt;<br class="">
&gt;&gt;&gt;&gt;&gt; 2015-06-11 15:35 GMT+02:00 Thierry Goubier &lt;<a href="mailto:thierry.goubier@gmail.com" class="">thierry.goubier@gmail.com</a>&gt;:<br class="">
&gt;&gt;&gt;&gt;&gt;<br class="">
&gt;&gt;&gt;&gt;&gt;&gt; I'm in the slang, and I have a question:<br class="">
&gt;&gt;&gt;&gt;&gt;&gt;<br class="">
&gt;&gt;&gt;&gt;&gt;&gt; Does it makes sense to call a primitiveFail in the child process after<br class="">
&gt;&gt;&gt;&gt;&gt;&gt; the fork? The parent will never get it, isn't it, and the child will<br class="">
&gt;&gt;&gt;&gt;&gt;&gt; exit<br class="">
&gt;&gt;&gt;&gt;&gt;&gt; immediately (and only return its exit status).<br class="">
&gt;&gt;&gt;&gt;&gt;&gt;<br class="">
&gt;&gt;&gt;&gt;&gt;&gt; (I suspect I didn't get the message 'non existent directory' because<br class="">
&gt;&gt;&gt;&gt;&gt;&gt; the<br class="">
&gt;&gt;&gt;&gt;&gt;&gt; primitiveFailFor: reset errno and hence the perror("chdir") prints<br class="">
&gt;&gt;&gt;&gt;&gt;&gt; nothing)<br class="">
&gt;&gt;&gt;&gt;&gt;&gt;<br class="">
&gt;&gt;&gt;&gt;&gt; Wrong, I got the perror, but couldn't make sense of it.<br class="">
&gt;&gt;&gt;&gt;&gt;<br class="">
&gt;&gt;&gt;&gt;&gt; OSProcess should return an error if a fork returns a pid of -1, and<br class="">
&gt;&gt;&gt;&gt;&gt; never<br class="">
&gt;&gt;&gt;&gt;&gt; let the process run or read data from the pipes.<br class="">
&gt;&gt;&gt;&gt;&gt;<br class="">
&gt;&gt;&gt;&gt;&gt; The question about primitiveFail in the child still holds :)<br class="">
&gt;&gt;&gt;&gt;&gt;<br class="">
&gt;&gt;&gt;&gt;&gt; I made the change in the UnixOSProcessPlugin in slang, on the pharo-vm<br class="">
&gt;&gt;&gt;&gt;&gt; distrib; however, there are differences with your version<br class="">
&gt;&gt;&gt;&gt;&gt; (VMConstruction-Plugins-OSProcessPlugin.oscog-eem.42), I'll have a look<br class="">
&gt;&gt;&gt;&gt;&gt; at<br class="">
&gt;&gt;&gt;&gt;&gt; backporting them.<br class="">
&gt;&gt;&gt;&gt;&gt;<br class="">
&gt;&gt;&gt;&gt;&gt; Thierry<br class="">
&gt;&gt;&gt;&gt;&gt;<br class="">
&gt;&gt;&gt;&gt;<br class="">
&gt;&gt;&gt;<br class="">
&gt;&gt;&gt;<br class="">
</div></div>&gt; &lt;VMConstruction-Plugins-OSProcessPlugin.oscog-ThierryGoubier.44.mcz&gt;<br class="">
<br class="">
</blockquote></div><br class=""></div></div></div>
</div></blockquote></div><br class=""></div></body></html>