Skip to content

Commit ab246e5

Browse files
authored
Fix valid_library_path to reject .sot extension (#970)
Fixes #857 (again)
1 parent d0437c4 commit ab246e5

File tree

2 files changed

+27
-2
lines changed

2 files changed

+27
-2
lines changed

src/auditor/dynamic_linkage.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ function valid_library_path(f::AbstractString, p::AbstractPlatform)
279279
elseif Sys.isapple(p)
280280
return endswith(f, ".dylib")
281281
else
282-
return occursin(r".+\.so(\.[\d]+)*", f)
282+
return occursin(r".+\.so(\.[\d]+)*$", f)
283283
end
284284
end
285285

test/auditing.jl

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
using BinaryBuilder.Auditor
2-
using BinaryBuilder.Auditor: compatible_marchs
2+
using BinaryBuilder.Auditor: compatible_marchs, valid_library_path
33

44
# Tests for our auditing infrastructure
55

@@ -516,3 +516,28 @@ end
516516
@test readlink(joinpath(testdir, "lib", "libfoo.so")) == "libfoo.so.1.0.0"
517517
end
518518
end
519+
520+
@testset "valid_library_path" begin
521+
linux = Platform("x86_64", "linux")
522+
macos = Platform("x86_64", "macos")
523+
windows = Platform("x86_64", "windows")
524+
525+
@test valid_library_path("/usr/libc.dylib", macos)
526+
@test !valid_library_path("/usr/libc.dylib.", macos)
527+
@test !valid_library_path("/usr/libc.dylib.1", macos)
528+
@test !valid_library_path("/usr/libc.dylib", linux)
529+
@test !valid_library_path("/usr/libc.dylib", windows)
530+
531+
@test valid_library_path("libc.dll", windows)
532+
@test !valid_library_path("libc.dll.1", windows)
533+
@test !valid_library_path("libc.dll", linux)
534+
@test !valid_library_path("libc.dll", macos)
535+
536+
@test valid_library_path("/usr/libc.so", linux)
537+
@test valid_library_path("/usr/libc.so.1", linux)
538+
@test valid_library_path("/usr/libc.so.1.2", linux)
539+
@test !valid_library_path("/usr/libc.so.", linux)
540+
@test !valid_library_path("/usr/libc.sot", linux)
541+
@test !valid_library_path("/usr/libc.so", macos)
542+
@test !valid_library_path("/usr/libc.so", windows)
543+
end

0 commit comments

Comments
 (0)