Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Difference behavior for ( and ) on windows and linux #160

Closed
alexander-akait opened this issue Feb 19, 2019 · 3 comments
Closed

Difference behavior for ( and ) on windows and linux #160

alexander-akait opened this issue Feb 19, 2019 · 3 comments
Assignees
Milestone

Comments

@alexander-akait
Copy link

Environment

  • OS Version: windows/linux
  • Node.js Version: 10.15.0 (no matter)

Actual behavior

We have [special?directory]/(special-*file).txt (yep it is valid name on windows)

Pattern - (special-*file).txt
cwd - [special?directory]

Linux : ['(special-*file).txt']
Windows: []

Expected behavior

Equals behavior.

Steps to reproduce

Below

Code sample

fg(['(special-*file).txt'], { cwd: '[special?directory]' }).then((entries) => console.log(entries));

From CI https://ci.appveyor.com/project/webpack-contrib/copy-webpack-plugin/builds/22485753/job/rqpb76mp3wxtlfqh

@mrmlnc mrmlnc pinned this issue Feb 19, 2019
@mrmlnc mrmlnc self-assigned this Feb 20, 2019
@mrmlnc
Copy link
Owner

mrmlnc commented Feb 20, 2019

Hmm…, I see that on my Windows 10 machine (NTFS, File Explorer, Powershell) I cannot create directory with ? symbol in the name:

https://docs.microsoft.com/en-us/windows/desktop/fileio/naming-a-file#naming-conventions

Any way this is a issue for micromatch or picomatch:

// micromatch
/^(?:(?:\.[\\\/](?=.))?(?:special-[^\\\/]*?file)\.txt(?:[\\\/]|$))$/
// false

// minimatch
/^(?:(?=.)\(special-[^\/]*?file\)\.txt)$/
// true

// picomatch
/^(?:(?=.)(special\-[^\\\/]*?file)\.txt)$/
// false

I'll create a separate issue for picomatch.

@mrmlnc
Copy link
Owner

mrmlnc commented Apr 5, 2019

As we found out in the linked issue, this is normal behavior. So, I will describe this behavior in the README.md. I also plan to add a function that escapes all special characters in the pattern.

@mrmlnc mrmlnc added this to the 3.0.0 milestone Apr 5, 2019
@mrmlnc mrmlnc modified the milestones: 3.0.0, 2.2.7 May 13, 2019
@mrmlnc
Copy link
Owner

mrmlnc commented May 18, 2019

This issue will be fixed with release fast-glob@2.2.7. You can check release issue #180.

Unfortunately, it will go to release only with fast-glob@3.0.0. We have an architectural problem with pattern transformation in version 2.x.x, the correction of which will lead to backward incompatible changes :(

@mrmlnc mrmlnc closed this as completed May 18, 2019
@mrmlnc mrmlnc modified the milestones: 2.2.7, 3.0.0 May 18, 2019
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

2 participants