我试图在我的perlbrew 5.32.0上安装DateTime
,但是对其依赖Test::File
的测试失败。重要的部分如下:
t/owner.t ..................... # File [blib] belongs to 703404669 (729761796), not 703404669 (703404669)!
t/owner.t ..................... 1/?
# Failed test 'owner_is with text username'
# at t/owner.t line 99.
# Failed test 'Intentional owner_isnt failure'
# at t/owner.t line 146.
# STDOUT is:
# > ok 1 - blib doesn't belong to 703404669
# not:
# > not ok 1 - blib doesn't belong to 703404669
# as expected
# STDERR is:
# >
# >
# >
# not:
# > # File [blib] belongs to 703404669 (729761796)!
# > # Failed test 'blib doesn't belong to 703404669'
# > # at t/owner.t line 145.
我之前得到了类似的错误,但几乎我的~/.cpan
目录中的每个包都有blib
,所以我不确定cpan在谈论哪个目录。
我的操作系统是MacOS Sierra 10.12.6 (16G2136)
安装DateTime
如何解决这些错误?
tl;dr:您在依赖项中发现了一个bug。它只用于测试。你可以忽略失败的测试,强制安装test::File,然后继续安装DateTime。
cpan -f -i Test::File
cpan DateTime
# File [blib] belongs to 703404669 (729761796), not 703404669 (703404669)!
问题是你的用户名是一个数字,而Test::File似乎没有考虑到这一点。
owner_is
检查文件是否为给定用户所有。它接受用户名或数字用户ID。如果给定一个数字,它会假设它是一个数字ID。如果703404669是你的用户名,它会混淆并使用它作为用户id。您的用户id实际上是729761796。= 729761796.
Test::File可以通过先检查getpwuid
和/或检查getpwnam
来防止这种歧义。
恭喜你,你在Test::File中发现了一个bug。请报告。