Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Lock] fix lock file permissions#27903

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged

Conversation

fritzmg
Copy link
Contributor

QA
Branch?3.4
Bug fix?yes
New feature?no
BC breaks?see discussion below
Deprecations?no
Tests pass?yes
Fixed tickets-
LicenseMIT
Doc PR-

Seethis comment. Since we are usingr+ now to fix an issue on Solaris, we also need to change the file permissions when the lock file is created for the first time. Otherwise

fopen($fileName,'r+')

will fail due to the file permissions and while

fopen($fileName,'r')

will work, the subsequent locking will again fail on Solaris.

Changing the file permissions to0666 fixes this issue.However any lock file that was generatedprior to this change will still cause issues and would need to be manually deleted. Usually the defaultsys_get_temp_dir() location is used for the lock files andusually these files are purged periodically, so it probably won't matter that much. But it still might cause some confusion since it will not be transparent, why the file lock failed on Solaris systems.

@fritzmgfritzmg changed the titlefix file lock permissionsfix lock file permissionsJul 9, 2018
@fritzmgfritzmg changed the titlefix lock file permissions[Lock] fix lock file permissionsJul 9, 2018
@xabbuhxabbuh added the Lock labelJul 9, 2018
@@ -81,7 +81,7 @@ private function lock(Key $key, $blocking)
set_error_handler(function ($type, $msg) use (&$error) { $error = $msg; });
if (!$handle = fopen($fileName, 'r+') ?: fopen($fileName, 'r')) {
if ($handle = fopen($fileName, 'x')) {
chmod($fileName,0444);
chmod($fileName,0666);

Choose a reason for hiding this comment

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

0644?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

True, that should suffice of course.

Copy link
Member

Choose a reason for hiding this comment

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

I don't think so as that would prohibit locks across different users, wouldn't it?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

@xabbuh good point
@nicolas-grekas what do you think? Should we change it back to0666?

@nicolas-grekasnicolas-grekasforce-pushed thefix-file-lock-permissions branch fromd4b4776 to23481a1CompareJuly 9, 2018 12:45
@nicolas-grekas
Copy link
Member

Thank you@fritzmg.

@nicolas-grekasnicolas-grekas merged commit23481a1 intosymfony:3.4Jul 9, 2018
nicolas-grekas added a commit that referenced this pull requestJul 9, 2018
This PR was squashed before being merged into the 3.4 branch (closes#27903).Discussion----------[Lock] fix lock file permissions| Q             | A| ------------- | ---| Branch?       | 3.4| Bug fix?      | yes| New feature?  | no| BC breaks?    | see discussion below| Deprecations? | no| Tests pass?   | yes| Fixed tickets | -| License       | MIT| Doc PR        | -See [this comment](#27668 (comment)). Since we are using `r+` now to fix an issue on Solaris, we also need to change the file permissions when the lock file is created for the first time. Otherwise```phpfopen($fileName, 'r+')```will fail due to the file permissions and while```phpfopen($fileName, 'r')```will work, the subsequent locking will again fail on Solaris.Changing the file permissions to `0666` fixes this issue. __However__ any lock file that was generated _prior_ to this change will still cause issues and would need to be manually deleted. Usually the default `sys_get_temp_dir()` location is used for the lock files and _usually_ these files are purged periodically, so it probably won't matter that much. But it still might cause some confusion since it will not be transparent, why the file lock failed on Solaris systems.Commits-------23481a1 [Lock] fix lock file permissions
nicolas-grekas added a commit that referenced this pull requestJul 9, 2018
This PR was squashed before being merged into the 2.8 branch (closes#27904).Discussion----------[Filesystem] fix lock file permissions| Q             | A| ------------- | ---| Branch?       | 2.8| Bug fix?      | yes| New feature?  | no| BC breaks?    | see linked discussion| Deprecations? | no| Tests pass?   | yes| Fixed tickets | -| License       | MIT| Doc PR        | -See#27903Commits-------7a68fea [Filesystem] fix lock file permissions
@fritzmgfritzmg deleted the fix-file-lock-permissions branchJuly 9, 2018 12:49
@fritzmg
Copy link
ContributorAuthor

Just so that the discussion does not get lost:@nicolas-grekas I think we should use0666 after all. Imagine two users using the same application on the same server. If that application does not generate a unique path/name for its lock file, only the user who first creates the lock file will be able to use it (on Solaris).

@nicolas-grekas
Copy link
Member

I fixed it to 0666 directly in the branch.

fritzmg reacted with thumbs up emoji

This was referencedJul 23, 2018
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@nicolas-grekasnicolas-grekasnicolas-grekas approved these changes

@xabbuhxabbuhxabbuh approved these changes

Assignees
No one assigned
Projects
None yet
Milestone
3.4
Development

Successfully merging this pull request may close these issues.

4 participants
@fritzmg@nicolas-grekas@xabbuh@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp