Repository navigation
Store the device id with a rename when hard links are denied - #432
Merged
Merged
Conversation
The device id file is created with a hard link so that concurrent first starts agree on one id. A link that fails with EACCES, which is how the SELinux policy of Android apps answers, now falls back to a rename like the other errors that mean hard links are not available. Other link errors are still returned. The link call is a variable so tests can replace it.
asiyani
approved these changes
Oct 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The device id file is first created by hard-linking a temporary file into place, so that concurrent first starts agree on one id. When linking is not available the agent falls back to a rename, which does not detect a file created in the meantime. The fallback covered
EPERM,ENOTSUP,EXDEVandENOSYS.The SELinux policy of Android apps denies hard links with
EACCES(avc: denied { link } ... untrusted_app), so the agent inv0.4.0-RC3fails to start on Android withcannot store the device id ...: link ...: permission denied.EACCESnow selects the rename fallback. The temporary file is created in the same directory just before, so a real permission problem still fails at the rename.EIO, are still returned.linkFile) so tests can replace it.On Android every first creation takes the fallback. That is fine there: one agent process runs, and
Mobile.startrefuses a second start. On Linux and macOS hard links work and the fallback does not run in practice.Tests:
EACCESfrom the fallback fails it.