-
-
Notifications
You must be signed in to change notification settings - Fork 482
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
files without permission entries are not found on Windows #245
Comments
What do you get when you call |
|
Hm. Ok, that seems kinda like a bug to me. It should be handling I'll have to review the code to be sure there isn't some method to this madness, but I agree that it seems like an oversight somewhere, and I'll try to figure out what bash does. On Unix, there's no combination of permissions that will prevent you from being able to stat a file, so this is probably just a windows-ism that I didn't think to account for. |
I came across the same issue: sindresorhus/del#50. Also @schnittstabil pointer that this is a glob issue. |
Fix #245 This works around cases in Windows systems where we can see that a file exists on the directory listing, but the stat/lstat call fails for some reason other than ENOENT or ENOTDIR.
Anyone affected by this error, please try the following:
And let me know if the problem goes away. |
@schnittstabil Do you think it should return an error if |
Fix #245 This works around cases in Windows systems where we can see that a file exists on the directory listing, but the stat/lstat call fails for some reason other than ENOENT or ENOTDIR.
Um, no, I think |
Right, sorry, when I said "return an error", I meant throw from sync or first arg to cb from async. It's an interesting edge case. I could see someone thinking that if they do |
Fix #245 This works around cases in Windows systems where we can see that a file exists on the directory listing, but the stat/lstat call fails for some reason other than ENOENT or ENOTDIR.
@isaacs Thanks a lot, works as expected on my VM.
IMO it only means that |
@schnittstabil I can't reproduce that. What error is thrown? Can you provide a test program and the output of the crash? Thanks. |
@isaacs Thus, no crash, works as expected. |
@schnittstabil When you say "it throws an error", what does that mean, exactly? Being a JavaScripter, I'd assume it means something like what happens when you do |
Sorry, for the misunderstanding. To be more clear:
As expected: console.log(glob.sync('d/**'));
However, I don't know if this is intended, but I don't understand why the following error gets printed: try {
glob('d/**', function (err, files) {});
} catch (err) {
} C:\Dokumente und Einstellungen\Administrator\Desktop\glob-test>node index.js
glob error { [Error: EPERM: operation not permitted, scandir 'C:\Dokumente und Einstellungen\Administrator\Desktop\glob-test\d']
errno: -4048,
code: 'EPERM',
syscall: 'scandir',
path: 'C:\\Dokumente und Einstellungen\\Administrator\\Desktop\\glob-test\\d'
} |
@schnittstabil Oh, I see, so if the What it's saying is "this is a very strange error, and probably you want to know about it, but the glob process can continue." If you pass I don't know why it's warning in async and throwing in sync, though, that's strange. It looks like readdir failures need to be cleaned up a little bit as well. That's definitely a separate issue (though related cause.) |
Just for the sake of completeness, try {
glob.sync('d/**');
} catch (errSync) {}
glob('d/**', errAsync => {}); The additional |
Found it: default: // some unusual error. Treat as failure.
this.cache[this._makeAbs(f)] = false
if (this.strict)
throw er
if (!this.silent)
console.error('glob error', er)
break default: // some unusual error. Treat as failure.
this.cache[this._makeAbs(f)] = false
if (this.strict) {
this.emit('error', er)
// If the error is handled, then we abort
// if not, we threw out of here
this.abort()
}
if (!this.silent)
console.error('glob error', er)
break |
Fix #245 This works around cases in Windows systems where we can see that a file exists on the directory listing, but the stat/lstat call fails for some reason other than ENOENT or ENOTDIR.
- Handle files without associated perms on Windows. - Fix failing case with `absolute` option. Credit: @isaacs Credit: @phated Fixes: isaacs/node-glob#245 Fixes: isaacs/node-glob#249 Reviewed-By: @othiym23
Steps to reproduce:
deleteMe.txt
glob.sync('deleteMe.txt')
returns[ 'deleteMe.txt' ]
glob.sync('deleteMe.txt')
returns[ ]
w/o error(same with async…)
The text was updated successfully, but these errors were encountered: