Fix for issue #2302 - NativeLibraryLoader fails due to no write permissions#2303
Open
terranprog wants to merge 2 commits intojMonkeyEngine:masterfrom
Open
Fix for issue #2302 - NativeLibraryLoader fails due to no write permissions#2303terranprog wants to merge 2 commits intojMonkeyEngine:masterfrom
terranprog wants to merge 2 commits intojMonkeyEngine:masterfrom
Conversation
…o write permissions Extract native library to a folder directly beneath the user temp folder. Do not use an intermediate /jme subfolder. Check the result of the call to mkdir. Use UserCache if creation failed. Check if the extraction folder is actually writable. If not use the UserCache. Updated log message: since a previous change we no longer extract to the working directory.
…f not, use user cache folder instead.
MeFisto94
approved these changes
Dec 29, 2024
Member
MeFisto94
left a comment
There was a problem hiding this comment.
You are right with mkdirs and not checking the result utimately, so we may want a tracking issue for that, it's also low hanging fruit for entry level contributions
Member
|
I think we can merge this @yaRnMcDonuts |
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.
This fixes an an issue I encountered while running a jmonkey application in Linux. #2302 - NativeLibraryLoader fails due to no write permissions.
The cause of the bug is a bit of an edge case, but it results in the native library not being extracted and the application not starting.
The main change I made is to extract the native library to a folder directly beneath the user temp folder, instead of using an intermediate tmp/jme subfolder. The reason for this is to avoid the scenario where the /tmp/jme folder is owned by one user and another user tries to write to it.
Note that this change is optional and I could modify the PR to not include it. We can still use /tmp/jme and fall back to calling setExtractionFolderToUserCache() if the /tmp/jme folder is not writable.
The other changes are to tighten the logic so the code will call setExtractionFolderToUserCache() instead of crashing.
Some general notes about this PR:
I tried to limit the scope to only fix the immediate issue.
There are other issues with NativeLibraryLoader that this PR does not address