gulpjs / glob-stream

Readable streamx interface over anymatch.
MIT License
178 stars 53 forks source link

Passing nocase: true on Windows causes no matches #46

Closed bdukes closed 9 years ago

bdukes commented 9 years ago

Using node-glob directly, I can match a file with a call like

require('glob')('testing/*.test', { nocase: true }, (err, files) => console.log(files));

However, using glob-stream, as soon as I pass { nocase: true }, I get zero files in the steam (regardless of whether they match the case of the glob pattern or not). Passing { nocase: false } causes matches to show up again.

require('glob-stream').create('testing/*.test', { nocase: true }).on('data', (file) => console.log(file)).on('end', () => console.log('end'));

The above code only shows end.

I'm running node 4.1.1 on Windows 10, let me know if you need any other debug info.

phated commented 9 years ago

Need the version of glob you are using directly. If it is latest, that is quite different

bdukes commented 9 years ago

I had just done an npm install glob for testing, which installed glob@5.0.15. Looking at glob-stream@5.0.0, I also just installed glob@5.0.3 (per https://github.com/gulpjs/glob-stream/blob/v5.0.0/package.json), and get the same results.

phated commented 9 years ago

@bdukes cool. Can you also test glob using the on('match') syntax to see if it is a bug with that?

phated commented 9 years ago

@bdukes ref https://github.com/isaacs/node-glob#events

bdukes commented 9 years ago

glob@5.0.3 works fine using on('match')

phated commented 9 years ago

@bdukes can you please create a repo for reproduction that includes files and scripts? I have some time to look at this today

bdukes commented 9 years ago

I've put a repro at https://dl.dropboxusercontent.com/u/5536031/glob-stream-nocase-repro.zip

phated commented 9 years ago

Thanks! It seems this is only happening on window's and is related to us making the glob absolute. I think I will be able to track this into the glob library

bdukes commented 9 years ago

:+1:

phated commented 9 years ago

The example below has the same problem as described. Looks to be a node-glob issue.

var testGlob = new glob.Glob('C:\\Users\\phated\\Downloads\\glob-stream-nocase-repro\\testing\\**\\*.glob', { nocase: true });
testGlob.on('match', function (match) {
    console.log('glob matched', match);
}).on('end', function () {
    console.log('done matching via glob');
})
phated commented 9 years ago

Found the issue already opened for this over on glob: https://github.com/isaacs/node-glob/issues/123

Going to close this as the bug is happening upstream and there isn't much we can do about it. You could probably poke some of the related threads. There seems to be a PR open that tries to solve it but is way out of date.