-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
grunt.file.delete incorrectly reports path as outside current directory #1469
Comments
@rockerest what version of node? |
node version I'll also update the main issue to keep it all in one place. Re: the issue you linked - I strongly believe the issue resides out there in node. It might be a good point of reference for the node team regarding |
I just ran into this too. The issue is that .relative() is returning '../../whatever' instead of just '../' which causes the regex test in grunt's code (https://github.com/gruntjs/grunt/blob/master/lib/grunt/file.js#L444) to return false. |
I ran into this and dug into it enough to find the problem. Grunt's unit tests were failing when run with node 5.7 so that made it easier to chase down. I also verified that the unit tests still pass with this change and node 5.6. |
Closing this issue as this is a regression with Node.js and has been fixed for the |
@shama, the arguments being passed to path.relative are in the wrong order. Even if the issue is resolved in Node 5.7.1 the grunt code is wrong and uses a regex to catch itself. |
@aranaea Sorry, I'm not understanding the problem. If the regression is fixed in Node.js, what issue is that patch fixing? |
Hi @shama The way the code is currently written it asks for the relative path from the target directory to the current and expects only Thanks for thinking about this. |
Given the following task:
And the directory structure:
Running
grunt clean
fails and reports a warning:Is this expected behavior?
On my *nix terminal any combination of
./
,/./
, etc. always results in the current path.From my perspective, requesting that
./build
be deleted is explicitly asking that the folder namedbuild
in thecwd
be deleted, making this warning (and task failure) objectively incorrect.I could be missing a nuance about how this is resolved, but having an error about not being able to delete files outside the cwd while explicitly requesting to start at the cwd feels off to me.
I'm also too unfamiliar with node to know if this is an issue with Grunt (maybe here or here?) or with Node's fs or path modules themselves.
The text was updated successfully, but these errors were encountered: