Subject: | Darwin plug-in can return wrong directory. |
I believe I have found a couple cases where the Darwin plug-in for
File::HomeDir returns the wrong directory.
The first case is that users_home() appears to return the current
directory if the user does not exist.
The second case is that users_data() (and presumably the other users_*
methods that go through _to_user()) appears to ignore the username and
return the same directory as my_data (or, presumably, the corresponding
my_* method).
The first case seems to be because Darwin.pm's users_home() appears to
assume that Cwd::abs_path returns undef if given undef as an argument;
but my copy (version 3.2701) appears to return the current directory
instead. The documentation on abs_path and friends says "if no argument
is given they'll use the current working directory." Nothing is said
about an undef, but that and '' (but _not_ '0') appear to be the same as
passing no argument.
The second case seems to be because the regular expression in _to_user()
is missing a backslash before the Q.
The attached universal difference file records my attempt to address the
issues. In the second case, I have also inserted a return if the call to
users_home() returned undef.
The attached file also takes the liberty of changing the $VERSION,
mostly to record that I in fact did something. I would have also
provided a test file if I could figure out how to write one without
knowing in advance what (if any) other users are available on the system.
Subject: | Darwin.pat |
Message body not shown because it is not plain text.