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

Error when deleting .git folder in windows #19

Closed
satazor opened this issue Mar 2, 2013 · 8 comments
Closed

Error when deleting .git folder in windows #19

satazor opened this issue Mar 2, 2013 · 8 comments

Comments

@satazor
Copy link

satazor commented Mar 2, 2013

This issue only happens in windows when using rimraf 2.1.x. When using 2.0.x it works fine.
When rimraf is used to delete a git repository, it fails when removing .git/objects/pack/*.idx and *.pack files.

I've spotted this issue because I've upgraded rimraf in 0.8.x release of http://github.com/twitter/bower and windows users started to complain. After some debugging, the unlink of these files error out with EPERM. Then rimraf interprets them as a directory and some other error happens. I think this is related to the fact the older versions of rimraf tried to make the file writable before deleting it.
When I tested, I had no hanging process on those files or the .git folder.

To reproduce:
$ git clone git://github.com/satazor/SparkMD5.git

var rimraf = require('rimraf');

rimraf('SparkMD5', function (err) {
  console.log(err);
});
@feugy
Copy link

feugy commented Mar 15, 2013

👍
I also encounter the problem, via fs-extra. I had to downgrade it to 0.4.0 who use rim-raf 2.0.2.

@ghost
Copy link

ghost commented Apr 1, 2013

@isaacs
Copy link
Owner

isaacs commented Apr 1, 2013

If you want to chmod a dir recursively, use https://github.com/isaacs/chmodr

Note that rm -rf on the command line also fails. This is definitely bad behavior on git's part, but rimraf should not club the fs properties.

@isaacs isaacs closed this as completed Apr 1, 2013
@feugy
Copy link

feugy commented Apr 2, 2013

Sorry Isaacs, I don't understand why you spotted your chmod tools. Do you believe that changing the owner will allow rimraf to delete the git folder ?

@isaacs
Copy link
Owner

isaacs commented Apr 2, 2013

chmod is for changing the mode, not the owner. (For that, you'd need chownr.)

If you remove the read-only bit, then yes, it will delete just fine.

@paulmillr
Copy link
Contributor

Brunch users on windows recently (likely after update to node 0.10) started receiving errors like this:

ENOTEMPTY, rmdir 'c:\xampp-portable\htdocs\marionette.git\objects\00']
errno: 53, code: 'ENOTEMPTY', path: 'c:\xampp-portable\htdocs\marionette\.git\objects\00'

So it fails to delete .git but there is no EPERM. Any ideas?

@isaacs
Copy link
Owner

isaacs commented Apr 9, 2013

Ah, indeed, there seems to be a bug here. Posted on #21.

@klarkc
Copy link

klarkc commented Feb 23, 2016

+1 This affects me, but in Linux.

Trying to remove test_sandbox folder:

Error: ENOTEMPTY, rmdir 'tests/test_sandbox/.git'

Looking for permission issues with this command: $ find tests/test_sandbox/ -exec getfacl -t {} \; | grep "USER", give me this:

USER   klarkc    rwx     
USER   klarkc    rwx     
USER   klarkc    rwx     
USER   klarkc    rw-     
USER   klarkc    rwx     
USER   klarkc    rwx     
USER   klarkc    rwx     
USER   klarkc    rw-     
USER   klarkc    rwx     
USER   klarkc    rwx     
USER   klarkc    rwx     
USER   klarkc    rwx     
USER   klarkc    rwx     
USER   klarkc    rwx     
USER   klarkc    rwx     
USER   klarkc    rwx     
USER   klarkc    rwx     
USER   klarkc    rwx     
USER   klarkc    rw-

So none of the files have read only permissions nor are owned by someone else.

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

5 participants