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

In Windows, patterns ending in / match files, too #49

Closed
cowboy opened this issue Dec 14, 2012 · 5 comments
Closed

In Windows, patterns ending in / match files, too #49

cowboy opened this issue Dec 14, 2012 · 5 comments

Comments

@cowboy
Copy link

cowboy commented Dec 14, 2012

I'm seeing this bug in v3.1.14. Given this directory structure:

deep
├── deep.txt
└── deeper
    ├── deeper.txt
    └── deepest
        └── deepest.txt

In OS X I get this (which is expected)

$ node -pe "require('glob').sync('d**/**')"
[ 'deep',
  'deep/deep.txt',
  'deep/deeper',
  'deep/deeper/deeper.txt',
  'deep/deeper/deepest',
  'deep/deeper/deepest/deepest.txt' ]

$ node -pe "require('glob').sync('d**/**/')"
[ 'deep/', 'deep/deeper/', 'deep/deeper/deepest/' ]

But in Windows I get this (this is not expected)

C:\test>node -pe "require('glob').sync('d**/**')"
[ 'deep',
  'deep/deep.txt',
  'deep/deeper',
  'deep/deeper/deeper.txt',
  'deep/deeper/deepest',
  'deep/deeper/deepest/deepest.txt' ]

C:\test>node -pe "require('glob').sync('d**/**/')"
[ 'deep/',
  'deep/deep.txt/',
  'deep/deeper/',
  'deep/deeper/deeper.txt/',
  'deep/deeper/deepest/',
  'deep/deeper/deepest/deepest.txt/' ]
@isaacs
Copy link
Owner

isaacs commented Dec 14, 2012

Interesting. So the directory filtering is failing.

@cowboy
Copy link
Author

cowboy commented Dec 14, 2012

In case this helps in any way, when I use the mark option, matched directories have trailing slashes, although the files list still contains non-directories when it shouldn't

OS X (this works as-expected):

$ node -pe "require('glob').sync('d**/**', {mark: true})"
[ 'deep/',
  'deep/deep.txt',
  'deep/deeper/',
  'deep/deeper/deeper.txt',
  'deep/deeper/deepest/',
  'deep/deeper/deepest/deepest.txt' ]

$ node -pe "require('glob').sync('d**/**/', {mark: true})"
[ 'deep/', 'deep/deeper/', 'deep/deeper/deepest/' ]

Windows (the trailing mark slashes are correct, but non-directories should be removed from the result set in the 2nd example):

C:\test>node -pe "require('glob').sync('d**/**', {mark: true})"
[ 'deep/',
  'deep/deep.txt',
  'deep/deeper/',
  'deep/deeper/deeper.txt',
  'deep/deeper/deepest/',
  'deep/deeper/deepest/deepest.txt' ]

C:\test>node -pe "require('glob').sync('d**/**/', {mark: true})"
[ 'deep/',
  'deep/deep.txt',
  'deep/deeper/',
  'deep/deeper/deeper.txt',
  'deep/deeper/deepest/',
  'deep/deeper/deepest/deepest.txt' ]

@isaacs
Copy link
Owner

isaacs commented Dec 15, 2012

Yeah, definitely a bug. Patch welcome.

@dignifiedquire
Copy link

I'll have a look at it tomorrow.

@dignifiedquire
Copy link

Well I actually did that, but I never got around to fix anything. The first big problem is that basically nothing of the test suite is working on windows.

  1. Fails to find .js files when given a directory on Windows tapjs/tapjs#57 results that one needs to specify every single file in the test cmd if you want to run it.
  2. All the bash tests don't work because, well there is no bash on Windows.

Aside from that I did some digging into the code to find out what was going wrong but I couldn't really figure out what was happening without a unix machine to compare. As soon as I get my Windows VM up and running I'll take another look.

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

3 participants