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

Can't delete read-only files on Windows #7573

Closed
staticfloat opened this issue Jul 11, 2014 · 5 comments
Closed

Can't delete read-only files on Windows #7573

staticfloat opened this issue Jul 11, 2014 · 5 comments
Labels
system:windows Affects only Windows

Comments

@staticfloat
Copy link
Member

By default, windows balks at rm'ing files that have the read-only attribute set. This is causing the LibGit2.jl tests to fail on Windows. My favorite solution is to ignore read-only files inside of libuv when removing files on windows. This might involve just chmod'ing them before calling unlink or something, but @jakebolewski and I wanted to run it past the rest of you to see what you thought; is there a better way to do this?

@tkelman
Copy link
Contributor

tkelman commented Jul 11, 2014

Ah so that's what that was, good catch and apologies to @jakebolewski for my wrong guess in https://github.com/jakebolewski/LibGit2.jl/pull/11.

Judging by Linux behavior here, I think we should only do a force removal of anything read-only via a new force=true keyword argument to rm. Hopefully read-only files should be a fairly rare occurrence on Windows, what was making them show up in LibGit2?

@staticfloat
Copy link
Member Author

libgit object files are read-only by default. Objects like those .git/objects/XX/<hash> files.

Our linux behavior removes read-only files by default:

$ mkdir test
$ cd test/
$ touch blah
$ chmod -w blah 
$ ll
total 0
drwxr-xr-x   3 sabae  staff   102 Jul 11 18:02 .
drwxr-xr-x+ 80 sabae  staff  2720 Jul 11 18:02 ..
-r--r--r--   1 sabae  staff     0 Jul 11 18:02 blah
$ cd ..
$ julia
               _
   _       _ _(_)_     |  A fresh approach to technical computing
  (_)     | (_) (_)    |  Documentation: http://docs.julialang.org
   _ _   _| |_  __ _   |  Type "help()" to list help topics
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.3.0-prerelease+4134 (2014-07-11 00:01 UTC)
 _/ |\__'_|_|_|\__'_|  |  Commit d42b141* (0 days old master)
|__/                   |  x86_64-apple-darwin13.3.0

julia> rm("test", recursive=true)

julia> 

EDIT: Oh, this is OSX, not linux, but I would be surprised if Linux doesn't do this, as the LibGit2.jl tests have no problem with this kind of operation.

@tkelman
Copy link
Contributor

tkelman commented Jul 11, 2014

Oh, so it does. Here I was assuming Julia's rm would/should be more consistent with coreutils rm in that respect. Julia's rm is more like unlink then, which doesn't seem to care as much about permissions.

@staticfloat
Copy link
Member Author

Yeah, rm is basically a recursive wrapper around unlink

@tkelman
Copy link
Contributor

tkelman commented Aug 17, 2014

I believe I fixed this in #7590

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
system:windows Affects only Windows
Projects
None yet
Development

No branches or pull requests

3 participants