Subject: | File-HomeDir-0.64 fails tests on Cygwin |
Tests 27 and 29 fail
----------------------------------------
$ perl -I../lib 02_main.t
1..52
ok 1 - home(undef)
(...)
ok 26 - Different APIs give same results
not ok 27 - home(username) returns the same value
# Failed test 'home(username) returns the same value'
# at 02_main.t line 205.
# got: undef
# expected: '/cygdrive/h/home/peter'
ok 28 - Legacy %~ tied interface
not ok 29 - Legacy %~ tied interface
# Failed test 'Legacy %~ tied interface'
# at 02_main.t line 211.
# got: undef
# expected: '/cygdrive/h/home/peter'
ok 30 - Found our home directory
(...)
----------------------------------------
I have only looked at test 27. The test compares home(getpwuid($<)) with
$home.
In my case, $home is '/cygdrive/h/home/peter' because the HOME
environment variable is set in Windows and inherited by Cygwin.
The home(getpwuid($<)) ends up by calling
File::HomeDir::Unix::users_home('Administrator') which is correct. In
that function, the problem happens at
SCOPE: {
my $home = (getpwnam($name))[7];
return $home if $home and -d $home;
}
return undef;
(getpwnam($name))[7] returns '/home/Administrator' which comes from the
file '/etc/passwd'. Not only is it incorrect, but since the directory
doesn't exist, the -d test failes and the function returns undef.
I'm not sure if the main problem is with Cygwin in general, my setup, or
with this module, but every other application and program works just
fine with HOME set and no-one else is looking for '/home/Administrator'
except this module.