Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows 11: Failed test 'Follow symlinks' at t/recurse.t line 139 #273

Open
hakonhagland opened this issue Nov 20, 2022 · 1 comment
Open

Comments

@hakonhagland
Copy link

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 the fix in #268 for realpath, the fix in #270 for lstat->size, and the fix in #272 for forward slashes, 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/input_output.t .................. ok
t/input_output_no_PU_UU.t ......... ok
t/input_output_no_UU.t ............ ok
t/locking.t ....................... ok
t/mkdir.t ......................... ok
t/mkpath.t ........................ ok
t/mutable_tree_while_iterating.t .. ok
t/normalize.t ..................... ok
t/overloading.t ................... ok
t/parent.t ........................ ok
t/recurse.t ....................... 1/?
            #   Failed test 'Follow symlinks'
            #   at t/recurse.t line 139.
            #     Structures begin differing at:
            #          $got->[8] = 'qqqq.txt'
            #     $expected->[8] = 'pppp/ffff.txt'
            # [
            #   'aaaa.txt',
            #   'bbbb.txt',
            #   'cccc',
            #   'gggg.txt',
            #   'pppp',
            #   'qqqq.txt',
            #   'cccc/dddd.txt',
            #   'cccc/eeee',
            #   'cccc/eeee/ffff.txt'
            # ]
            # Looks like you failed 1 test of 1.

        #   Failed test 'iterator'
        #   at t/recurse.t line 141.

            #   Failed test 'Follow symlinks'
            #   at t/recurse.t line 146.
            #     Structures begin differing at:
            #          $got->[8] = 'qqqq.txt'
            #     $expected->[8] = 'pppp/ffff.txt'
            # [
            #   'aaaa.txt',
            #   'bbbb.txt',
            #   'cccc',
            #   'gggg.txt',
            #   'pppp',
            #   'qqqq.txt',
            #   'cccc/dddd.txt',
            #   'cccc/eeee',
            #   'cccc/eeee/ffff.txt'
            # ]
            # Looks like you failed 1 test of 1.

        #   Failed test 'visit'
        #   at t/recurse.t line 148.
        # Looks like you failed 2 tests of 2.

    #   Failed test 'follow'
    #   at t/recurse.t line 149.
    # Looks like you failed 1 test of 2.

#   Failed test 'with symlinks'
#   at t/recurse.t line 150.
# Looks like you failed 1 test of 2.
t/recurse.t ....................... Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/2 subtests

[...]

I believe the problem is again related to forward slashes in a symlink target, similar to what happend in #271. If you look at line 110 in recurse.t we see that a relative symlink target is constructed like this:

symlink path( 'cccc', 'eeee' ), path('pppp');

This will construct a symlink target with a relative path with forward slashes. It does not help to be explicit like for example:

symlink path( 'cccc\eeee' ), path('pppp');

trying to force the path to have backward slashes instead, since path() will replace backward slashes with forward slashes, see line 289 in Tiny.pm:

$path =~ tr[\\][/] if IS_WIN32();
hakonhagland added a commit to hakonhagland/Path-Tiny that referenced this issue Nov 20, 2022
Don't use forward slashes in a relative symlink target on Windows.
For more information see issue dagolden#271.

This fixes issue dagolden#273.
@hakonhagland hakonhagland changed the title Fix forward slashes problem in relative symlink targets on Windows (2) Windows 11: Failed test 'Follow symlinks' at t/recurse.t line 139 Nov 20, 2022
@hakonhagland
Copy link
Author

Added a PR to fix this temporarily, see #274

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant