Skip to content

SafeHaskell permits OPTIONS_GHC pragmas

This can be used to launch arbitrary processes at compile-time, and possibly other dangerous things as well. For example, I'm curious if it would be possible to override trust with OPTIONS_GHC -trust foo...

Test case, using the hsx preprocessor for XML literals:

{-# LANGUAGE Safe #-}
{-# OPTIONS_GHC -F -pgmF trhsx #-}
img = <img/>

The resulting error suggest that the trhsx program was in deed launched:

pp.hs:3:8: Not in scope: `genEElement'
Trac metadata
Trac field Value
Version 7.4.1
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information