Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ppisar opened this issue Jun 10, 2021 · 0 comments
Open

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

ppisar opened this issue Jun 10, 2021 · 0 comments

Comments

@ppisar
Copy link

ppisar commented Jun 10, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant