[Ur] getenv segfaults when called from task initialize

Adam Chlipala adamc at csail.mit.edu
Tue Mar 4 08:50:22 EST 2014


On 03/04/2014 04:20 AM, Sergey Mironov wrote:
> Hi. The following simple program ends with SIGSEGV:
>
> task initialize = fn _ =>
>    v<- getenv (blessEnvVar "USER");
>    return {}
>    

Thanks, good catch.  I've changed the behavior so that [getenv] just 
returns [None], when called outside a web request handler.

I actually never intended [getenv] to be used with standalone HTTP 
servers, but rather only to be used by programs that will be called by a 
web server like Apache, which sets environment variables to indicate 
properties of a request.  Possibly the semantics of [getenv] should be 
extended to always check UNIX environment variables when no web request 
is active, but I figured I'd start with something simple and more 
secure.  We can add new behaviors as good arguments for them are presented.



More information about the Ur mailing list