Skip to content

Windows 11: Failed test 'relative symlinks with updir' at t/symlinks.t line 31. #271

@hakonhagland

Description

@hakonhagland

I am trying to install Path::Tiny on Windows 11 using a debug version of perl 5.37.6 using MinGW-w64 and gcc 11.3.0 from https://winlibs.com/ (using the MSVCRT runtime library), more information here: Perl/perl5#20395.

When testing Path::Tiny including both the fix in #268 for realpath and the fix in #269 for lstat->size, I get:

>gmake test
"C:\perl-debug\bin\perl.exe" "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(0, 'blib\lib', 'blib\arch')" t/*.t
t/basename.t ...................... ok
t/basic.t ......................... ok
t/children.t ...................... ok
t/chmod.t ......................... ok
t/digest.t ........................ ok
t/exception.t ..................... ok
t/exports.t ....................... ok
t/filesystem.t .................... ok
t/has_same_bytes.t ................ ok

[...]

t/size.t .......................... ok
t/subsumes.t ...................... ok
t/symlinks.t ......................
    #   Failed test 'abs_path gets's it right'
    #   at t/symlinks.t line 28.
    #          got: undef
    #     expected: 'C:/Users/hakon/AppData/Local/Temp/9C5IA3G3mi/tmp/foo'
    # Looks like you failed 1 test of 5.
t/symlinks.t ...................... 1/?
#   Failed test 'relative symlinks with updir'
#   at t/symlinks.t line 31.
# Looks like you failed 1 test of 2.
t/symlinks.t ...................... Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/2 subtests
t/temp.t .......................... ok

[...]

More information about the failed test:

>perl -Ilib t\symlinks.t
# Subtest: relative symlinks with updir
    ok 1 - it's a file
    ok 2 - it's a link
    ok 3 - the link seems right
    not ok 4 - abs_path gets's it right
    #   Failed test 'abs_path gets's it right'
    #   at t\symlinks.t line 28.
    #          got: undef
    #     expected: 'C:/Users/hakon/AppData/Local/Temp/oii4Dv_WlF/tmp/foo'
    ok 5 - realpath get's it right
    1..5
    # Looks like you failed 1 test of 5.
not ok 1 - relative symlinks with updir
#   Failed test 'relative symlinks with updir'
#   at t\symlinks.t line 31.
# Subtest: symlink loop detection
    ok 1 - symlink loop detected
    1..1
ok 2 - symlink loop detection
1..2
# Looks like you failed 1 test of 2.

The problem seems to be a bug in Win32 API for CreateFileA() when a target of a symlink contains a relative path with forward slashes (as opposed to backward slashes) it fails. A fix has been suggested in Perl5/blead, see Perl/perl5#20506 for more information.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions