[41639] trunk/base/src/pextlib1.0/Pextlib.c

blb at macports.org blb at macports.org
Fri Nov 7 13:09:31 PST 2008


Revision: 41639
          http://trac.macports.org/changeset/41639
Author:   blb at macports.org
Date:     2008-11-07 13:09:31 -0800 (Fri, 07 Nov 2008)
Log Message:
-----------
pextlib1.0/Pextlib.c - it turns out Tcl gets a little confused when items
in the environment are removed (either via the complete clear or using
unsetenv()), so we need to force Tcl to sync back with the environment
after changing it (follow up to #13930)

Modified Paths:
--------------
    trunk/base/src/pextlib1.0/Pextlib.c

Modified: trunk/base/src/pextlib1.0/Pextlib.c
===================================================================
--- trunk/base/src/pextlib1.0/Pextlib.c	2008-11-07 21:06:17 UTC (rev 41638)
+++ trunk/base/src/pextlib1.0/Pextlib.c	2008-11-07 21:09:31 UTC (rev 41639)
@@ -1150,6 +1150,13 @@
     } else {
         (void) unsetenv(name);
     }
+    /* Tcl appears to become out of sync with the environment when we
+       unset things, eg, 'info exists env(CC)' will succeed where
+       'puts $env(CC)' will fail since it doesn't actually exist after
+       being unset here.  This forces Tcl to resync to the current state
+       (don't care about the actual result, so reset it) */
+    Tcl_Eval(interp, "array get env");
+    Tcl_ResetResult(interp);
 
     return TCL_OK;
 }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20081107/d3e84141/attachment.html>


More information about the macports-changes mailing list