<div><br></div><div>This isn&#39;t that hard - a pipe shouldn&#39;t be needed anymore.  Just require a post-2003 glibc.</div><div><br></div>fexecve is a system call in most BSDs.  It is also implemented in glibc using a /proc hack.<div>

<br></div><div><div><a href="http://www.kernel.org/doc/man-pages/online/pages/man3/fexecve.3.html">http://www.kernel.org/doc/man-pages/online/pages/man3/fexecve.3.html</a></div><div><br></div><div>Apparently, there are proposals/RFCs to get a system called execveat into the linux kernel which makes this work properly without /proc.</div>

<div><br></div><div><a href="http://www.gossamer-threads.com/lists/linux/kernel/1574831">http://www.gossamer-threads.com/lists/linux/kernel/1574831</a><br><br>Alexander</div><div><br><div class="gmail_quote">On 13 August 2012 11:23, David Feuer <span dir="ltr">&lt;<a href="mailto:david.feuer@gmail.com" target="_blank">david.feuer@gmail.com</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><p>In Unix, at least, &quot;check, then act&quot; is generally considered unwise:<br>
1. Something can go wrong between checking and acting.<br>
2. You might not be checking the right thing(s).  In this case, the fact that the file exists is not useful if you don&#39;t have permission to execute it. You may not be able to determine whether you have the appropriate permissions without fairly deep manipulation of ACLs.<br>



3. Even if the OS has the info at hand, making the system call(s) necessary to get it is not free. Various non-free things happen every time control passes between user-space and kernel-space.</p>
<div class="gmail_quote"><div><div class="h5">On Aug 13, 2012 4:17 AM, &quot;Andrew Cowie&quot; &lt;<a href="mailto:andrew@operationaldynamics.com" target="_blank">andrew@operationaldynamics.com</a>&gt; wrote:<br type="attribution">

</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5">
On Sun, 2012-08-12 at 23:18 -0700, Evan Laforge wrote:<br>
&gt; Yes, I ran into the same thing a while back.  The problem is that the<br>
&gt; subprocess has already been forked off before it runs exec() and finds<br>
&gt; out the file doesn&#39;t exist.<br>
<br>
Given how astonishingly common it is to pass an invalid executable name<br>
and/or path, wouldn&#39;t it be worth doing a quick probe to see if the file<br>
exists before createProcess actually forks?<br>
<br>
[It&#39;s not like the effort the OS is going to do for the stat is going to<br>
be thrown away; whether that call pulls it up off of disk or the one<br>
after the fork that exec will do doesn&#39;t matter]<br>
<br>
AfC<br>
Sydney<br>
<br>
<br></div></div><div class="im">_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org" target="_blank">Haskell-Cafe@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
<br></div></blockquote></div>
<br>_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
<br></blockquote></div><br></div></div>