Skip to content

[Finder] fix tests #26785

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

Merged
merged 1 commit into from
Apr 4, 2018
Merged

[Finder] fix tests #26785

merged 1 commit into from
Apr 4, 2018

Conversation

xabbuh
Copy link
Member

@xabbuh xabbuh commented Apr 4, 2018

Q A
Branch? 2.7
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets
License MIT
Doc PR

@xabbuh
Copy link
Member Author

xabbuh commented Apr 4, 2018

This is a quick fix to make the test suite green again. However, as you can see the path normalization handling has always been dependent on the adapter that you used. I wonder if we shouldn't rather remove these new tests to not make any misleading promises about how the resulting path will be represented.

@helhum
Copy link
Contributor

helhum commented Apr 4, 2018

Hm, very good point (and sorry that I missed the test failures).

Haven't looked into how these adapters are calling find, but from a naive approach on command line, find behaves exactly like the tests expect.

$ find ./../symfony -type d

Output:

...
./../symfony/src
...
./../symfony/vendor
...

Whether to remove the tests or not, depends on whether we agree Finder should fulfill their expectations.

The introduced expectations do make sense, as I pointed out here.

But of course would be as well quite breaking for a bugfix version.

Last but not least, I haven't checked yet if the implementation would be reasonably doable at all.

I could help out in any direction, but obviously needs a decision from Symfony how to proceed.

@xabbuh
Copy link
Member Author

xabbuh commented Apr 4, 2018

@stof
Copy link
Member

stof commented Apr 4, 2018

Well, these adapters are deprecated though.

But rather than using realpath, these adapters could normalize paths by resolving ../ parts in the path (removing the previous part of the path).

@helhum
Copy link
Contributor

helhum commented Apr 4, 2018

see /src/Symfony/Component/Finder/Adapter/AbstractFindAdapter.php@2.7#L42 where realpath() is called

Hm, ok. Don't know why this was added. Can't confirm that find won't work for paths with ../ in it.

Well, these adapters are deprecated though

Ah OK, then I would just go with skipping these tests, as the adapters are gone in master anyway.

@nicolas-grekas
Copy link
Member

Thank you @xabbuh.

@nicolas-grekas nicolas-grekas merged commit 540ea11 into symfony:2.7 Apr 4, 2018
nicolas-grekas added a commit that referenced this pull request Apr 4, 2018
This PR was merged into the 2.7 branch.

Discussion
----------

[Finder] fix tests

| Q             | A
| ------------- | ---
| Branch?       | 2.7
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets |
| License       | MIT
| Doc PR        |

Commits
-------

540ea11 [Finder] fix tests
@xabbuh xabbuh deleted the pr-26763 branch April 4, 2018 13:22
@helhum
Copy link
Contributor

helhum commented Apr 4, 2018

Thanks @nicolas-grekas @xabbuh and everybody else involved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants