diff --git a/src/Auditor.jl b/src/Auditor.jl index d5b66aed..bb4d4ed0 100644 --- a/src/Auditor.jl +++ b/src/Auditor.jl @@ -293,9 +293,10 @@ function audit(prefix::Prefix, src_name::AbstractString = ""; end end - if Sys.iswindows(platform) - # We also cannot allow any symlinks in Windows because it requires - # Admin privileges to create them. Orz + # We cannot allow any symlinks on Windows because creating them requires + # Admin privileges. Orz. This also applies to `AnyPlatform()`, since + # that tarball may end up being extracted on Windows. + if Sys.iswindows(platform) || platform isa AnyPlatform symlinks = collect_files(prefix, islink, exclude_dirs = false) Threads.@threads for f in symlinks try @@ -307,7 +308,9 @@ function audit(prefix::Prefix, src_name::AbstractString = ""; catch end end + end + if Sys.iswindows(platform) # If we're targeting a windows platform, check to make sure no .dll # files are sitting in `$prefix/lib`, as that's a no-no. This is # not a fatal offense, but we'll yell about it. diff --git a/test/auditing.jl b/test/auditing.jl index 53c2f230..881dc04e 100644 --- a/test/auditing.jl +++ b/test/auditing.jl @@ -525,6 +525,27 @@ end end end +@testset "Auditor - symlinks replaced with copies on $platform" for platform in ( + Platform("x86_64", "windows"), + AnyPlatform(), + ) + mktempdir() do build_path + build_path = realpath(build_path) + sharedir = joinpath(build_path, "share") + mkpath(sharedir) + target = joinpath(sharedir, "data.txt") + write(target, "hello") + link = joinpath(sharedir, "data-link.txt") + symlink("data.txt", link) + + Auditor.audit(Prefix(build_path); platform, require_license=false, silent=true) + + @test !islink(link) + @test isfile(link) + @test read(link, String) == "hello" + end +end + @testset "Auditor - gcc version" begin # These tests assume our gcc version is concrete (e.g. that Julia is linked against libgfortran) our_libgfortran_version = libgfortran_version(platform)