Date: Sun, 7 Nov 2004 00:04:20 EST-10EDT,10,-1,0,7200,3,-1,0,7200,3600 Subject: [UnixOS2_Archive] No. 440 ************************************************** Saturday 06 November 2004 Number 440 ************************************************** Subjects for today 1 emx select() with new handles : Sebastian Wittmeier" 2 Building Apache/2 v2 : John Poltorak 3 Re: emx select() with new handles : Dave Yeo" 4 Re: emx select() with new handles : Sebastian Wittmeier" 5 Re: SED problem : Pete Milne 6 Re: emx select() with new handles : Knut St. Osmundsen" 1 Re: Building Apache/2 v2 : Steven Levine" 7 Re: SED problem : Steven Levine" 2 Re: SED problem : Steve Wendt 3 Re: SED problem : Steven Levine" 8 Re: SED problem : John Poltorak 9 Re: [Xfreeos2] Re: emx select() with new handles : Sebastian Wittmeier" 10 Re: emx select() with new handles : Sebastian Wittmeier" 11 Re: SED problem : Steve Wendt 12 Re: emx select() with new handles : Knut St. Osmundsen" 13 Re: emx select() with new handles : Andrew MacIntyre 14 Re: emx select() with new handles : John Poltorak 21 Re: SED problem : John Poltorak 4 Re: SED problem : John Poltorak **= Email 1 ==========================** Date: Fri, 05 Nov 2004 15:15:49 +0100 (CET) From: "Sebastian Wittmeier" Subject: emx select() with new handles Hi, working on Everblue I encountered a problem. The existing X11 applications (linked against good old emx) use select() to wait for events. My X11.dll opens a named pipe to get a file handle. When I compile X11.dll with emx, everything is fine. But when I use Innotek gcc, errno 9 (EBADF, Bad file number) arises on select(). Looking quickly through the source, I believe, the problem is that the new file handle is not registered in the handle_flags array of emx.dll, when opening the file with Innotek gcc. So how can I create valid file handles in an Innotek dll linked against an emx dll? The only one working seem to be standard in/out/err. Has anybody compiled XFree86/2 with Innotek GCC yet? And Encountered the same incompatibilities? Sebastian **= Email 2 ==========================** Date: Fri, 5 Nov 2004 14:38:38 +0000 From: John Poltorak Subject: Building Apache/2 v2 Is anyone aware of any instructions for building Apache v2 on OS/2? I found instructions for v1 which worked OK but haven't see anything for v2. Should I follow those for v1 at:- ? http://silk.apana.org.au/apache/building.html -- John **= Email 3 ==========================** Date: Fri, 05 Nov 2004 07:50:53 -0800 From: "Dave Yeo" Subject: Re: emx select() with new handles On Fri, 05 Nov 2004 15:15:49 +0100 (CET), Sebastian Wittmeier wrote: >Hi, >working on Everblue I encountered a problem. >The existing X11 applications (linked against good old emx) use >select() to wait for events. >My X11.dll opens a named pipe to get a file handle. When I compile >X11.dll with emx, everything is fine. But when I use Innotek gcc, errno >9 (EBADF, Bad file number) arises on select(). Looking quickly through >the source, I believe, the problem is that the new file handle is not >registered in the handle_flags array of emx.dll, when opening the file >with Innotek gcc. > >So how can I create valid file handles in an Innotek dll linked against >an emx dll? The only one working seem to be standard in/out/err. > >Has anybody compiled XFree86/2 with Innotek GCC yet? And Encountered >the same incompatibilities? > >Sebastian This is what Knut had to say last year This shouldn't be surprising to anyone which read the release notes and have followed some of the mails here. LIBC is at the moment using OS/2 socket handles untranslated. So, since there is like 32k sockets in the BSD 4.4 based stack, you might get somewhat higher socket handles than what BSD select would normally work with. And even if you were lucky and got a few low socket numbers it still wouldn't work since select() is called. LIBC select is at the moment not doing much. bsdselect() and os2_select() might be tried instead. I've built Blackbox with Innoteks GCC. the problems were, not getting the display. This problem was also inherited by any apps that were started by blackbox. Erratic mouse behaviour, mostly shown by menus not opening on mouse over. Dave **= Email 4 ==========================** Date: Fri, 05 Nov 2004 17:06:37 +0100 (CET) From: "Sebastian Wittmeier" Subject: Re: emx select() with new handles Frank Giessler wrote: >Sounds like Innotek's select() doesn't support pipes. I tried: The problem is also with normal files. And it is emx's select() - I open with Innotek dll and select with emx exe. >>So how can I create valid file handles in an Innotek dll linked against >>an emx dll? The only one working seem to be standard in/out/err. >> >>Has anybody compiled XFree86/2 with Innotek GCC yet? And Encountered >>the same incompatibilities? >> >>Sebastian >AFAIK, to use Innotek gcc for XFree86, it should (at least) treat > >pipes >PTYs >sockets > >just like ordinary file handles (you can use open(), read(), write(), >etc. on them). But maybe I'm wrong? > >Regards, >Frank. As far as I read the newest Innotek alpha has some improvements. But it has timebombed already. Sebastian **= Email 5 ==========================** Date: Fri, 05 Nov 2004 16:17:26 +0000 From: Pete Milne Subject: Re: SED problem John Poltorak wrote:
On Fri, Nov 05, 2004 at 01:00:04PM +0100, Stefan.Neis at t-online.de wrote:
  
        Hi,

    
sed  "/introtext/!d;s/.*\"^>\([0-9A-Za-z :.]*\).*$/\1,/"  foo >foo.tmp
sed: can't read >foo.tmp: No such file or directory
      
Is " > foo.tmp" in place of " >foo.tmp" any better?
    

Don't whether you meant I should includes quotes...

Just tried this and it works!

[X:\]sed  "/introtext/!d;s/.*\".\([0-9A-Za-z :.]*\).*$/\1,/"  foo ">foo.tmp"
sed: can't read : No such file or directory

[X:\]cat foo.tmp
19 September 2004,
19:37,
09457888444,
00:01:44,
0.042,

If someone can explain this, I'd be very interested to know why it works 
in this way. It seems very unexpected to me...


  
I don't know why the quotes in your example stop sed eating the command line, but
sed  >foo.tmp "/introtext/!d;s/.*\"^>\([0-9A-Za-z :.]*\).*$/\1,/"  foo

works as expected. 

Pete
**= Email 6 ==========================** Date: Fri, 05 Nov 2004 18:24:22 +0100 From: "Knut St. Osmundsen" Subject: Re: emx select() with new handles Sebastian Wittmeier wrote: > Hi, > working on Everblue I encountered a problem. > The existing X11 applications (linked against good old emx) use > select() to wait for events. > My X11.dll opens a named pipe to get a file handle. When I compile > X11.dll with emx, everything is fine. But when I use Innotek gcc, errno > 9 (EBADF, Bad file number) arises on select(). Looking quickly through > the source, I believe, the problem is that the new file handle is not > registered in the handle_flags array of emx.dll, when opening the file > with Innotek gcc. The first problem is that it's not a socket. But that should give you a EINVAL according to the code, so something else is broken. Come to think of it I haven't subjected LIBC to any named pipe handles yet, I'll give it a shot when I get home. Current LIBC doesn't support select() on anything but sockets. Nuke said he had some ideas about this 6 months ago, but I haven't gotten any code from him yet (and I don't blame him knowing that he's been extermely busy with real world stuff). Actually for named pipes there are peeking functions IIRC, so it shouldn't be too hard to select them. I'll try find time to do that for the next (not the first) LIBC release. Btw. the stuff about filehandles and stuff which was posted in some other reply is wrong now, libc now maps sockets into the filehandle space. > So how can I create valid file handles in an Innotek dll linked against > an emx dll? The only one working seem to be standard in/out/err. LIBC and EMX can use the same OS/2 filehandles, but they might easily have different opinions about them and get confused. Sending file streams (FILE, stdio.h) does not work. Kind Regards, knut PS. Sorry, about not having a new gcc ready with the bombs detonated last weekend. I'm trying my best to get a new release (LIBC06a3/GCC335) this weekend. It all depends on how much progress I make on the signal implementation. It will be an alpha too I'm afraid, the LIBC changes aren't tested well enough yet because lack of time. :/ **= Email 1 ==========================** Date: Fri, 05 Nov 2004 11:19:49 -0800 From: "Steven Levine" Subject: Re: Building Apache/2 v2 In <20041105143838.C84 at warpix.org>, on 11/05/04 at 02:38 PM, John Poltorak said: >Is anyone aware of any instructions for building Apache v2 on OS/2? I'm sure Brian is. Why not ask him? Steven -- ---------------------------------------------------------------------- "Steven Levine" MR2/ICE 2.60b #10183 Warp4/FP15/14.093c_W4 www.scoug.com irc.fyrelizard.com #scoug (Wed 7pm PST) ---------------------------------------------------------------------- **= Email 7 ==========================** Date: Fri, 05 Nov 2004 11:23:07 -0800 From: "Steven Levine" Subject: Re: SED problem In <20041105132048.A84 at warpix.org>, on 11/05/04 at 01:20 PM, John Poltorak said: >> > sed "/introtext/!d;s/.*\"^>\([0-9A-Za-z :.]*\).*$/\1,/" foo >foo.tmp >> > sed: can't read >foo.tmp: No such file or directory >> >If someone can explain this, I'd be very interested to know why it works >in this way. It seems very unexpected to me... It is entirely expected for cmd.exe. cmd.exe does not have a clue about how to escape quotes although it does detect them in some cases. When getting unexpected results, I always recommend simple test cases. Try: echo "\"" >foo.tmp echo "\""" >foo.tmp to understand what's happening. FWIW, 4OS2 supports escaped quotes. Steven -- ---------------------------------------------------------------------- "Steven Levine" MR2/ICE 2.60b #10183 Warp4/FP15/14.093c_W4 www.scoug.com irc.fyrelizard.com #scoug (Wed 7pm PST) ---------------------------------------------------------------------- **= Email 2 ==========================** Date: Fri, 5 Nov 2004 11:33:35 -0800 (PST) From: Steve Wendt Subject: Re: SED problem On Fri, 5 Nov 2004, Pete Milne wrote: > [X:\]sed "/introtext/!d;s/.*\".\([0-9A-Za-z :.]*\).*$/\1,/" foo ">foo.tmp" > If someone can explain this, I'd be very interested to know why it works > in this way. It seems very unexpected to me... > > I don't know why the quotes in your example stop sed eating the command > line, but It's not too hard to see the problem - cmd sees a begin quote without an end quote, and thus assumes that it should not handle > in the regular way. You don't need the final quote mark, only the one in front of the > symbol. **= Email 3 ==========================** Date: Fri, 05 Nov 2004 12:23:02 -0800 From: "Steven Levine" Subject: Re: SED problem In <20041105195400.H84 at warpix.org>, on 11/05/04 at 07:54 PM, John Poltorak said: >I thought you could use '^' as an escape character for cmd.exe... >Although it doesn't work with "... Maybe I can use the hex value for the >quotes character. Did I say something about simple testcases? To answer your own question, try: echo "^" >foo.tmp echo "^"" >foo.tmp cmd.exe is a poor excuse for a capable shell. Steven -- ---------------------------------------------------------------------- "Steven Levine" MR2/ICE 2.60b #10183 Warp4/FP15/14.093c_W4 www.scoug.com irc.fyrelizard.com #scoug (Wed 7pm PST) ---------------------------------------------------------------------- **= Email 8 ==========================** Date: Fri, 5 Nov 2004 19:54:00 +0000 From: John Poltorak Subject: Re: SED problem On Fri, Nov 05, 2004 at 11:23:07AM -0800, Steven Levine wrote: > In <20041105132048.A84 at warpix.org>, on 11/05/04 > at 01:20 PM, John Poltorak said: > > >> > sed "/introtext/!d;s/.*\"^>\([0-9A-Za-z :.]*\).*$/\1,/" foo >foo.tmp > >> > sed: can't read >foo.tmp: No such file or directory > >> > > >If someone can explain this, I'd be very interested to know why it works > >in this way. It seems very unexpected to me... > > It is entirely expected for cmd.exe. cmd.exe does not have a clue about > how to escape quotes although it does detect them in some cases. I thought you could use '^' as an escape character for cmd.exe... Although it doesn't work with "... Maybe I can use the hex value for the quotes character. > Steven > > -- > ---------------------------------------------------------------------- > "Steven Levine" MR2/ICE 2.60b #10183 Warp4/FP15/14.093c_W4 > www.scoug.com irc.fyrelizard.com #scoug (Wed 7pm PST) > ---------------------------------------------------------------------- -- John **= Email 9 ==========================** Date: Sat, 06 Nov 2004 02:43:18 +0100 (CET) From: "Sebastian Wittmeier" Subject: Re: [Xfreeos2] Re: emx select() with new handles Hi Dave, On Fri, 05 Nov 2004 07:50:53 -0800, Dave Yeo wrote: >This is what Knut had to say last year > >This shouldn't be surprising to anyone which read the release notes and >have followed some of the mails here. LIBC is at the moment using OS/2 >socket handles untranslated. So, since there is like 32k sockets in the >BSD 4.4 based stack, you might get somewhat higher socket handles than >what BSD select would normally work with. >And even if you were lucky and got a few low socket numbers it still >wouldn't work since select() is called. LIBC select is at the moment not >doing much. bsdselect() and os2_select() might be tried instead. > >I've built Blackbox with Innoteks GCC. the problems were, not getting the display. This problem was also inherited by any apps that were started by blackbox. Erratic mouse behaviour, mostly shown by menus not opening on mouse over. >Dave It is more a problem with emx. I call the emx select() with a file opened by Innotek open(). The Innotek open() gives an OS/2 file handle, but does not update emx internal information about open file handles. So emx select() does not recognize the handle. If that problem persists, XFree86/2 will never be compatible with both emx and Ilibc programs, but only with the kind itself is linked against. Sebastian **= Email 10 ==========================** Date: Sat, 06 Nov 2004 02:36:59 +0100 (CET) From: "Sebastian Wittmeier" Subject: Re: emx select() with new handles Hi Knut, On Fri, 05 Nov 2004 18:24:22 +0100, Knut St. Osmundsen wrote: >The first problem is that it's not a socket. But that should give you a >EINVAL according to the code, so something else is broken. Come to think >of it I haven't subjected LIBC to any named pipe handles yet, I'll give >it a shot when I get home. > >Current LIBC doesn't support select() on anything but sockets. Nuke said >he had some ideas about this 6 months ago, but I haven't gotten any code >from him yet (and I don't blame him knowing that he's been extermely >busy with real world stuff). > >Actually for named pipes there are peeking functions IIRC, so it >shouldn't be too hard to select them. I'll try find time to do that for >the next (not the first) LIBC release. Thank you for your reply. My message was a bit mistakable. The problem is that when open()ing a file with Innotek gcc, it cannot be selected with emx select(). I'm working with OS/2 file handles. The problem even arises with normal files (not named pipes). The (probable) explanation is, emx open() takes some notes about open file handles. Innotek open() does not take these notes. Therefore file handles cannot be exchanged. I suspect the handle_flags array to be the culprit, where emx stores the relevant information. >LIBC and EMX can use the same OS/2 filehandles, but they might easily >have different opinions about them and get confused. Sending file >streams (FILE, stdio.h) does not work. So - is it possible to share opinions between emx and libc? - should we patch emx.dll for better cooperation? - does every program which is involved in sharing handles (like every X11 program) have to be recompiled? >Kind Regards, > knut Sebastian **= Email 11 ==========================** Date: Fri, 5 Nov 2004 18:22:25 -0800 (PST) From: Steve Wendt Subject: Re: SED problem On Fri, 5 Nov 2004, John Poltorak wrote: > The '\"' in the middle of the sed script is meant to escape the '"'. The > script won't work without it. I guess I need to use the hex value of > quotes if I want this to work under cmd.exe... Unix utilities treat \ as an escape character, but cmd doesn't. **= Email 12 ==========================** Date: Sat, 06 Nov 2004 03:35:55 +0100 From: "Knut St. Osmundsen" Subject: Re: emx select() with new handles Sebastian Wittmeier wrote: > Hi Knut, > > On Fri, 05 Nov 2004 18:24:22 +0100, Knut St. Osmundsen wrote: > > >> The first problem is that it's not a socket. But that should give >> you a EINVAL according to the code, so something else is broken. >> Come to think of it I haven't subjected LIBC to any named pipe >> handles yet, I'll give it a shot when I get home. >> >> Current LIBC doesn't support select() on anything but sockets. Nuke >> said he had some ideas about this 6 months ago, but I haven't >> gotten any code from him yet (and I don't blame him knowing that >> he's been extermely busy with real world stuff). >> >> Actually for named pipes there are peeking functions IIRC, so it >> shouldn't be too hard to select them. I'll try find time to do that >> for the next (not the first) LIBC release. > > > Thank you for your reply. My message was a bit mistakable. The > problem is that when open()ing a file with Innotek gcc, it cannot be > selected with emx select(). > > I'm working with OS/2 file handles. The problem even arises with > normal files (not named pipes). The (probable) explanation is, emx > open() takes some notes about open file handles. Innotek open() does > not take these notes. Therefore file handles cannot be exchanged. I > suspect the handle_flags array to be the culprit, where emx stores > the relevant information. Tried importing the handle in emx? There is an _imphandle() or something function. LIBC does keep a handle table with additional information too, but it supports adopting OS/2 handles automatically. >> LIBC and EMX can use the same OS/2 filehandles, but they might >> easily have different opinions about them and get confused. Sending >> file streams (FILE, stdio.h) does not work. > > > So - is it possible to share opinions between emx and libc? - should > we patch emx.dll for better cooperation? - does every program which > is involved in sharing handles (like every X11 program) have to be > recompiled? tricky question... The basic idea of how we do LIBC is recompile-everything-because-legacy-sucks. But then recompiling X11 for LIBC is probably not possible yet and it may take a while since I'm not using it myself (on OS/2 that is). Generally speaking having more than one CRT in a process is a bit against the Unix filosophy and using both EMX and LIBC in the same process may not work well in all cases (like buffered standard handles, or sharing text file handles (because of lookahead), or passing CRT structures around). I think helping getting LIBC up to speed is more rewarding than spending time patching EMX. Kind Regards, knut **= Email 13 ==========================** Date: Sat, 6 Nov 2004 20:26:11 +1100 (EST) From: Andrew MacIntyre Subject: Re: emx select() with new handles On Sat, 6 Nov 2004, Sebastian Wittmeier wrote: > The (probable) explanation is, emx open() takes some notes about open > file handles. Innotek open() does not take these notes. Therefore file > handles cannot be exchanged. I suspect the handle_flags array to be the > culprit, where emx stores the relevant information. > > >LIBC and EMX can use the same OS/2 filehandles, but they might easily > >have different opinions about them and get confused. Sending file > >streams (FILE, stdio.h) does not work. > > So > - is it possible to share opinions between emx and libc? > - should we patch emx.dll for better cooperation? > - does every program which is involved in sharing handles (like every > X11 program) have to be recompiled? ISTM the EMX _imphandle() and _impsockhandle() routines are intended for dealing with these sorts of issues. ------------------------------------------------------------------------- Andrew I MacIntyre "These thoughts are mine alone..." E-mail: andymac at bullseye.apana.org.au (pref) | Snail: PO Box 370 andymac at pcug.org.au (alt) | Belconnen ACT 2616 Web: http://www.andymac.org/ | Australia **= Email 14 ==========================** Date: Sat, 6 Nov 2004 12:17:07 +0000 From: John Poltorak Subject: Re: emx select() with new handles On Sat, Nov 06, 2004 at 03:35:55AM +0100, Knut St. Osmundsen wrote: > > So - is it possible to share opinions between emx and libc? - should > > we patch emx.dll for better cooperation? - does every program which > > is involved in sharing handles (like every X11 program) have to be > > recompiled? > > tricky question... The basic idea of how we do LIBC is > recompile-everything-because-legacy-sucks. That is one of the reason's I'm trying to establish UX2BS as a standard build framework. If/when Innotek's gcc can replace EMX/GCC, I'd like to adopt that as the standard compiler and build everything from scratch if possible. That's why I'm assembling build scripts. > I think helping getting LIBC up to speed is more rewarding than spending > time patching EMX. I'm looking forward to being able to build Perl, which I believe is heavily reliant on EMXisms. But first I need to build PDKSH which is a prerequisite. Having a gcc I could run without changing the date would be nice ;-)... > Kind Regards, > knut > -- John **= Email 21 ==========================** Date: Fri, 5 Nov 2004 20:45:40 +0000 From: John Poltorak Subject: Re: SED problem On Fri, Nov 05, 2004 at 11:33:35AM -0800, Steve Wendt wrote: > On Fri, 5 Nov 2004, Pete Milne wrote: > > > [X:\]sed "/introtext/!d;s/.*\".\([0-9A-Za-z :.]*\).*$/\1,/" foo ">foo.tmp" > > If someone can explain this, I'd be very interested to know why it works > > in this way. It seems very unexpected to me... > > > > I don't know why the quotes in your example stop sed eating the command > > line, but > > It's not too hard to see the problem - cmd sees a begin quote without an > end quote, and thus assumes that it should not handle > in the regular > way. You don't need the final quote mark, only the one in front of the > > symbol. The '\"' in the middle of the sed script is meant to escape the '"'. The script won't work without it. I guess I need to use the hex value of quotes if I want this to work under cmd.exe... -- John **= Email 4 ==========================** Date: Fri, 5 Nov 2004 20:45:40 +0000 From: John Poltorak Subject: Re: SED problem On Fri, Nov 05, 2004 at 11:33:35AM -0800, Steve Wendt wrote: > On Fri, 5 Nov 2004, Pete Milne wrote: > > > [X:\]sed "/introtext/!d;s/.*\".\([0-9A-Za-z :.]*\).*$/\1,/" foo ">foo.tmp" > > If someone can explain this, I'd be very interested to know why it works > > in this way. It seems very unexpected to me... > > > > I don't know why the quotes in your example stop sed eating the command > > line, but > > It's not too hard to see the problem - cmd sees a begin quote without an > end quote, and thus assumes that it should not handle > in the regular > way. You don't need the final quote mark, only the one in front of the > > symbol. The '\"' in the middle of the sed script is meant to escape the '"'. The script won't work without it. I guess I need to use the hex value of quotes if I want this to work under cmd.exe... -- John