Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add set_permissions argument #113

Merged
merged 8 commits into from
Jun 8, 2021
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
move set_permissions tests to Tar.extract API tests
StefanKarpinski committed Jun 8, 2021
commit af0410097ffe01016916ffbf741d2d20e4347586
34 changes: 20 additions & 14 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -584,6 +584,7 @@ end
@arg_test tar @test_throws ErrorException tar_count(tar, strict=true)
@arg_test tar @test n + 1 == tar_count(tar, strict=false)
end
rm(tarball)
end

@testset "API: extract" begin
@@ -704,6 +705,23 @@ end
end
end
end
rm(tarball)

@testset "set_permissions" begin
tarball, _ = make_test_tarball()
dir = Tar.extract(tarball, set_permissions=false)
f_path = joinpath(dir, "0-ffffffff")
x_path = joinpath(dir, "0-xxxxxxxx")
@test isfile(f_path)
@test isfile(x_path)
if !Sys.iswindows()
@test !Sys.isexecutable(f_path)
@test !Sys.isexecutable(x_path)
end
@test Sys.isexecutable(f_path) == Sys.isexecutable(x_path)
rm(dir, recursive=true)
rm(tarball)
end
end

@testset "API: rewrite" begin
@@ -845,7 +863,7 @@ end

if Sys.iswindows() && Sys.which("icacls") !== nothing && VERSION >= v"1.6"
@testset "windows permissions" begin
tarball, hash = make_test_tarball()
tarball, _ = make_test_tarball()
mktempdir() do dir
Tar.extract(tarball, dir)
f_path = joinpath(dir, "0-ffffffff")
@@ -861,18 +879,6 @@ if Sys.iswindows() && Sys.which("icacls") !== nothing && VERSION >= v"1.6"
x_acl = readchomp(`icacls $(x_path)`)
@test occursin("Everyone:(RX,WA)", x_acl)
end

mktempdir() do dir
Tar.extract(tarball, dir, set_permissions=false)
f_path = joinpath(dir, "0-ffffffff")
@test isfile(f_path)
!Sys.iswindows() && @test !isexecutable(f_path)

x_path = joinpath(dir, "0-xxxxxxxx")
@test isfile(x_path)
!Sys.iswindows() && @test !isexecutable(x_path)

@test isexecutable(f_path) == isexecutable(x_path)
end
rm(tarball)
end
end