[GHC] #2427: Allow compilation of source from stdin

View: New views
5 Messages — Rating Filter:   Alert me  

[GHC] #2427: Allow compilation of source from stdin

by GHC-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

#2427: Allow compilation of source from stdin
--------------------------------+-------------------------------------------
    Reporter:  guest            |       Owner:          
        Type:  feature request  |      Status:  new    
    Priority:  normal           |   Component:  Compiler
     Version:  6.8.3            |    Severity:  minor  
    Keywords:                   |    Testcase:          
Architecture:  Unknown          |          Os:  Unknown
--------------------------------+-------------------------------------------
 Hiya. So, as part of how the Hint library (a wrapper around the GHC API
 operates), it has to generate a file in /tmp containing module boilerplate
 and the supplied code of interesting, and it then evaluates it*. But for
 my mueval code (which uses Hint), I'd like to disable file creation
 entirely through resource limits, and so it would be much better for Hint
 if it could instead just create the string and pipe it right into GHC.
 This avoids any file creation (which may not be possible for any number of
 reasons besides resource limits, like LiveCDs or read-only disks). But in
 my experiments, and those of #haskell, GHC determinedly blocks any attempt
 - you can't simply pipe it in with |, you can't use /dev/stdin, can't use
 one of the file descriptors, etc.

 So what I would like is to be able to do:
 $ echo "import qualified Data.List\nmain = print $ Data.List.intersperse
 'f' "ggggg"

 "fgfgfgfgfgfg"

 (Why can't I use ghc -e? Doesn't do imports of any kind, and if mueval is
 to replicate lambdabot's functionality, it needs to be able to import many
 libraries qualified.**)

 * It has to do this roundabout hackish thing because alas, the GHC API
 seems to allow functions from any module whatsoever to be called as long
 as they are named qualified, even if the appropriate module had not been
 allowed in. The magnitude of this as a security hole is obvious.

 ** Why qualified? Too many of the basic libraries have name collisions.
 Can't remove them, as it'd be silly to have only half the base libraries
 or whatever, but can't just blindly import them as you'll get conflicts.

--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2427>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@...
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Re: [GHC] #2427: Allow compilation of source from stdin

by GHC-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

#2427: Allow compilation of source from stdin
--------------------------------+-------------------------------------------
    Reporter:  guest            |        Owner:        
        Type:  feature request  |       Status:  new    
    Priority:  normal           |    Milestone:        
   Component:  Compiler         |      Version:  6.8.3  
    Severity:  minor            |   Resolution:        
    Keywords:                   |     Testcase:        
Architecture:  Unknown          |           Os:  Unknown
--------------------------------+-------------------------------------------
Changes (by Isaac Dupree):

 * cc: id@... (added)

Comment:

 I ran into this before too.  I think it was when I was trying to run
 QuickCheck stuff with some script... Anyway, that could work fine for a
 single module, but GHC doesn't allow multiple modules in the same file, if
 you want to allow executing anything fancy like that using only stdin (
 reminding me to put #2428 ).

--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2427#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@...
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Re: [GHC] #2427: Allow compilation of source from stdin

by GHC-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

#2427: Allow compilation of source from stdin
--------------------------------+-------------------------------------------
    Reporter:  guest            |        Owner:        
        Type:  feature request  |       Status:  new    
    Priority:  normal           |    Milestone:        
   Component:  Compiler         |      Version:  6.8.3  
    Severity:  minor            |   Resolution:        
    Keywords:                   |     Testcase:        
Architecture:  Unknown          |           Os:  Unknown
--------------------------------+-------------------------------------------
Comment (by guest):

 Actually, I just remembered - this could be useful in Darcs as well.
 Currently Darcs's configure script generates a bunch of files with
 different module & FFI imports (corresponding to various functionalities
 to enable/disable) and sees whether they compile; if GHC returned a non-
 zero exit code on failed compilation of stdin, then that would simplify
 things a little bit.

--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2427#comment:2>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@...
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Re: [GHC] #2427: Allow compilation of source from stdin

by GHC-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

#2427: Allow compilation of source from stdin
-----------------------------+----------------------------------------------
 Reporter:  guest            |          Owner:        
     Type:  feature request  |         Status:  new    
 Priority:  normal           |      Milestone:        
Component:  Compiler         |        Version:  6.8.3  
 Severity:  minor            |     Resolution:        
 Keywords:                   |     Difficulty:  Unknown
 Testcase:                   |   Architecture:  Unknown
       Os:  Unknown          |  
-----------------------------+----------------------------------------------
Changes (by igloo):

  * difficulty:  => Unknown

Old description:

> Hiya. So, as part of how the Hint library (a wrapper around the GHC API
> operates), it has to generate a file in /tmp containing module
> boilerplate and the supplied code of interesting, and it then evaluates
> it*. But for my mueval code (which uses Hint), I'd like to disable file
> creation entirely through resource limits, and so it would be much better
> for Hint if it could instead just create the string and pipe it right
> into GHC. This avoids any file creation (which may not be possible for
> any number of reasons besides resource limits, like LiveCDs or read-only
> disks). But in my experiments, and those of #haskell, GHC determinedly
> blocks any attempt - you can't simply pipe it in with |, you can't use
> /dev/stdin, can't use one of the file descriptors, etc.
>
> So what I would like is to be able to do:
> $ echo "import qualified Data.List\nmain = print $ Data.List.intersperse
> 'f' "ggggg"
>
> "fgfgfgfgfgfg"
>
> (Why can't I use ghc -e? Doesn't do imports of any kind, and if mueval is
> to replicate lambdabot's functionality, it needs to be able to import
> many libraries qualified.**)
>
> * It has to do this roundabout hackish thing because alas, the GHC API
> seems to allow functions from any module whatsoever to be called as long
> as they are named qualified, even if the appropriate module had not been
> allowed in. The magnitude of this as a security hole is obvious.
>
> ** Why qualified? Too many of the basic libraries have name collisions.
> Can't remove them, as it'd be silly to have only half the base libraries
> or whatever, but can't just blindly import them as you'll get conflicts.
New description:

 Hiya. So, as part of how the Hint library (a wrapper around the GHC API
 operates), it has to generate a file in /tmp containing module boilerplate
 and the supplied code of interesting, and it then evaluates it*. But for
 my mueval code (which uses Hint), I'd like to disable file creation
 entirely through resource limits, and so it would be much better for Hint
 if it could instead just create the string and pipe it right into GHC.
 This avoids any file creation (which may not be possible for any number of
 reasons besides resource limits, like LiveCDs or read-only disks). But in
 my experiments, and those of #haskell, GHC determinedly blocks any attempt
 - you can't simply pipe it in with |, you can't use /dev/stdin, can't use
 one of the file descriptors, etc.

 So what I would like is to be able to do:
 {{{
 $ echo "import qualified Data.List\nmain = print $ Data.List.intersperse
 'f' "ggggg"

 "fgfgfgfgfgfg"
 }}}
 (Why can't I use ghc -e? Doesn't do imports of any kind, and if mueval is
 to replicate lambdabot's functionality, it needs to be able to import many
 libraries qualified.**)

 * It has to do this roundabout hackish thing because alas, the GHC API
 seems to allow functions from any module whatsoever to be called as long
 as they are named qualified, even if the appropriate module had not been
 allowed in. The magnitude of this as a security hole is obvious.

 ** Why qualified? Too many of the basic libraries have name collisions.
 Can't remove them, as it'd be silly to have only half the base libraries
 or whatever, but can't just blindly import them as you'll get conflicts.

--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2427#comment:3>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@...
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Re: [GHC] #2427: Allow compilation of source from stdin

by GHC-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

#2427: Allow compilation of source from stdin
-----------------------------+----------------------------------------------
 Reporter:  guest            |          Owner:            
     Type:  feature request  |         Status:  new        
 Priority:  low              |      Milestone:  6.12 branch
Component:  Compiler         |        Version:  6.8.3      
 Severity:  minor            |     Resolution:            
 Keywords:                   |     Difficulty:  Unknown    
 Testcase:                   |   Architecture:  Unknown    
       Os:  Unknown          |  
-----------------------------+----------------------------------------------
Changes (by igloo):

  * priority:  normal => low
  * milestone:  => 6.12 branch

Comment:

 This is probably quite low priority for us currently, so do add yourself
 to this ticket if it's important for you.

--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2427#comment:4>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@...
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
LightInTheBox - Buy quality products at wholesale price