Closed hakonhagland closed 3 years ago
According to this blog $Config{d_symlink}
is true on MSYS2 if you are running Windows 10 Creators Update or above and have enabled "Developer mode" in the Windows "Settings" app. Which are the case for my machine. In this case symlinks are “emulated” by copying files and directories unless you set the enviroment variable MSYS
to winsymlinks:nativestrict
(which I had not done). After editing the file C:\msys64\home\hakon\.bashrc
and appending the line export MSYS=winsymlinks:nativestrict
and saving and reopening the MSYS2 terminal window I could now run cpanm Path::Tiny
without test failures.
Thanks for the bug report and insight into the problem. Could you please give me the output of perl -V
in MSYS2? And could you please give me the output of perl -V:d_symlink
both with and without winsymlinks:nativestrict
?
$ perl -V
Summary of my perl5 (revision 5 version 32 subversion 0) configuration:
Platform:
osname=msys
osvers=3.1.5-340.x86_64
archname=x86_64-msys-thread-multi
uname='msys_nt-10.0-18363 devadmin 3.1.5-340.x86_64 2020-06-06 09:16 utc x86_64 msys '
config_args='-des -Dusethreads -Doptimize=-march=x86-64 -mtune=generic -O2 -pipe -Dprefix=/usr -Dvendorprefix=/usr -Dprivlib=/usr/share/perl5/core_perl -Darchlib=/usr/lib/perl5/core_perl -Dsitelib=/usr/share/perl5/site_perl -Dsitearch=/usr/lib/perl5/site_perl -Dvendorlib=/usr/share/perl5/vendor_perl -Dvendorarch=/usr/lib/perl5/vendor_perl -Dscriptdir=/usr/bin/core_perl -Dsitescript=/usr/bin/site_perl -Dvendorscript=/usr/bin/vendor_perl -Dinc_version_list=none -Dman1ext=1perl -Dman3ext=3perl -Darchname=-msys-threads -Dmyarchname=-msys -Dlibperl=msys-perl5_32.dll -Dcc=gcc -Dld=g++ -Accflags=-march=x86-64 -mtune=generic -O2 -pipe -fwrapv'
hint=recommended
useposix=true
d_sigaction=define
useithreads=define
usemultiplicity=define
use64bitint=define
use64bitall=define
uselongdouble=undef
usemymalloc=n
default_inc_excludes_dot=define
bincompat5005=undef
Compiler:
cc='gcc'
ccflags ='-DPERL_USE_SAFE_PUTENV -U__STRICT_ANSI__ -D_GNU_SOURCE -march=x86-64 -mtune=generic -O2 -pipe -fwrapv -fno-strict-aliasing -fstack-protector-strong'
optimize='-march=x86-64 -mtune=generic -O2 -pipe'
cppflags='-DPERL_USE_SAFE_PUTENV -U__STRICT_ANSI__ -D_GNU_SOURCE -march=x86-64 -mtune=generic -O2 -pipe -fwrapv -fno-strict-aliasing -fstack-protector-strong'
ccversion=''
gccversion='9.3.0'
gccosandvers=''
intsize=4
longsize=8
ptrsize=8
doublesize=8
byteorder=12345678
doublekind=3
d_longlong=define
longlongsize=8
d_longdbl=define
longdblsize=16
longdblkind=3
ivtype='long'
ivsize=8
nvtype='double'
nvsize=8
Off_t='off_t'
lseeksize=8
alignbytes=8
prototype=define
Linker and Libraries:
ld='g++'
ldflags =' -Wl,--enable-auto-import -Wl,--export-all-symbols -Wl,--enable-auto-image-base -fstack-protector-strong'
libpth=/usr/lib
libs=-lpthread -lgdbm -ldb -ldl -lcrypt -lgdbm_compat
perllibs=-lpthread -ldl -lcrypt
libc=/usr/lib/libmsys-2.0.a
so=dll
useshrplib=true
libperl=msys-perl5_32.dll
gnulibc_version=''
Dynamic Linking:
dlsrc=dl_dlopen.xs
dlext=dll
d_dlsymun=undef
ccdlflags=' '
cccdlflags=' '
lddlflags=' --shared -Wl,--enable-auto-import -Wl,--export-all-symbols -Wl,--enable-auto-image-base -fstack-protector-strong'
Characteristics of this binary (from libperl):
Compile-time options:
HAS_TIMES
MULTIPLICITY
PERLIO_LAYERS
PERL_COPY_ON_WRITE
PERL_DONT_CREATE_GVSV
PERL_IMPLICIT_CONTEXT
PERL_OP_PARENT
PERL_PRESERVE_IVUV
PERL_USE_SAFE_PUTENV
USE_64_BIT_ALL
USE_64_BIT_INT
USE_ITHREADS
USE_LARGE_FILES
USE_LOCALE
USE_LOCALE_COLLATE
USE_LOCALE_CTYPE
USE_LOCALE_NUMERIC
USE_LOCALE_TIME
USE_PERLIO
USE_PERL_ATOF
USE_REENTRANT_API
USE_THREAD_SAFE_LOCALE
Built under msys
Compiled at Jul 15 2020 08:42:09
%ENV:
MSYS="winsymlinks:nativestrict"
@INC:
/usr/lib/perl5/site_perl
/usr/share/perl5/site_perl
/usr/lib/perl5/vendor_perl
/usr/share/perl5/vendor_perl
/usr/lib/perl5/core_perl
/usr/share/perl5/core_perl
Running perl -V:d_symlink
gives the same result bot with and without winsymlinks:nativestrict
as expected (?) since -V
reads the information available when perl
was installed, but winsymlinks:nativestrict
is changed throught the environment variable MSYS
. Here is the output for both cases:
$ perl -V:d_symlink
d_symlink='define';
Hi. Could you please try commit 69319c6 with and without winsymlinks:nativestrict
? It should skip symlink tests when not present.
Hi @xdg. The commit seems to work fine:
$ git clone https://github.com/dagolden/Path-Tiny.git
$ cd Path-Tiny
$ perl Makefile.PL
$ make
$ MSYS=winsymlinks:nativestrict make test
PERL_DL_NONLAZY=1 "/usr/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/input_output.t .................. ok
t/input_output_no_PU_UU.t ......... ok
t/input_output_no_UU.t ............ ok
t/locking.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 ....................... ok
t/rel-abs.t ....................... ok
t/sig_die.t ....................... ok
t/subsumes.t ...................... ok
t/symlinks.t ...................... ok
t/temp.t .......................... ok
t/visit.t ......................... ok
t/zz-atomic.t ..................... skipped: Test::MockRandom required for atomicity tests
t/zzz-spec.t ...................... ok
All tests successful.
Files=26, Tests=1702, 13 wallclock secs ( 0.31 usr 0.11 sys + 3.81 cusr 5.58 csys = 9.82 CPU)
Result: PASS
$ MSYS= make test
PERL_DL_NONLAZY=1 "/usr/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/input_output.t .................. ok
t/input_output_no_PU_UU.t ......... ok
t/input_output_no_UU.t ............ ok
t/locking.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 ....................... ok
t/rel-abs.t ....................... ok
t/sig_die.t ....................... ok
t/subsumes.t ...................... ok
t/symlinks.t ...................... skipped: No symlink support
t/temp.t .......................... ok
t/visit.t ......................... ok
t/zz-atomic.t ..................... skipped: Test::MockRandom required for atomicity tests
t/zzz-spec.t ...................... ok
All tests successful.
Files=26, Tests=1678, 12 wallclock secs ( 0.25 usr 0.20 sys + 3.81 cusr 5.21 csys = 9.47 CPU)
Result: PASS
Whereas with the previous code on metacpan.org:
$ wget https://cpan.metacpan.org/authors/id/D/DA/DAGOLDEN/Path-Tiny-0.114.tar.gz
$ tar zxvf Path-Tiny-0.114.tar.gz
$ cd Path-Tiny-0.114
$ perl Makefile.PL
$ make
$ MSYS= make test
PERL_DL_NONLAZY=1 "/usr/bin/perl.exe" "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/00-report-prereqs.t ............. 1/1 #
# Versions for all modules listed in MYMETA.json (including optional ones):
#
# === Configure Requires ===
#
# Module Want Have
# ------------------- ---- ----
# ExtUtils::MakeMaker 6.17 7.44
#
# === Configure Suggests ===
#
# Module Want Have
# -------- ------- ----
# JSON::PP 2.27300 4.04
#
# === Build Requires ===
#
# Module Want Have
# ------------------- ---- ----
# ExtUtils::MakeMaker any 7.44
#
# === Test Requires ===
#
# Module Want Have
# --------------------- ---- --------
# Digest::MD5 any 2.55_01
# ExtUtils::MakeMaker any 7.44
# File::Basename any 2.85
# File::Spec 0.86 3.78
# File::Spec::Functions any 3.78
# File::Spec::Unix any 3.78
# File::Temp 0.19 0.2309
# Test::More 0.96 1.302175
# lib any 0.65
# open any 1.12
#
# === Test Recommends ===
#
# Module Want Have
# ------------------ -------- --------
# CPAN::Meta 2.120900 2.150010
# Test::FailWarnings any 0.008
# Test::MockRandom any missing
#
# === Runtime Requires ===
#
# Module Want Have
# ------------------ ---- -------
# Carp any 1.50
# Cwd any 3.78
# Digest 1.03 1.17_01
# Digest::SHA 5.45 6.02
# Encode any 3.06
# Exporter 5.57 5.74
# Fcntl any 1.13
# File::Copy any 2.34
# File::Glob any 1.33
# File::Path 2.07 2.16
# File::Spec 0.86 3.78
# File::Temp 0.19 0.2309
# File::stat any 1.09
# constant any 1.33
# overload any 1.31
# strict any 1.11
# warnings any 1.47
# warnings::register any 1.04
#
# === Runtime Recommends ===
#
# Module Want Have
# ------------- ---- -------
# Unicode::UTF8 0.58 missing
#
t/00-report-prereqs.t ............. ok
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 .................... 80/?
# Failed test 'realpath resolves symlinks'
# at t/filesystem.t line 351.
# got: '/tmp/O3c37unHzj/bar.txt'
# expected: '/tmp/O3c37unHzj/foo.txt'
# Failed test 'path is still symbolic link after spewing'
# at t/filesystem.t line 393.
# Failed test 'symbolic link is available after spewing'
# at t/filesystem.t line 394.
# got: undef
# expected: '/tmp/O3c37unHzj/bar.txt'
# Failed test 'symbolic link is available after spewing'
# at t/filesystem.t line 395.
# got: undef
# expected: '/tmp/O3c37unHzj/foo.txt'
# Failed test 'spewing follows the link and replace the destination instead'
# at t/filesystem.t line 396.
# got: 'Hello World
# '
# expected: 'Hello Perl
# '
# Looks like you failed 5 tests of 104.
t/filesystem.t .................... Dubious, test returned 5 (wstat 1280, 0x500)
Failed 5/104 subtests
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/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 'Don't follow symlinks'
# at t/recurse.t line 122.
# Structures begin differing at:
# $got->[8] = 'pppp/ffff.txt'
# $expected->[8] = 'qqqq.txt'
# [
# 'aaaa.txt',
# 'bbbb.txt',
# 'cccc',
# 'gggg.txt',
# 'pppp',
# 'qqqq.txt',
# 'cccc/dddd.txt',
# 'cccc/eeee',
# 'pppp/ffff.txt',
# 'cccc/eeee/ffff.txt'
# ]
# Looks like you failed 1 test of 1.
# Failed test 'iterator'
# at t/recurse.t line 124.
# Failed test 'Don't follow symlinks'
# at t/recurse.t line 128.
# Structures begin differing at:
# $got->[8] = 'pppp/ffff.txt'
# $expected->[8] = 'qqqq.txt'
# [
# 'aaaa.txt',
# 'bbbb.txt',
# 'cccc',
# 'gggg.txt',
# 'pppp',
# 'qqqq.txt',
# 'cccc/dddd.txt',
# 'cccc/eeee',
# 'pppp/ffff.txt',
# 'cccc/eeee/ffff.txt'
# ]
# Looks like you failed 1 test of 1.
# Failed test 'visit'
# at t/recurse.t line 130.
# Looks like you failed 2 tests of 2.
# Failed test 'no follow'
# at t/recurse.t line 131.
# Looks like you failed 1 test of 2.
# Failed test 'with symlinks'
# at t/recurse.t line 151.
# Looks like you failed 1 test of 2.
t/recurse.t ....................... Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/2 subtests
t/rel-abs.t ....................... 1/?
# Failed test 'ABCD->rel(ABE_FG) [real paths]'
# at t/rel-abs.t line 156.
# got: '../../../C/D'
# expected: '../../../../../../../../../../A/B/C/D'
# Failed test 'ABCD->rel(ABE_FGH) [unreal paths]'
# at t/rel-abs.t line 172.
# got: '../../../../C/D'
# expected: '../../../../../../../../../../../A/B/C/D'
# Looks like you failed 2 tests of 4.
# Failed test 'relative on absolute paths with symlinks'
# at t/rel-abs.t line 217.
Error resolving realpath on '/tmp/khAyPIkzGp/foo/bar/baz/bam/bim/buz/wiz/was/F/G': No such file or directory at t/rel-abs.t line 188.
# Tests were run but no plan was declared and done_testing() was not seen.
# Looks like your test exited with 2 just after 33.
t/rel-abs.t ....................... Dubious, test returned 2 (wstat 512, 0x200)
Failed 1/33 subtests
t/sig_die.t ....................... ok
t/subsumes.t ...................... ok
t/symlinks.t ......................
# Failed test 'it's a link'
# at t/symlinks.t line 26.
# Failed test 'the link seems right'
# at t/symlinks.t line 28.
# got: undef
# expected: '../foo'
t/symlinks.t ...................... 1/? # Failed test 'abs_path gets's it right'
# at t/symlinks.t line 29.
# got: '/tmp/qsFRcEfWB1/tmp/tmp2/bar'
# expected: '/tmp/qsFRcEfWB1/tmp/foo'
# Failed test 'realpath get's it right'
# at t/symlinks.t line 31.
# got: '/tmp/qsFRcEfWB1/tmp/tmp2/bar'
# expected: '/tmp/qsFRcEfWB1/tmp/foo'
# Looks like you failed 4 tests of 5.
# Failed test 'relative symlinks with updir'
# at t/symlinks.t line 32.
# Failed test 'symlink loop detected'
# at t/symlinks.t line 46.
# ''
# doesn't match '(?^:symlink loop detected)'
# Looks like you failed 1 test of 1.
# Failed test 'symlink loop detection'
# at t/symlinks.t line 49.
# Looks like you failed 2 tests of 2.
t/symlinks.t ...................... Dubious, test returned 2 (wstat 512, 0x200)
Failed 2/2 subtests
t/temp.t .......................... ok
t/visit.t ......................... ok
t/zz-atomic.t ..................... skipped: Test::MockRandom required for atomicity tests
t/zzz-spec.t ...................... ok
Test Summary Report
-------------------
t/filesystem.t (Wstat: 1280 Tests: 104 Failed: 5)
Failed tests: 83, 101-104
Non-zero exit status: 5
t/recurse.t (Wstat: 256 Tests: 2 Failed: 1)
Failed test: 2
Non-zero exit status: 1
t/rel-abs.t (Wstat: 512 Tests: 33 Failed: 1)
Failed test: 33
Non-zero exit status: 2
Parse errors: No plan found in TAP output
t/symlinks.t (Wstat: 512 Tests: 2 Failed: 2)
Failed tests: 1-2
Non-zero exit status: 2
Files=27, Tests=1703, 14 wallclock secs ( 0.33 usr 0.16 sys + 4.44 cusr 5.53 csys = 10.46 CPU)
Result: FAIL
Failed 4/27 test programs. 9/1703 subtests failed.
make: *** [Makefile:905: test_dynamic] Error 255
Great! I'll ship a dev release to CPAN and if that smokes green, will follow with a regular release some days afterwards.
System: Windows 10, MSYS2, perl version 5.32.0: