Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot install Test::File on Perl 5.32.0 MacOS Sierra

Tags:

perl

cpan

I'm attempting to install DateTime on my perlbrew 5.32.0, but the tests for its dependency Test::File are failing. The important part is as follows:

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.

I got similar errors earlier, but almost every package within my ~/.cpan directory has a blib so I'm not sure which directory cpan is talking about.

My OS is MacOS Sierra 10.12.6 (16G2136)

How can I resolve these errors to install DateTime?

like image 897
con Avatar asked Mar 01 '21 17:03

con


1 Answers

tl;dr: You've found a bug in a dependency. It's only used for testing. You can ignore the failed test, force install Test::File, then continue installing DateTime.

cpan -f -i Test::File
cpan DateTime
# File [blib] belongs to 703404669 (729761796), not 703404669 (703404669)!

The problem is your user name is a number and Test::File does not seem to account for that.

owner_is checks if a file is owned by the given user. It accepts a user name or numeric user ID. If its given a number it assumes it's a numeric ID. If 703404669 is your username it will get confused and use that as a user id. Your user id is really 729761796. 703404669 != 729761796.

Test::File can guard against this ambiguity by verifying with getpwuid and/or checking getpwnam first.

Congratulations, you've found a bug in Test::File. Please report it.

like image 58
Schwern Avatar answered Nov 11 '22 02:11

Schwern