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

EBUSY is not handled properly in SmartOS(Solaris) enviroment. #123

Closed
chayeon opened this issue Oct 24, 2016 · 5 comments
Closed

EBUSY is not handled properly in SmartOS(Solaris) enviroment. #123

chayeon opened this issue Oct 24, 2016 · 5 comments

Comments

@chayeon
Copy link

chayeon commented Oct 24, 2016

Hi,

I'm using rimraf module in SmartOS(based on solraris) environment.
I tried to remove huge(?) amount of files with this module, but I got "EBUSY" error.

In rimraf function in rimraf.js, EBUSY is only handled on Windows in retrial maner.
if (isWindows && (er.code === "EBUSY" || er.code === "ENOTEMPTY" || er.code === "EPERM") && busyTries < options.maxBusyTries) { busyTries ++

Are there any issues if "isWindows &&" is removed?

Thank you.

@chayeon
Copy link
Author

chayeon commented Nov 3, 2016

Hi,
FYI. I raised this issue to the project which is depending this module as follows;
(TritonDataCenter/smartos-live#673)
I think this issue is similar to the closed issue discussed in (#25).

Thank you.

@chayeon
Copy link
Author

chayeon commented Nov 4, 2016

Hi,
I made a script to re-produce the issue in SmartOS as follows based on 'bin.js':

ebusy_bin.js

#!/usr/node/bin/node
var rimraf = require('./')
var help = false
var dashdash = false
var args = process.argv.slice(2).filter(function(arg) {
  if (dashdash)
    return !!arg
  else if (arg === '--')
    dashdash = true
  else if (arg.match(/^(-+|\/)(h(elp)?|\?)$/))
    help = true
  else
    return !!arg
});
if (help || args.length === 0) {
  // If they didn't ask for help, then this is not a "success"
  var log = help ? console.log : console.error
  log('Usage: rimraf ')
  log('')
  log('  Deletes all files and folders at "path" recursively.')
  log('')
  log('Options:')
  log('')
  log('  -h, --help    Display this usage info')
  process.exit(help ? 0 : 1)
} else {
  args.forEach(function(arg) {
    rimraf(arg, function(err){
      if (err)
        console.log("ERROR: " + err.code);
    });
  })
}

And bellow is test invocation method:

tar xvfz git-2.8.0.tar.gz
./ebusy_bin.js ./git-2.8.0

(To see EBUSY error you should run the above code repeatedly.)

The output is as follows when EBUSY error occurs:

ERROR: EBUSY

And the directory contents are left over as follows, but the contents are random:

total 39458
-rwxr-xr-x 4 root root 9971208 Nov  2 03:54 git-init
-rwxr-xr-x 4 root root 9971208 Nov  2 03:54 git-ls-tree
-rwxr-xr-x 4 root root 9971208 Nov  2 03:54 git-mktag
-rwxr-xr-x 4 root root 9971208 Nov  2 03:54 git-name-rev

FYI, the test env information is as follows:

node version: 0.10.26
test file: git-2.8.0.tar.gz

UPDATE
"bin.js" (original script) which uses "rimraf.sync" DID NOT emit EBUSY error.

Thank you.

@isaacs
Copy link
Owner

isaacs commented Nov 4, 2016

Handling EBUSY on other systems seems fine to me. Would you like to submit a pull request?

@chayeon
Copy link
Author

chayeon commented Nov 6, 2016

Yes, I'd like to.
Thank you.

@isaacs
Copy link
Owner

isaacs commented Feb 18, 2017

Fixed on 2.6

@isaacs isaacs closed this as completed Feb 18, 2017
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

2 participants