petdance/scratch — Issue #399: Eliminate reliance during build on 'tempdir' in config settings
Author: petdance
Created: 2011-11-01 05:42:14+00:00
State: open
Labels: bug, configure, Pri-normal, Sev-medium

This ticket addresses an issue which came to dominate discussion in TT #1544 and supersedes that ticket.
As noted by Benabik and Coke 12 months ago, the value for `tempdir` in ''config_lib.pir'' and ''lib/Parrot/Config/Generated.pm'' can be dramatically different on different OSes and on different versions on the same OS. For example, on my older Mac OS X 10.4.11, the results are straightforward and very Unix-ish:
{{{
$ grep -n tempdir config_lib.pir lib/Parrot/Config/Generated.pm
config_lib.pir:272: set $P0["tempdir"], "/tmp"
lib/Parrot/Config/Generated.pm:371: 'tempdir' => '/tmp',
}}}
But on later versions of Mac OS X, it can appear as something much more, errrm, clever:
{{{
set P0["tempdir"], "/var/folders/Bh/BhrBssnnHYqX6SDI8N3S1U+++TM/-Tmp-"
}}}
As Coke put it in TT #1544, it "like it's intended to be a one-time use tempdir, not something that we can save and reuse elsewhere." Benabik speculated that "I'm guessing ''launchd'' creates a new per-user temp dir at login. The problem here is that we're caching `TMPDIR` and there's no guarantee that it will be stable.''

In each case, `tempdir` is simply picked up from Perl 5 early in the configuration process:
{{{
$ grep -n tempdir config/init/defaults.pm
255: tempdir => File::Spec->tmpdir,
}}}
No magic there, but it suggests that it is the '''environment''' in which Perl 5 is built on different OS versions that controls what Perl 5 gets and what, in turn, Parrot gets.

Two courses of action are conceivable: One is to find some clever, Parrot-specific way of populating `tempdir`. The other is simply to extirpate any instance where `tempdir` is used in our build or test systems.

A bit of data on the latter option: Here are the locations in our source code where I can see something what the problem is:
{{{
$ find . -type f | xargs grep -n 'config.*tempdir'
./runtime/parrot/library/ProfTest/PIRProfile.nqp:66:
my $tmp_pir := %config ~ %config ~ 'test.pir';
./runtime/parrot/library/ProfTest/PIRProfile.nqp:67:
my $tmp_pprof := %config ~ %config ~ 'test.pprof';
}}}
Another datum: We have functions `tempdir()` and `tmpdir()` in '' ./runtime/parrot/library/osutils.pir''. Would they be of any use?

Thank you very much.

kid51

Originally http://trac.parrot.org/parrot/ticket/2085