https://bz.apache.org/SpamAssassin/show_bug.cgi?id=8067
Bug ID: 8067
Summary: Test failures on older perls on Windows when PATH
contains a directory that does not exist
Product: Spamassassin
Version: 4.0.0
Hardware: PC
OS: Windows
Status: NEW
Severity: normal
Priority: P2
Component: Regression Tests
Assignee: [email protected]
Reporter: [email protected]
Target Milestone: Undefined
Steps to reproduce:
On Windows using Strawberry Perl 5.22 or older, add a non-existent directory to
PATH, then run the SpamAssassin tests. They all fail with a "No such file or
directory" error thrown from t/SATest.pm line 80.
Analysis:
In Strawberry perl 5.22 and older, Cwd::realpath($path) throws a "No such file
or directory" error when $path is not a file or directory that exists. In perl
5.24 and later, this would return undef. In tests on other platforms I have
only seen it return a string of the non-existent path instead of undef or an
error. The perldoc for the realpath function seems to me to be ambiguous about
which behavior is correct.
The only place we currently call Cwd::realpath is in t/SATest.pm in code that
only runs under Windows to clean PATH. The effect of this behavior is that with
Strawberry Perl 5.22 and older, if the PATH environment contains a directory
that does not exist, all tests fail when SATest.pm gets the error.
Since in both places where Cwd::realpath is called, the code then checks if the
result is a directory that exists and discards the result if it does not, a
simple fix is to do the check if the path is an existing directory before the
call to Cwd::realpath.
Since this only effects tests, it can be committed during RTC without a vote.
--
You are receiving this mail because:
You are the assignee for the bug.