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

Regex excludes cause existing patterns to behave differently #6245

Closed
ckamm opened this issue Dec 14, 2017 · 14 comments
Closed

Regex excludes cause existing patterns to behave differently #6245

ckamm opened this issue Dec 14, 2017 · 14 comments
Assignees
Labels
ReadyToTest QA, please validate the fix/enhancement sev1-critical type:bug Windows
Milestone

Comments

@ckamm
Copy link
Contributor

ckamm commented Dec 14, 2017

From @sagamusix #5017

for example my pattern */.svn/pristine/ no longer seems to work

Summary from investigation:

The client used fnmatch with FNM_PATHNAME on unix and PathMatchSpec on Windows. These had different behavior when expanding * patterns: fnmatch never expands it to /, while that is allowed on windows. That means */foo/bar would match a/b/foo/bar on windows, but not on other oses.

The new regex exclude matching code implements the fnmatch behavior on all platforms thereby changing the meaning of existing patterns on windows.

@ckamm ckamm added this to the 2.5.0 milestone Dec 14, 2017
@ckamm ckamm self-assigned this Dec 14, 2017
@ckamm ckamm changed the title Regex includes cause existing patterns to behave differently Regex excludes cause existing patterns to behave differently Dec 14, 2017
@ckamm
Copy link
Contributor Author

ckamm commented Dec 14, 2017

@sagamusix So it's now syncing some folder foo/.svn/pristine and its contents?

@sagamusix
Copy link

Exactly, and previously these files were ignored as intended.

@ckamm
Copy link
Contributor Author

ckamm commented Dec 15, 2017

@sagamusix It works for me. The pattern gets translated to ^[^/]*/\.svn/pristine)(?:$|/). Can you let me know what path exactly was excluded before and isn't anymore?

Idea I have: You're on windows, and we're seeing a previous inconsistency between windows and linux. On linux we used FNM_PATHNAME so a * never matched a /. Maybe on windows a * (incorrectly!) did match a slash?

Since we no longer rely on fnmatch and PathMatchSpec the behavior will now be consistent - and I used the fnmatch behavior as the baseline.

@sagamusix
Copy link

Two paths were matched before I realized and aborted the sync; one was Uni\powerwall-trunk\.svn\pristine and the other one was similar in structure. It seems like if I move the folder one level up, it works as intended, which coincides with your idea, I think.

@sagamusix
Copy link

sagamusix commented Dec 15, 2017

I have changed the pattern to just .svn/pristine/ (including all other patterns in my list from other issue that were structured similarly) and it seems like the initial discovery is much, much slower now - it's now running for almost 2 hours for a ~35 GB folder that previously took a few minutes. In fact, it's still discovering folders so I cannot see yet if it helps fixing the problem. I can still occasionally see folders that are not supposed to be synced in the progress indication, though, so I'm not sure if this helped at all.

@ckamm
Copy link
Contributor Author

ckamm commented Dec 15, 2017

@sagamusix changing too .svn/pristine/ still wouldn't trigger the right behavior. See #5275 for discussion of the unclear behavior.

@sagamusix
Copy link

sagamusix commented Dec 15, 2017

So do I understand correctly that what I wanted previously only worked by chance?

@ckamm
Copy link
Contributor Author

ckamm commented Dec 15, 2017

Yes, unfortunately. But I don't think it's acceptable to break patterns windows users had added. I think we'll need to put in extra work to make sure that migrates nicely.

And that performance issue you're seeing also definitely needs to be investigated.

@ckamm
Copy link
Contributor Author

ckamm commented Dec 19, 2017

I'm looking at allowing * to match .* in the regex: it complicates the bname-as-activation optimization though since foo/bar*daa could very well be activated by a bname xyzdaa. It may be ok to be just mostly correct here.

ckamm added a commit that referenced this issue Jan 5, 2018
Unfortunately matching behaved differently on Windows. This patch
restores the previous matching behavior but still uses the new regular
expression based matching.

Further work will hopefully unify the behavior between platforms without
breaking backwards compatibility.
ckamm added a commit that referenced this issue Jan 5, 2018
Unfortunately matching behaved differently on Windows. This patch
restores the previous matching behavior but still uses the new regular
expression based matching.

Further work will hopefully unify the behavior between platforms without
breaking backwards compatibility.
ckamm added a commit that referenced this issue Jan 9, 2018
Unfortunately matching behaved differently on Windows. This patch
restores the previous matching behavior but still uses the new regular
expression based matching.

Further work will hopefully unify the behavior between platforms without
breaking backwards compatibility.
@ckamm
Copy link
Contributor Author

ckamm commented Jan 9, 2018

@sagamusix I've adjusted the regex matching on windows to be backwards compatible. Could you check out the new 2.5 nightly when it becomes available?

@ckamm ckamm added the ReadyToTest QA, please validate the fix/enhancement label Jan 9, 2018
@sagamusix
Copy link

Judging from the timestamps, I guess the current nightly build doesn't have the fix yet, right?

@ckamm
Copy link
Contributor Author

ckamm commented Jan 10, 2018

@sagamusix
Copy link

sagamusix commented Jan 10, 2018

The patterns seem to work as intended again, although initial discovery still seems to have slowed down considerably. The discovery took almost exactly 5 hours, which used to be a matter of minutes. To make things worse, it ended with an "operation cancelled" error from the server. :)

@ckamm
Copy link
Contributor Author

ckamm commented Jan 11, 2018

@sagamusix Ouch, that's horrible. Let's move back to the optimization task #5017. Thanks for testing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ReadyToTest QA, please validate the fix/enhancement sev1-critical type:bug Windows
Projects
None yet
Development

No branches or pull requests

2 participants