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

[Filesystem][FilesystemCommonTrait] Use a dedicated directory when there are no namespace #35290

Merged
merged 1 commit into from Jan 10, 2020

Conversation

@fancyweb
Copy link
Contributor

fancyweb commented Jan 9, 2020

Q A
Branch? 4.4
Bug fix? yes
New feature? no
Deprecations? no
Tickets -
License MIT
Doc PR -

This PR fixes the following edge case:

  • you use a namespaced filesystem adapter with root dir /foo and namespace a: all files are written in /foo/a (eg: it will write /foo/a/I/W/file)
  • you use another filesystem adapter with the same root dir but without namespace and you clear it.
  • it will fail because it will try to delete the /foo/a/I directory (see #33921 new scanHashDir() method - a is a possible dir value (see getFile()) so we look for it).

The simple solution (suggested by @nicolas-grekas) is to put the "empty namespace" in a dedicated directory.

Bonus: that will fix the tests that currently always fail on AppVeyor. The file in the namespace a is a leftover from a previous test. Without this patch, I have the same fail on my Mac. I did not look why it currently passes on travis.

@fancyweb fancyweb changed the title [Filesystem][FilesystemCommonTrait] Do not put namespaced directories in the empty namespace directory [Filesystem][FilesystemCommonTrait] Use a dedicated directory when there are no namespace Jan 9, 2020
…ere are no namespace
@fancyweb fancyweb force-pushed the fancyweb:cache-fix-filesystem-edge-case branch from e3ee073 to eaa767b Jan 9, 2020
@nicolas-grekas nicolas-grekas added this to the 4.4 milestone Jan 9, 2020
Copy link
Member

nicolas-grekas left a comment

and appveyor is green \o/

@fabpot
fabpot approved these changes Jan 10, 2020
@fabpot

This comment has been minimized.

Copy link
Member

fabpot commented Jan 10, 2020

Thank you @fancyweb.

fabpot added a commit that referenced this pull request Jan 10, 2020
…ory when there are no namespace (fancyweb)

This PR was merged into the 4.4 branch.

Discussion
----------

[Filesystem][FilesystemCommonTrait] Use a dedicated directory when there are no namespace

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | -
| License       | MIT
| Doc PR        | -

This PR fixes the following edge case:
- you use a namespaced filesystem adapter with root dir `/foo` and namespace `a`: all files are written in `/foo/a` (eg: it will write `/foo/a/b/file`)
- you use another filesystem adapter with the same root dir but without namespace and you clear it.
- it will fail because it will try to delete the `/foo/a/b` directory (see #33921 new `scanHashDir()` method - `a` is a possible dir value (see `getFile()`) so we look for it).

The simple solution (suggested by @nicolas-grekas) is to put the "empty namespace" in a dedicated directory.

Bonus: that will fix the tests that currently always fail on AppVeyor. The file in the namespace `a` is a leftover from a previous test. Without this patch, I have the same fail on my Mac. I did not look why it currently passes on travis.

Commits
-------

eaa767b [Filesystem][FilesystemCommonTrait] Use a dedicated directory when there are no namespace
@fabpot fabpot merged commit eaa767b into symfony:4.4 Jan 10, 2020
3 checks passed
3 checks passed
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
fabbot.io Your code looks good.
Details
@fancyweb fancyweb deleted the fancyweb:cache-fix-filesystem-edge-case branch Jan 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.