Skip to content

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

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
Jan 10, 2020

Conversation

fancyweb
Copy link
Contributor

@fancyweb 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 [Cache] improve perf of pruning for fs-based adapters #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
@fancyweb fancyweb force-pushed the cache-fix-filesystem-edge-case branch from e3ee073 to eaa767b Compare January 9, 2020 21:41
@nicolas-grekas nicolas-grekas added this to the 4.4 milestone Jan 9, 2020
Copy link
Member

@nicolas-grekas nicolas-grekas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and appveyor is green \o/

@fabpot
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
@fancyweb fancyweb deleted the cache-fix-filesystem-edge-case branch January 10, 2020 08:04
This was referenced Jan 21, 2020
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.

4 participants