Heribert Schuetz <[EMAIL PROTECTED]> writes:

> Hi,
> 
> The appended patch to Hugs98 (to be applied in the src subdirectory)
> might be of some help for those who want to do shell scripting in
> Haskell. It modifies IO.openFile as follows:
> 
> - If the name of a file opened in ReadMode ends in "|", then the part
>   before the "|" is considered a program and its standard output is
>   read.
> 
> - If the name of a file opened in WriteMode begins with "|", then the
>   part after the "|" is considered a program and it is written to its
>   standard input.
> 
> Several Unix programs have such a behaviour.

I'd recommend against this; it's a potential source of nasty security
holes.  (Suppose somebody uses this version of Hugs to write a system
utility...something like "grep", say.  And then does "cd /tmp; mygrep
whatever *".  And suppose somebody else has created a file named
"/tmp/rm -rf ..|".)

A new function, openFilePipe say, with security warnings in the
documentation, would be better.

Carl Witty


Reply via email to