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

Win10: extracted files require admin rights to delete the file #96

Open
jdonnerstag opened this issue Feb 8, 2021 · 2 comments
Open

Comments

@jdonnerstag
Copy link

jdonnerstag commented Feb 8, 2021

Hi,

I have gow (https://github.com/bmatzelle/gow - Gnu on Windows) installed on my win10 laptop to leverage most of the (linux) gnu utils on the cmd commandline. I used tar -czvf data.tar.gz test*.* to create a small archiv with 3 files. tar -tzvf ... gives the following output:

C:\source_code\julia\...\archives>tar -tzvf data.tar.gz
-rw-rw-rw-  0 0      0         475 Nov 05 19:17 ./test_1.dat
-rw-rw-rw-  0 0      0         155 Nov 05 19:17 ./test_2.dat
-rw-rw-rw-  0 0      0         156 Nov 05 19:17 ./test_3.dat

I can export it like this:

function untar(data::IO, exdir::String)
    if isdir(exdir) == false mkdir(exdir) end
    tar = GzipDecompressorStream(data)
    Tar.extract(tar, exdir; copy_symlinks=true)
    close(tar)
end

and the files are created with the correct content. But in order to delete the files again, I need windows admin rights. And the julia traceback when trying to delete the file is

Got exception outside of a @test
  IOError: unlink: permission denied (EACCES)
  Stacktrace:
   [1] uv_error at .\libuv.jl:97 [inlined]
   [2] unlink(::String) at .\file.jl:918
   [3] rm(::String; force::Bool, recursive::Bool) at .\file.jl:268
   [4] rm(::String; force::Bool, recursive::Bool) at .\file.jl:278

Looking at the windows file properties, "Read", "Write" and "Special" are enabled. Which kind of matches the permissions in the tar file. Whereas manually creating files usually inherits the rights ("Modify" and "Read & Execute").

Am I somehow able to prevent Tar from changing the permission (skip that step)? Or change them while reading the data and before changing the files' permission?

I'm using:

[[Tar]]
deps = ["ArgTools", "SHA"]
git-tree-sha1 = "c4b3a3a28f72ce90866d8a0fce2c61b201d1b693"
uuid = "a4e569a6-e804-4fa4-b0f3-eef7a1d5b13e"
version = "1.9.0"

with Julia version 1.5.3 (Win10).
thanks a lot for your help

@StefanKarpinski
Copy link
Member

@staticfloat, any thoughts on this? Since this is happening on 1.5.3, it seems like this isn't due to the 1.6 changes. On the flip side, is this fixed on 1.6?

@staticfloat
Copy link
Contributor

@jdonnerstag can you try with Julia v1.5.4? or Julia v1.6? I think this may have already been fixed in both of those.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants