On Apr 20, 2008, at 7:09 PM, Bryan Blackburn wrote:

[about the Leopard problem where some ports fail to install properly with a seemingly endless variety of bizarre error messages if installing them causes a dependency to be installed first, but the port succeeds if you try the install a second time (because now it has no dependencies to install)]

Actually, it has something to do with the way the environment is setup and cleaned between stages within MacPorts. I've been trying to figure out whether this is a tcl bug, or something specific to the Mac OS X install of 8.4.7 (as of 10.5.2), since I can't make it happen with 8.5.2.

The basic issue is best demonstrated with a bit of code (first with the Mac-default 8.4.7):

% puts $env(CC)
can't read "env(CC)": no such variable
% set env(CC) "gcc"
gcc
% puts $env(CC)
gcc
% array unset env *
% puts $env(CC)

% puts [array get env]
... CC {} ...

Note how CC in the environment is now blank, but still exists, after the 'array unset env *' (and if you run this yourself, you'll see all the environment variables in that last command are {}).

Confirmed with Apple-provided tcl 8.4.7 on 10.5.2.

What it should do, and did (I believe) on 10.4 and does with 8.5.2:

% puts $env(CC)
can't read "env(CC)": no such variable
% set env(CC) "gcc"
gcc
% puts $env(CC)
gcc
% array unset env *
% puts $env(CC)
can't read "env(CC)": no such variable
% puts [array get env]

Here, after 'array unset env *' CC is no longer set in the environment. Which is how it should work. Note also, the last command doesn't show all env vars as empty but nothing there.

Confirmed with Apple-provided tcl 8.4.7 on 10.4.11.
Confirmed with MacPorts tcl 8.5.2 on 10.4.11.
Confirmed with MacPorts tcl 8.5.2 on 10.5.2.

We can't use 'array unset env' as that is documented to disconnect Tcl from the environment, and some messing around hasn't shown a clean way to work around this. Maybe a Tcl expert is needed, and determining if this is Mac-specific or 8.4.7; of course, either way, we have to deal with it.

FYI, this is done in portutil.tcl (base/src/port1.0/) in proc command_exec.

Thanks for the analysis! I added a link to your explanation to http:// trac.macports.org/wiki/LeopardProblems

Do we really not have a macports base ticket for this issue yet? I couldn't find one but maybe I'm searching wrong. We need one so that we can mark all the other port bugs that are cropping up as duplicates of it.

_______________________________________________
macports-users mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo/macports-users

Reply via email to