petdance/file-next

t/named-pipe.t fails on Android

Closed this issue · 2 comments

Howdy!

First of all, Android support isn't in perl yet, so, yeah. I'm filing this early because it's more of a bug in Android than in the port and so is unlikely to change.

The reason that it fails is because the test is using POSIX::tmpnam(), which on Android returns something like '/tmp/tmp.0.fvbH12534'. Single problem with that: android doesn't actually have a /tmp directory. This is just an issue with android's libc[0].

One relatively simply fix is to switch to File::Temp, which does the right thing for systems without /tmp.

[0] https://github.com/rapid7/meterpreter/blob/master/source/bionic/libc/stdio/tmpnam.c which uses P_tmpdir, and that's defined as "/tmp" in https://github.com/rapid7/meterpreter/blob/5e24206d510a48db284d5f399a6951cd1b4c754b/source/bionic/libc/include/stdio.h

Changed on 09c0c7b. Can you please test the changes on Android and see if they work?

Works fantastic, thank you!

shell@android:file-next # perl5.19.9 -E 'say "$^O: $^V"'
android: v5.19.9
shell@android:file-next # perl5.19.9 Makefile.PL
Checking if your kit is complete...
Looks good
Generating a Unix-style Makefile
Writing Makefile for File::Next
Writing MYMETA.yml and MYMETA.json
shell@android:file-next # make test
cp bench.pl blib/lib/File/bench.pl
cp Next.pm blib/lib/File/Next.pm
PERL_DL_NONLAZY=1 /mnt/asec/home/built/bin/perl5.19.9 "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef Test::Harness::Switches; test_harness(0, 'blib/lib', 'blib/arch')" t/.t
t/00-load.t ....... # Testing File::Next 1.12, Perl 5.019009, /mnt/asec/home/built/bin/perl5.19.9
t/00-load.t ....... ok
t/api.t ........... ok
t/basic.t ......... ok
t/dirs.t .......... ok
t/dot.t ........... ok
t/everything.t .... ok
t/follow.t ........ ok
t/from_file.t ..... ok
t/from_stdin.t .... ok
t/methods.t ....... ok
t/named-pipe.t .... ok
t/parms.t ......... ok
t/pod-coverage.t .. skipped: Test::Pod::Coverage 1.04 required for testing POD
t/pod.t ........... skipped: Test::Pod 1.14 required for testing POD
t/sort.t .......... ok
t/zero.t .......... ok
All tests successful.
Files=16, Tests=80, 3 wallclock secs ( 0.23 usr 0.07 sys + 2.24 cusr 0.26 csys = 2.80 CPU)
Result: PASS