Skip to content

check_header() fails if called from a read-only location #297

Open
@ppisar

Description

@ppisar

check_header() fails if called from a read-only location:

$ cd /
$ perl -e 'use Alien::SDL; Alien::SDL::check_header(q{SDL.h})'
[SDL.h] Testing header(s): Error in tempfile() using template aaXXXX.c: Could not create temp file aam5Xl.c: Permission denied at /usr/share/perl5/vendor_perl/Alien/SDL.pm line 243.

A fix is:

diff --git a/lib/Alien/SDL.pm b/lib/Alien/SDL.pm
index 582ef27..b06976e 100644
--- a/lib/Alien/SDL.pm
+++ b/lib/Alien/SDL.pm
@@ -240,7 +240,7 @@ sub check_header {
   }
 
   my $cb = ExtUtils::CBuilder->new( quiet => 1, config => $config );
-  my ($fs, $src) = File::Temp::tempfile('aaXXXX', SUFFIX => '.c', UNLINK => 1);
+  my ($fs, $src) = File::Temp::tempfile('aaXXXX', SUFFIX => '.c', TMPDIR => 1, UNLINK => 1);
   my $inc = '';
   my $i = 0;
   foreach (@header) {

Tested with Alien-SDL-1.446, the latest release on CPAN.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions