Skip to content

Commit cdade33

Browse files
committed
Replace symlinks in AnyPlatform builds too.
1 parent deee5bb commit cdade33

2 files changed

Lines changed: 27 additions & 3 deletions

File tree

src/Auditor.jl

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -293,9 +293,10 @@ function audit(prefix::Prefix, src_name::AbstractString = "";
293293
end
294294
end
295295

296-
if Sys.iswindows(platform)
297-
# We also cannot allow any symlinks in Windows because it requires
298-
# Admin privileges to create them. Orz
296+
# We cannot allow any symlinks on Windows because creating them requires
297+
# Admin privileges. Orz. This also applies to `AnyPlatform()`, since
298+
# that tarball may end up being extracted on Windows.
299+
if Sys.iswindows(platform) || platform isa AnyPlatform
299300
symlinks = collect_files(prefix, islink, exclude_dirs = false)
300301
Threads.@threads for f in symlinks
301302
try
@@ -307,7 +308,9 @@ function audit(prefix::Prefix, src_name::AbstractString = "";
307308
catch
308309
end
309310
end
311+
end
310312

313+
if Sys.iswindows(platform)
311314
# If we're targeting a windows platform, check to make sure no .dll
312315
# files are sitting in `$prefix/lib`, as that's a no-no. This is
313316
# not a fatal offense, but we'll yell about it.

test/auditing.jl

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -525,6 +525,27 @@ end
525525
end
526526
end
527527

528+
@testset "Auditor - symlinks replaced with copies on $platform" for platform in (
529+
Platform("x86_64", "windows"),
530+
AnyPlatform(),
531+
)
532+
mktempdir() do build_path
533+
build_path = realpath(build_path)
534+
sharedir = joinpath(build_path, "share")
535+
mkpath(sharedir)
536+
target = joinpath(sharedir, "data.txt")
537+
write(target, "hello")
538+
link = joinpath(sharedir, "data-link.txt")
539+
symlink("data.txt", link)
540+
541+
Auditor.audit(Prefix(build_path); platform, require_license=false, silent=true)
542+
543+
@test !islink(link)
544+
@test isfile(link)
545+
@test read(link, String) == "hello"
546+
end
547+
end
548+
528549
@testset "Auditor - gcc version" begin
529550
# These tests assume our gcc version is concrete (e.g. that Julia is linked against libgfortran)
530551
our_libgfortran_version = libgfortran_version(platform)

0 commit comments

Comments
 (0)