Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions src/Auditor.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
Expand Down
21 changes: 21 additions & 0 deletions test/auditing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Loading