Opened 8 years ago

Closed 7 years ago

Last modified 7 years ago

#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)

redirect.c.diff (470 bytes) - added by dmik 8 years ago.
redirect.c.2.diff (519 bytes) - added by dmik 8 years ago.

Download all attachments as: .zip

Change History (6)

Changed 8 years ago by dmik

Attachment: redirect.c.diff added

comment:1 Changed 8 years ago by dmik

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

Changed 8 years ago by dmik

Attachment: redirect.c.2.diff added

comment:2 Changed 7 years ago by dmik

Resolution: fixed
Status: newclosed

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 Changed 7 years ago by dmik

And another patch to make the new redirect builtin work on OS/2: https://github.com/bitwiseworks/kbuild-os2/commit/dda83257832709cf8b4c19596b520ca969c5d497

comment:4 Changed 7 years ago by dmik

And yet another fix (negated error check and missing EOL in error messages): https://github.com/bitwiseworks/kbuild-os2/commit/7130a2f60fed139c31dc06710f59a02da990e992

Note: See TracTickets for help on using tickets.