#127 closed defect (fixed)
kmh_redirect: Corrupted environment after unsetting environment variable
| Reported by: | dmik | Owned by: | |
|---|---|---|---|
| Priority: | critical | Milestone: | 0.2.0 |
| Component: | kmk | Version: | 0.1.5 |
| Keywords: | Cc: |
Description
On OS/2, unsetting an existing environment variable with -E 'VAR=' will kill e.g. the PATH setting. The following test shows this (assumes LANG is set):
kmk_redirect.exe -E 'LANG' -- cmd /c 'echo PATH=%PATH% & echo LANG=%LANG%'
This is a regression of r2699. The problem is that the EMX implementation of putenv forbids free-ing (or somehow reusing) strings passed to it.
Attachments (2)
Change History (6)
by , 10 years ago
| Attachment: | redirect.c.diff added |
|---|
comment:1 by , 10 years ago
by , 10 years ago
| Attachment: | redirect.c.2.diff added |
|---|
comment:2 by , 8 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
Due to latest changes in redirect.c, this patch doesn't seem relevant anymore. Testing r3051 on OS/2 shows that setting the env var works as it should. This, however, required a patch to make it buildable on OS/2 (a bunch of typos), it's here: https://github.com/bitwiseworks/kbuild-os2/commit/c41a6f6a8ab63106d7d95afde8f8c81193475756.
Closing this.
comment:3 by , 8 years ago
And another patch to make the new redirect builtin work on OS/2: https://github.com/bitwiseworks/kbuild-os2/commit/dda83257832709cf8b4c19596b520ca969c5d497
comment:4 by , 8 years ago
And yet another fix (negated error check and missing EOL in error messages): https://github.com/bitwiseworks/kbuild-os2/commit/7130a2f60fed139c31dc06710f59a02da990e992

The fix is trivial and attached. Alternatively,
unsetenvmay be used on OS/2 as well as on Linux (since KLIBC providesunsetenvas opposed to old EMX IIRC). Attaching it as well.