Ticket #2085 (new bug)

Opened 11 years ago

Last modified 11 years ago

Eliminate reliance during build on 'tempdir' in config settings

Reported by: jkeenan Owned by:
Priority: normal Milestone:
Component: configure Version: 3.2.0
Severity: medium Keywords:
Cc: Language:
Patch status: Platform:

Description

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<tempdir> ~ %config<slash> ~ 'test.pir';
./runtime/parrot/library/ProfTest/PIRProfile.nqp:67:
    my $tmp_pprof := %config<tempdir> ~ %config<slash> ~ '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

Change History

Changed 11 years ago by jkeenan

  • summary changed from Eliminate reliance on any 'tempdir' based on Perl 5's setting to Eliminate reliance during build on 'tempdir' in config settings
Note: See TracTickets for help on using tickets.