| Anonymous | Login | Signup for a new account | 2013-05-22 18:37 CEST | ![]() |
| Main | My View | View Issues | Change Log | Roadmap |
| View Issue Details [ Jump to Notes ] | [ Issue History ] [ Print ] | ||||||||||
| ID | Project | Category | View Status | Date Submitted | Last Update | ||||||
| 0004499 | OCaml | OCaml windows | public | 2008-02-05 18:10 | 2012-09-15 11:57 | ||||||
| Reporter | frisch | ||||||||||
| Assigned To | |||||||||||
| Priority | normal | Severity | minor | Reproducibility | always | ||||||
| Status | acknowledged | Resolution | open | ||||||||
| Platform | OS | Windows | OS Version | ||||||||
| Product Version | |||||||||||
| Target Version | 4.00.2+dev | Fixed in Version | |||||||||
| Summary | 0004499: Changes to the environment are invisible to Sys.getenv | ||||||||||
| Description | Windows has functions like SetEnvironmentVariable/GetEnvironmentVariable to access the process environment. The MS C runtime library also has getenv/putenv functions, but they operate on a snapshot of the environment taken when the process started. putenv also push modifications to the real environment through SetEnvironmentVariable. So, if we mix in a single process OCaml code and other native code that set environment variables directly (from .Net, we only have SetEnvironmentVariable, not putenv), these changes are not seen from OCaml, which uses getenv. A fix would be to use the "native" win32 functions for OCaml (not only for implementing Sys.getenv, but also for all the calls to getenv in the runtime system; and some care is needed for execve). (At LexiFi, we use a temporary solution: we have a function to "refresh" the local copy of the environment in the libc by fetching all the real environment variable and putenv'ing them.) | ||||||||||
| Tags | No tags attached. | ||||||||||
| Attached Files | |||||||||||
Notes |
|
|
(0004452) doligez (manager) 2008-02-19 14:49 |
I could easily argue that this is a bug in the getenv of the MS C runtime library. |
|
(0007582) frisch (developer) 2012-06-20 11:25 |
> I could easily argue that this is a bug in the getenv of the MS C runtime library. Probably, but it's easier (for us) to work-around the problem on the OCaml side than to convince Microsoft to fix their C runtime. As long as the effort remains reasonable, I think it's good to provide a coherent semantics between all the supported OCaml ports, even if this requires to work around bugs created by third parties. |
|
(0008078) doligez (manager) 2012-09-15 11:57 |
The right solution is probably to define our own functions sys_getenv and sys_putenv once with system-dependent code, and then use them everywhere. In fact, from your description it seems we only need to redefine getenv. |
Issue History |
|||
| Date Modified | Username | Field | Change |
| 2008-02-05 18:10 | frisch | New Issue | |
| 2008-02-19 14:49 | doligez | Note Added: 0004452 | |
| 2008-02-19 14:49 | doligez | Status | new => acknowledged |
| 2012-06-20 11:20 | frisch | Category | OCaml general => OCaml windows |
| 2012-06-20 11:25 | frisch | Note Added: 0007582 | |
| 2012-07-11 15:58 | doligez | Target Version | => 4.01.0+dev |
| 2012-07-31 13:37 | doligez | Target Version | 4.01.0+dev => 4.00.1+dev |
| 2012-09-15 11:57 | doligez | Note Added: 0008078 | |
| 2012-09-15 11:57 | doligez | Target Version | 4.00.1+dev => 4.00.2+dev |
| Copyright © 2000 - 2011 MantisBT Group |