On Mon, 6 Nov 2000, Nicholas Clark wrote:

> On Mon, Nov 06, 2000 at 01:29:52PM +0000, Alex Waugh wrote:
> > 
> > Hi
> > 
> > I have had a problem reported from someone using a Perl cgi script with
> > WebJames. They are trying to read data from a HTML form (using post),
> > using read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}).
> > However this hangs the machine, until either return or escape is pressed.
> > 
> > After a bit of investigating, I have found that this happens when WebJames
> > invokes the script with RISC OS style redirection, eg
> > scriptname { < scrapfilein > scrapfileout }
> > but when Unix style is used
> > scriptname < scrapfilein > scrapfileout
> > then the script does not hang, and produces the correct output.
> 
> I'm pretty sure that this is what's happening (waiting forever for a newline
> from the "terminal". The Unixlib code in unix.c.unix initially "opens"
> STDIN/OUT/ERR to "/dev/tty", and then processes any Unix style redirection
> on the command line.  "/dev/tty" creates file handles that read using
> OS_ReadC and write using OS_WriteC (rather than OS_GPBP calls on a RISC OS
> handle).

If this is the case then I guess it would be best to add a check in
UnixLib (at the time when it checks for unix style redirection) to see if
RISC OS is redirecting, and if so then set up the file descriptor as if
unix style redirection had been used. I /think/ there is a SWI to get info
about the RISC OS redirection status.

> I've got drafted a longer reply which I was about to send but then
> remembered something. I don't have an Acorn here to test things with.
> This could be a core perl bug to do with EOF not being spotted correctly
> on terminals (IIRC innards of perl do message tricks with ungetc to spot
> EOF "reliably" on some platforms that have broken stdio). That bug was
> fixed. Or it might be something Unixlib related.
> 
> I have a couple of ideas of how to fix it, but they differ depending on
> what the cause actually is!

Cheers

Alex

-- 
Alex Waugh  Electronics student  [EMAIL PROTECTED]

RISC OS freeware at http://www.ecs.soton.ac.uk/~ajw498/


Reply via email to