Re: [Haskell-cafe] createProcess running non-existent programs

2012-08-30 Thread Niklas Hambüchen
Well, overhead or not, it would be nice to at least have *some* solution. Currently, it just doesn't work. I am sure that as soon the functionality is there, somebody will step in to fake it fast. On 15/08/12 06:25, Donn Cave wrote: > Quoth Alexander Kjeldaas , > >> See access(2) > > ... a cla

Re: [Haskell-cafe] createProcess running non-existent programs

2012-08-14 Thread Donn Cave
Quoth Alexander Kjeldaas , > See access(2) ... a classic "code smell" in UNIX programming, for the same reasons. We can solve this problem in an efficient way that works well, and equally well, on any POSIX platform that supports F_CLOEXEC on pipes, and I can't think of anything that doesn't. T

Re: [Haskell-cafe] createProcess running non-existent programs

2012-08-14 Thread Alexander Kjeldaas
On 14 August 2012 17:22, Niklas Larsson wrote: > 2012/8/14 Alexander Kjeldaas : > > > > > > On 13 August 2012 23:49, Richard O'Keefe wrote: > >> > >> > >> On 13/08/2012, at 11:26 PM, Alexander Kjeldaas wrote: > >> > >> > > >> > This isn't that hard - a pipe shouldn't be needed anymore. Just > r

Re: [Haskell-cafe] createProcess running non-existent programs

2012-08-14 Thread Niklas Larsson
2012/8/14 Alexander Kjeldaas : > > > On 13 August 2012 23:49, Richard O'Keefe wrote: >> >> >> On 13/08/2012, at 11:26 PM, Alexander Kjeldaas wrote: >> >> > >> > This isn't that hard - a pipe shouldn't be needed anymore. Just require >> > a post-2003 glibc. >> > >> > fexecve is a system call in mo

Re: [Haskell-cafe] createProcess running non-existent programs

2012-08-14 Thread Alexander Kjeldaas
On 13 August 2012 23:49, Richard O'Keefe wrote: > > On 13/08/2012, at 11:26 PM, Alexander Kjeldaas wrote: > > > > > This isn't that hard - a pipe shouldn't be needed anymore. Just require > a post-2003 glibc. > > > > fexecve is a system call in most BSDs. It is also implemented in glibc > using

Re: [Haskell-cafe] createProcess running non-existent programs

2012-08-13 Thread Richard O'Keefe
On 13/08/2012, at 11:26 PM, Alexander Kjeldaas wrote: > > This isn't that hard - a pipe shouldn't be needed anymore. Just require a > post-2003 glibc. > > fexecve is a system call in most BSDs. It is also implemented in glibc using > a /proc hack. fexecve is now in the Single Unix Specific

Re: [Haskell-cafe] createProcess running non-existent programs

2012-08-13 Thread Donn Cave
Quoth Brandon Allbery , > On Mon, Aug 13, 2012 at 10:23 AM, Donn Cave wrote: > >> Though speaking of platforms, I guess one large headache would be >> what to do about Microsoft operating systems. Given the unusual >> > > Microsoft provides APIs that work as is for this, by my understanding; it's

Re: [Haskell-cafe] createProcess running non-existent programs

2012-08-13 Thread Brandon Allbery
On Mon, Aug 13, 2012 at 10:23 AM, Donn Cave wrote: > Though speaking of platforms, I guess one large headache would be > what to do about Microsoft operating systems. Given the unusual > Microsoft provides APIs that work as is for this, by my understanding; it's the POSIX fork/exec model that m

Re: [Haskell-cafe] createProcess running non-existent programs

2012-08-13 Thread Brandon Allbery
On Mon, Aug 13, 2012 at 7:26 AM, Alexander Kjeldaas < alexander.kjeld...@gmail.com> wrote: > This isn't that hard - a pipe shouldn't be needed anymore. Just require a > post-2003 glibc. > So, we are desupporting the *BSDs and OS X (and Solaris etc.) now? glibc is only used on Linux and the Hurd

Re: [Haskell-cafe] createProcess running non-existent programs

2012-08-13 Thread Donn Cave
Quoth Evan Laforge , ... > ... or at least make sure the haskell version doesn't suffer from > problems fixed in the python one. Exactly. This morning I'm reading suggested solutions that would work only some of the time, or on only some platforms, which wouldn't be satisfactory in the long run.

Re: [Haskell-cafe] createProcess running non-existent programs

2012-08-13 Thread Alexander Kjeldaas
This isn't that hard - a pipe shouldn't be needed anymore. Just require a post-2003 glibc. fexecve is a system call in most BSDs. It is also implemented in glibc using a /proc hack. http://www.kernel.org/doc/man-pages/online/pages/man3/fexecve.3.html Apparently, there are proposals/RFCs to get

Re: [Haskell-cafe] createProcess running non-existent programs

2012-08-13 Thread David Feuer
In Unix, at least, "check, then act" is generally considered unwise: 1. Something can go wrong between checking and acting. 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't have permission to execute it. You may not be able to

Re: [Haskell-cafe] createProcess running non-existent programs

2012-08-13 Thread Andrew Cowie
On Sun, 2012-08-12 at 23:18 -0700, Evan Laforge wrote: > Yes, I ran into the same thing a while back. The problem is that the > subprocess has already been forked off before it runs exec() and finds > out the file doesn't exist. Given how astonishingly common it is to pass an invalid executable n

Re: [Haskell-cafe] createProcess running non-existent programs

2012-08-12 Thread Evan Laforge
On Sun, Aug 12, 2012 at 6:18 PM, Niklas Hambüchen wrote: > I just came across the fact that running > > createProcess (proc "asdfasdf" []) > > with non-existing command "asdfasdf" returns perfectly fine handles. > I would expect an exception. > You can even hGetContents on stdout: You just get

[Haskell-cafe] createProcess running non-existent programs

2012-08-12 Thread Niklas Hambüchen
I just came across the fact that running createProcess (proc "asdfasdf" []) with non-existing command "asdfasdf" returns perfectly fine handles. I would expect an exception. You can even hGetContents on stdout: You just get "". I find this highly counter-intuitive. Is this intended? Thanks