-
Notifications
You must be signed in to change notification settings - Fork 213
Handle Errno::EPERM
errors when composing bundle
#3698
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
base: main
Are you sure you want to change the base?
Conversation
How to use the Graphite Merge QueueAdd the label graphite-merge to this PR to add it to the merge queue. You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
bc30fa2
to
d638388
Compare
@@ -1388,6 +1388,9 @@ def compose_bundle(message) | |||
rescue Bundler::LockfileError => e | |||
send_message(Error.new(id: id, code: BUNDLE_COMPOSE_FAILED_CODE, message: e.message)) | |||
return | |||
rescue Errno::EPERM | |||
# If the user doesn't have permission to perform read operations, we can't compose the bundle | |||
return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me know if it makes sense to return here -- my understanding is we can't compose the bundle without more permissions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It will depend on why we're getting the permission issue. When you invoke Bundler.default_lockfile
, it will keep searching for a Gemfile
and Gemfile.lock
pair in parent directories until it reaches home.
Are we 100% sure that the permission issue is coming from reading the lockfile and not from trying to read the parent directories?
The issue could be that there's simply no bundle in the project and the user didn't give permissions to the editor for accessing any of the parent directories. In that case, returning early would not be correct because we can still compose the bundle as long as there's no lockfile and the user has permissions for the current directory.
Some of these errors have been reported to our telemetry. For now, it makes sense to rescue the error and ignore it because it means that the user's environment does not have permissions to read their lockfile, which means we can't compose the bundle.
d638388
to
f0b38fd
Compare
Motivation
We have
Errno::EPERM
errors being reported on telemetry when the server attempts to compose the bundle. This happens when the user's environment does not have permissions to read theirGemfile.lock
.Implementation
This rescues the error and then returns from the
compose_bundle
method as we likely do not have sufficient permissions to finish.Automated Tests
I've added an automated test.