无法安装 CGI 模块

无法安装 CGI 模块

我在 Amazon EC2 Linux AMI 中安装 CGI 模块时遇到问题。在 CPAN 安装过程中失败。

#   Failed test 'write access to CGItest revoked'
#   at t/tmpdir.t line 30.

这是安装日志。我在这里做错了什么?

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

答案1

我今天也遇到了同样的问题(也是在 Amazon EC2 Linux AMI 上)。失败的测试是“错误的”。(它们之前由于“某些平台”上已知的故障而未运行,但由于未知原因在 2012 年 11 月 2 日发布的 CGI v3.61 中重新启用)

基本上,测试脚本在测试目录上执行“chmod 500”(与 TMPDIR 或 /tmp 无关),然后执行“-w $testdir”以查看目录是否可写。但当然,root 可以写入 500 目录而不会出现错误。因此,对于使用 root 权限安装 CGI 的任何人来说,这些测试都应该失败。

据我所知,这样做是完全安全的:

cpan>强制安装 CGI

相关内容