Skip to content

[Finder] Prevent unintentional file locks in Windows #33402

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
Sep 1, 2019
Merged

[Finder] Prevent unintentional file locks in Windows #33402

merged 1 commit into from
Sep 1, 2019

Conversation

jspringe
Copy link
Contributor

@jspringe jspringe commented Aug 30, 2019

Q A
Branch? 4.3 for bug fixes
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets #33400
License MIT
Doc PR

This replaces the constructor behavior for SortableIterator. Instead of storing the sort strategy as a property, causing the object to hold references to the files being sorted and thus locking them in Windows, it uses a method to determine the sort strategy when calling getIterator.

Change stored $sort closure to a static closure. This removes the instance context that causes the file lock. This doesn't change any intended behavior.

I, unfortunately, did not provided tests for 2 reasons. The first being that I've never written tests for the Symfony framework so I do not know the nuances. The second is that in order for the test to actually fail it would need to be run in the Windows OS. AppVeyor tests with a Windows instance, but it appears the Finder tests get skipped.

@jspringe
Copy link
Contributor Author

Need to rework this before submitting. My apologizes.

@jspringe jspringe closed this Aug 30, 2019
@jspringe jspringe reopened this Aug 31, 2019
@jspringe jspringe changed the title Issue 33400: Change sort strategy to a method from a property. [Finder] [SortIterator] Issue #33400: Prevent unintentional file locks in Windows Aug 31, 2019
@jspringe jspringe changed the title [Finder] [SortIterator] Issue #33400: Prevent unintentional file locks in Windows [Finder] [SortableIterator] Issue #33400: Prevent unintentional file locks in Windows Aug 31, 2019
@jspringe jspringe changed the title [Finder] [SortableIterator] Issue #33400: Prevent unintentional file locks in Windows [Finder] [Iterator] [SortableIterator] Issue #33400: Prevent unintentional file locks in Windows Aug 31, 2019
@jspringe
Copy link
Contributor Author

AppVeyor self-cancelled.

@jspringe jspringe closed this Aug 31, 2019
@jspringe
Copy link
Contributor Author

Didn't mean to close.

@jspringe jspringe reopened this Aug 31, 2019
@nicolas-grekas nicolas-grekas changed the title [Finder] [Iterator] [SortableIterator] Issue #33400: Prevent unintentional file locks in Windows [Finder] Prevent unintentional file locks in Windows Sep 1, 2019
@nicolas-grekas nicolas-grekas changed the base branch from 4.3 to 3.4 September 1, 2019 21:32
@nicolas-grekas
Copy link
Member

Thank you @jspringe.

nicolas-grekas added a commit that referenced this pull request Sep 1, 2019
…inge)

This PR was submitted for the 4.3 branch but it was squashed and merged into the 3.4 branch instead (closes #33402).

Discussion
----------

[Finder] Prevent unintentional file locks in Windows

| Q             | A
| ------------- | ---
| Branch?       | 4.3 for bug fixes <!-- see below -->
| Bug fix?      | yes
| New feature?  | no <!-- please update src/**/CHANGELOG.md files -->
| BC breaks?    | no     <!-- see https://symfony.com/bc -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tests pass?   | yes <!-- please add some, will be required by reviewers -->
| Fixed tickets | #33400   <!-- #-prefixed issue number(s), if any -->
| License       | MIT
| Doc PR        |

~~This replaces the constructor behavior for `SortableIterator`. Instead of storing the sort strategy as a property, causing the object to hold references to the files being sorted and thus locking them in Windows, it uses a method to determine the sort strategy when calling `getIterator`.~~

Change stored `$sort` closure to a static closure. This removes the instance context that causes the file lock. This doesn't change any intended behavior.

I, unfortunately, did not provided tests for 2 reasons. The first being that I've never written tests for the Symfony framework so I do not know the nuances. ~~The second is that in order for the test to actually fail it would need to be run in the Windows OS.~~ AppVeyor tests with a Windows instance, but it appears the `Finder` tests get skipped.

Commits
-------

997cc5c [Finder] Prevent unintentional file locks in Windows
@nicolas-grekas nicolas-grekas merged commit 997cc5c into symfony:3.4 Sep 1, 2019
@nicolas-grekas nicolas-grekas added this to the 3.4 milestone Sep 1, 2019
@jspringe
Copy link
Contributor Author

jspringe commented Sep 1, 2019

Thanks for the merge! Just curious, as I am not familiar, how long does it usually take to see this change in the framework/components? Only asking because I have another issue contingent upon this change.

@nicolas-grekas
Copy link
Member

nicolas-grekas commented Sep 1, 2019 via email

@jspringe jspringe deleted the 4.3 branch September 3, 2019 13:48
This was referenced Oct 7, 2019
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.

3 participants