I am having trouble having installing CGI module in Amazon EC2 Linux AMI. During the CPAN install process it fails.
# Failed test 'write access to CGItest revoked'
# at t/tmpdir.t line 30.
Here are the install logs. What am I doing wrong here?
cpan[1]> install CGI
CPAN: Storable loaded ok (v2.39)
Reading '/root/.cpan/Metadata'
Database was generated on Mon, 05 Nov 2012 08:13:43 GMT
Running install for module 'CGI'
Running make for M/MA/MARKSTOS/CGI.pm-3.61.tar.gz
CPAN: Digest::SHA loaded ok (v5.73)
CPAN: Compress::Zlib loaded ok (v2.055)
Checksum for /root/.cpan/sources/authors/id/M/MA/MARKSTOS/CGI.pm-3.61.tar.gz ok
Scanning cache /root/.cpan/build for sizes
....................................................................--------DONE
DEL(1/24): /root/.cpan/build/CGI.pm-3.61-i4VRsc
CPAN: YAML loaded ok (v0.84)
DEL(2/24): /root/.cpan/build/CGI.pm-3.61-i4VRsc.yml
DEL(3/24): /root/.cpan/build/CGI.pm-3.61-7xSHPZ
DEL(4/24): /root/.cpan/build/CGI.pm-3.61-7xSHPZ.yml
DEL(5/24): /root/.cpan/build/CGI.pm-3.61-L3Axhx
DEL(6/24): /root/.cpan/build/CGI.pm-3.61-L3Axhx.yml
DEL(7/24): /root/.cpan/build/Attribute-Handlers-0.93-1zOL4z
DEL(8/24): /root/.cpan/build/Attribute-Handlers-0.93-1zOL4z.yml
DEL(9/24): /root/.cpan/build/AutoLoader-5.73-LmGM0D
DEL(10/24): /root/.cpan/build/AutoLoader-5.73-LmGM0D.yml
DEL(11/24): /root/.cpan/build/B-Debug-1.18-oTrAkK
DEL(12/24): /root/.cpan/build/B-Debug-1.18-oTrAkK.yml
DEL(13/24): /root/.cpan/build/B-Lint-1.14-X_Cuh3
DEL(14/24): /root/.cpan/build/B-Lint-1.14-X_Cuh3.yml
DEL(15/24): /root/.cpan/build/CPAN-1.9800-kAG75p
DEL(16/24): /root/.cpan/build/CPAN-1.9800-kAG75p.yml
DEL(17/24): /root/.cpan/build/Carp-1.26-kP93C6
DEL(18/24): /root/.cpan/build/Carp-1.26-kP93C6.yml
DEL(19/24): /root/.cpan/build/Class-ISA-0.36-7ZQhYH
DEL(20/24): /root/.cpan/build/Class-ISA-0.36-7ZQhYH.yml
DEL(21/24): /root/.cpan/build/DB_File-1.827-A5XIw4.yml
DEL(22/24): /root/.cpan/build/DB_File-1.827-A5XIw4
DEL(23/24): /root/.cpan/build/Data-Dumper-2.136-oJuqF3
DEL(24/24): /root/.cpan/build/Data-Dumper-2.136-oJuqF3.yml
CPAN: Archive::Tar loaded ok (v1.90)
CGI.pm-3.61/
CGI.pm-3.61/README
CGI.pm-3.61/examples/
CGI.pm-3.61/examples/javascript.cgi
CGI.pm-3.61/examples/popup.cgi
CGI.pm-3.61/examples/make_links.pl
CGI.pm-3.61/examples/caution.xbm
CGI.pm-3.61/examples/frameset.cgi
CGI.pm-3.61/examples/clickable_image.cgi
CGI.pm-3.61/examples/save_state.cgi
CGI.pm-3.61/examples/internal_links.cgi
CGI.pm-3.61/examples/tryit.cgi
CGI.pm-3.61/examples/crash.cgi
CGI.pm-3.61/examples/monty.cgi
CGI.pm-3.61/examples/customize.cgi
CGI.pm-3.61/examples/nph-clock.cgi
CGI.pm-3.61/examples/index.html
CGI.pm-3.61/examples/file_upload.cgi
CGI.pm-3.61/examples/diff_upload.cgi
CGI.pm-3.61/examples/wilogo.gif
CGI.pm-3.61/examples/cookie.cgi
CGI.pm-3.61/examples/dna.small.gif
CGI.pm-3.61/examples/multiple_forms.cgi
CGI.pm-3.61/examples/nph-multipart.cgi
CGI.pm-3.61/examples/WORLD_WRITABLE/
CGI.pm-3.61/examples/WORLD_WRITABLE/18.157.1.253.sav
CGI.pm-3.61/META.json
CGI.pm-3.61/Makefile.PL
CGI.pm-3.61/MANIFEST
CGI.pm-3.61/META.yml
CGI.pm-3.61/cgi_docs.html
CGI.pm-3.61/t/
CGI.pm-3.61/t/start_end_start.t
CGI.pm-3.61/t/Dump.t
CGI.pm-3.61/t/push.t
CGI.pm-3.61/t/cookie.t
CGI.pm-3.61/t/checkbox_group.t
CGI.pm-3.61/t/gen-tests/
CGI.pm-3.61/t/gen-tests/gen-start-end-tags.pl
CGI.pm-3.61/t/fast.t
CGI.pm-3.61/t/html.t
CGI.pm-3.61/t/upload_post_text.txt
CGI.pm-3.61/t/delete.t
CGI.pm-3.61/t/can.t
CGI.pm-3.61/t/charset.t
CGI.pm-3.61/t/utf8.t
CGI.pm-3.61/t/unescapeHTML.t
CGI.pm-3.61/t/user_agent.t
CGI.pm-3.61/t/util-58.t
CGI.pm-3.61/t/headers.t
CGI.pm-3.61/t/upload.t
CGI.pm-3.61/t/param_fetch.t
CGI.pm-3.61/t/end_form.t
CGI.pm-3.61/t/query_string.t
CGI.pm-3.61/t/start_end_end.t
CGI.pm-3.61/t/no_tabindex.t
CGI.pm-3.61/t/util.t
CGI.pm-3.61/t/request.t
CGI.pm-3.61/t/rt-52469.t
CGI.pm-3.61/t/hidden.t
CGI.pm-3.61/t/multipart_init.t
CGI.pm-3.61/t/uploadInfo.t
CGI.pm-3.61/t/form.t
CGI.pm-3.61/t/url.t
CGI.pm-3.61/t/autoescape.t
CGI.pm-3.61/t/init_test.txt
CGI.pm-3.61/t/http.t
CGI.pm-3.61/t/save_read_roundtrip.t
CGI.pm-3.61/t/init.t
CGI.pm-3.61/t/apache.t
CGI.pm-3.61/t/switch.t
CGI.pm-3.61/t/pretty.t
CGI.pm-3.61/t/start_end_asterisk.t
CGI.pm-3.61/t/tmpdir.t
CGI.pm-3.61/t/carp.t
CGI.pm-3.61/t/popup_menu.t
CGI.pm-3.61/t/function.t
CGI.pm-3.61/Changes
CGI.pm-3.61/lib/
CGI.pm-3.61/lib/CGI/
CGI.pm-3.61/lib/CGI/Cookie.pm
CGI.pm-3.61/lib/CGI/Switch.pm
CGI.pm-3.61/lib/CGI/Fast.pm
CGI.pm-3.61/lib/CGI/Util.pm
CGI.pm-3.61/lib/CGI/Carp.pm
CGI.pm-3.61/lib/CGI/Pretty.pm
CGI.pm-3.61/lib/CGI/Push.pm
CGI.pm-3.61/lib/CGI/Apache.pm
CGI.pm-3.61/lib/CGI.pm
CPAN: File::Temp loaded ok (v0.22)
CPAN: Parse::CPAN::Meta loaded ok (v1.4404)
CPAN: CPAN::Meta loaded ok (v2.120921)
CPAN.pm: Building M/MA/MARKSTOS/CGI.pm-3.61.tar.gz
Checking if your kit is complete...
Looks good
Writing Makefile for CGI
Writing MYMETA.yml and MYMETA.json
CPAN: Module::CoreList loaded ok (v2.76)
cp lib/CGI/Switch.pm blib/lib/CGI/Switch.pm
cp lib/CGI/Cookie.pm blib/lib/CGI/Cookie.pm
cp lib/CGI/Pretty.pm blib/lib/CGI/Pretty.pm
cp lib/CGI.pm blib/lib/CGI.pm
cp lib/CGI/Carp.pm blib/lib/CGI/Carp.pm
cp lib/CGI/Apache.pm blib/lib/CGI/Apache.pm
cp lib/CGI/Util.pm blib/lib/CGI/Util.pm
cp lib/CGI/Push.pm blib/lib/CGI/Push.pm
cp lib/CGI/Fast.pm blib/lib/CGI/Fast.pm
Manifying blib/man3/CGI::Switch.3pm
Manifying blib/man3/CGI::Cookie.3pm
Manifying blib/man3/CGI::Pretty.3pm
Manifying blib/man3/CGI.3pm
Manifying blib/man3/CGI::Carp.3pm
Manifying blib/man3/CGI::Apache.3pm
Manifying blib/man3/CGI::Util.3pm
Manifying blib/man3/CGI::Push.3pm
Manifying blib/man3/CGI::Fast.3pm
MARKSTOS/CGI.pm-3.61.tar.gz
/usr/bin/make -- OK
Running make test
PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t t/headers/*.t
t/apache.t ............... ok
t/autoescape.t ........... ok
t/can.t .................. ok
t/carp.t ................. ok
t/charset.t .............. ok
t/checkbox_group.t ....... ok
t/cookie.t ............... ok
t/delete.t ............... ok
t/Dump.t ................. ok
t/end_form.t ............. ok
t/fast.t ................. ok
t/form.t ................. ok
t/function.t ............. ok
t/headers.t .............. ok
t/hidden.t ............... ok
t/html.t ................. ok
t/http.t ................. ok
t/init.t ................. ok
t/multipart_init.t ....... ok
t/no_tabindex.t .......... ok
t/param_fetch.t .......... ok
t/popup_menu.t ........... ok
t/pretty.t ............... ok
t/push.t ................. ok
t/query_string.t ......... ok
t/request.t .............. ok
t/rt-52469.t ............. ok
t/save_read_roundtrip.t .. ok
t/start_end_asterisk.t ... ok
t/start_end_end.t ........ ok
t/start_end_start.t ...... ok
t/switch.t ............... ok
t/tmpdir.t ............... 1/9
# Failed test 'write access to CGItest revoked'
# at t/tmpdir.t line 24.
# Failed test 'unwritable $CGITempFile::TMPDIRECTORY overridden'
# at t/tmpdir.t line 26.
# got: 'CGItest'
# expected: 'CGItest2'
# Failed test 'write access to CGItest revoked'
# at t/tmpdir.t line 30.
# Failed test 'unwritable $ENV{TMPDIR} not overridden with an unwritable $CGITempFile::TMPDIRECTORY'
# at t/tmpdir.t line 34.
# got: 'CGItest'
# expected: anything else
# Looks like you failed 4 tests of 9.
t/tmpdir.t ............... Dubious, test returned 4 (wstat 1024, 0x400)
Failed 4/9 subtests
t/unescapeHTML.t ......... ok
t/upload.t ............... ok
t/uploadInfo.t ........... ok
t/url.t .................. ok
t/user_agent.t ........... ok
t/utf8.t ................. ok
t/util-58.t .............. ok
t/util.t ................. ok
Test Summary Report
-------------------
t/tmpdir.t (Wstat: 1024 Tests: 9 Failed: 4)
Failed tests: 4-5, 7, 9
Non-zero exit status: 4
Files=41, Tests=707, 2 wallclock secs ( 0.19 usr 0.23 sys + 1.38 cusr 0.44 csys = 2.24 CPU)
Result: FAIL
Failed 1/41 test programs. 4/707 subtests failed.
make: *** [test_dynamic] error 255
MARKSTOS/CGI.pm-3.61.tar.gz
/usr/bin/make test -- NOT OK
//hint// to see the cpan-testers results for installing this module, try:
reports MARKSTOS/CGI.pm-3.61.tar.gz
Running make install
make test had returned bad status, won't install without force
I ran into this exact same problem today (also on an Amazon EC2 Linux AMI). The tests that are failing are "wrong". (they were previously not run due to known failures on "some platforms", but for unknown reasons re-enabled in CGI v3.61, released 2nd Nov 2012)
Basically the test script is doing "chmod 500" on a test directory (which has nothing to do with TMPDIR or /tmp), then doing "-w $testdir" to see if the directory is writable afterwards. But of course root can write to a 500 directory without error. So these tests should fail for anyone installing CGI with root privileges.
From what I can see it is perfectly safe to just:
cpan> force install CGI