[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ast-developers
Subject:    [ast-developers] Re: Re: [ast-users] problem with "process
From:       dgk () research ! att ! com (David Korn)
Date:       2007-02-20 11:49:52
Message-ID: 200702201649.l1KGnnfA024328 () penguin ! research ! att ! com
[Download RAW message or body]

cc:  ast-developers@research.att.com 
Subject: Re: Re: [ast-users] problem with "process substitution" on Linux
--------


> Please post the fix patch
I have posted the patch below to the ast-developers group.
> 
> On 2/19/07, David Korn <dgk@research.att.com> wrote:
> > cc: dan.rickhoff@comcast.net
> > Subject: Re: [ast-users] problem with "process substitution" on Linux
> > --------
> >
> > > Hi,
> > >
> > > For the last several years my use of the Korn shell has been
> > > exclusively on SunOS/sparc machines.  Recently, I've started using
> > > ksh on Linux, on the machines at work.  I just ran into a problem
> > > with the Korn shell's "process substitution" feature on Linux.
> > > Here's a few examples:
> > >
> > > $ cat <(for i in x y z; do print $i; done)
> > > ./ksh: syntax error: `do' unexpected
> > >
> > > $ cat <(while :; do print; break; done)
> > > ./ksh: syntax error: `do' unexpected
> > >
> > > $ cat <(while :
> > >  > do
> > > ./ksh: syntax error: `do' unexpected
> > This is a bug in the lexical analyzer.  It is not recognizing reserved
> > words after a <( or >( token.  This will be fixed in the next release.
> > >
> > > #### However, the following works OK (and also provides some info you
> > > may want):
> > >
> > > $ cat <(print ${.sh.version}; print $-; /bin/uname -a | sed 's/ [^ ]
> > > * / ZZZZZZ /')
> > > Version M 1993-12-28 q
> > > ihmsE
> > > Linux ZZZZZZ 2.6.9-42.7.ELsmp #1 SMP Tue Sep 5 18:29:39 EDT 2006 i686
> > > athlon i386 GNU/Linux
> > >
> > > ### I downloaded the Linux i386 ksh "s" binary file, but it gave the
> > > same "do" error, but again the following was OK:
> > >
> > > $ cat <(print ${.sh.version}; print $-; /bin/uname -a | sed 's/ [^ ]
> > > * / ZZZZZZ /')
> > > Version M 1993-12-28 s
> > > ihmsBE
> > > Linux ZZZZZZ 2.6.9-42.7.ELsmp #1 SMP Tue Sep 5 18:29:39 EDT 2006 i686
> > > athlon i386 GNU/Linux
> > >
> > > ### Since the "process substitution" feature is associated with /dev/
> > > fd, here's a bit of info on that:
> > >
> > > $ ls -lLd /dev/fd
> > > dr-x------  2 drickhof eng 0 Feb 17 12:50 /dev/fd
> > >
> > > ### In case it matters, that's different than on the Sun machines I use:
> > >
> > > (SunOS) $ ls -lLd /dev/fd
> > > dr-xr-xr-x   2 root     root        2064 Feb 17 12:49 /dev/fd
> > >
> > > ### Any advise?
> > If you are building from the source code, I can supply the fix.
> > >
> > > Thanks,
> > > Dan
> > >
> > >
> >
> > David Korn
> > dgk@research.att.com

===================cut here======================

*** old/sh/lex.c	Fri Jan  5 17:24:09 2007
--- new/sh/lex.c	Mon Feb 19 10:39:15 2007
***************
*** 583,589 ****
--- 583,593 ----
  					else if(c!='<' && c!='>')
  						n = 0;
  					else if(n==LPAREN)
+ 					{
  						c  |= SYMLPAR;
+ 						lex.reservok = 1;
+ 						lex.skipword = 0;
+ 					}
  					else if(n=='|')
  						c  |= SYMPIPE;
  					else if(c=='<' && n=='>')

David Korn
dgk@research.att.com

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic