[Ur] getenv segfaults when called from task initialize
Adam Chlipala
adamc at csail.mit.edu
Fri Mar 7 13:17:28 EST 2014
OK, I've changed [getenv] behavior to call UNIX getenv() in task handlers.
On 03/05/2014 02:20 AM, Sergey Mironov wrote:
> I'm working on a firmawre-builder application where servers are used
> to start the compiler which would build the customized firmware on
> user request. I need some mechanisms which would allow me to pass
> parameters to the server. Currently, the only parameter is the path to
> the sources to build. In future I plan to add support for switching
> revisions so I will probably need more parameters (path to sources,
> git revision hash, etc). Ideally, I'd like to query the application's
> command line arguments, but since there is no such an option at the
> moment, I chose the environment variables. According to my plan, each
> new server instance should check it's arguments at the startup and the
> register itself in the database.
>
> I think I can easily write an ffi to read the environment but of cause
> I'd prefer some unified mechanism for doing such a simple thing.
>
> Regards,
> Sergey
>
>
> 2014-03-04 17:50 GMT+04:00 Adam Chlipala<adamc at csail.mit.edu>:
>
>> 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.
>>
>> _______________________________________________
>> Ur mailing list
>> Ur at impredicative.com
>> http://www.impredicative.com/cgi-bin/mailman/listinfo/ur
>>
> _______________________________________________
> Ur mailing list
> Ur at impredicative.com
> http://www.impredicative.com/cgi-bin/mailman/listinfo/ur
>
More information about the Ur
mailing list