Opened 6 years ago

Closed 5 years ago

Last modified 5 years ago

#7427 closed feature request (fixed)

Proposal: Add setEnv/unsetEnv to System.Environment

Reported by: SimonHengel Owned by:
Priority: normal Milestone: 7.8.1
Component: libraries/base Version: 7.6.1
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description

I propose to add setEnv/unsetEnv to System.Environment, so that it is easier to write applications that behave the same on POSIX and Windows systems.

Here is the corresponding thread on the libraries mailing list. The proposal was overall supported.

A patch is attached.

Attachments (1)

0001-Add-setEnv-unsetEnv-to-System.Environment.patch (6.6 KB) - added by SimonHengel 6 years ago.

Download all attachments as: .zip

Change History (8)

Changed 6 years ago by SimonHengel

comment:1 Changed 6 years ago by SimonHengel

comment:2 Changed 6 years ago by SimonHengel

The patch has been validated on Linux (amd64). I tested the Windows code in the context of a standalone package, but I have no means to run GHC's validate script on Windows. It would be awesome if somebody can help with that.

Corresponding Hspec tests are here: https://github.com/sol/setenv/blob/master/test/System/SetEnvSpec.hs

It was not obvious how to integrate them into GHC's build process. I tried a couple of things, but it's still not clear to me if/how I can run QC properties within GHC's build system. Let me know if you can help with that.

comment:3 Changed 5 years ago by igloo

difficulty: Unknown
Milestone: 7.8.1
Status: newpatch

Thanks for the patch; we'll take a look.

comment:4 Changed 5 years ago by igloo

Hmm, this patch duplicates some ugly configure code from the unix package. If we're going to split base up before 7.8, then it might be better to do that first, and then implement this code on top of unix.

comment:5 Changed 5 years ago by SimonHengel

In that case we can use my implementation from https://github.com/sol/setenv. It depends on unix and does not require any configure code.

If the split up does not happen in time, I would still vote for applying this patch.

comment:6 Changed 5 years ago by igloo

Resolution: fixed
Status: patchclosed

The base split is now scheduled or post-7.8-branch, and as the amount of duplication is small I went ahead and applied this.

comment:7 Changed 5 years ago by bgamari

I've updated the setenv package to re-export these symbols here, https://github.com/sol/setenv/pull/2

Note: See TracTickets for help on using tickets.