-
Notifications
You must be signed in to change notification settings - Fork 6.2k
8352480: Don't follow symlinks in additional content for app images #24974
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
Conversation
|
👋 Welcome back almatvee! A progress list of the required criteria for merging this PR into |
|
@sashamatveev This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be: You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 56 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details. ➡️ To integrate this PR with the above commit message to the |
|
@sashamatveev The following label will be automatically applied to this pull request:
When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command. |
Webrevs
|
|
I don't like the idea of changing behavior on only one platform. It should be consistent across all platforms. Let's not follow symlinks on other platforms, either. |
| * --jpt-run=AppContentTest | ||
| */ | ||
| public class AppContentTest { | ||
|
|
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.
Nitpick: do you think it might be worth it to add a bug id to the @test?
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.
No. I do not see a need. This is a generic test and not something specific to particular JBS issue.
Fix is updated not to follow links on all platforms. Test is updated as well. |
| Path contentDir = cmd.appLayout().contentDirectory(); | ||
| if (copyInResources) { | ||
| return contentDir.resolve("Resources"); | ||
| // Links are always created in "Resources" |
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.
Links are always created in "Resources"
All additional content on macOS is created in the "Resources" directory. On Linux there is no such requirement.
The return value of getAppContentPath() is not supposed to depend on the additional content type; the new "name" parameter doesn't make sense to me.
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.
For links we creating link and corresponding text file, so for it we should put both files into folder and add it to --app-content app-content-0/Resources. Note app-content-0 is temp folder with random name and if we using it directly we end up copying app-content-0 into application bundle. In such case it will not be possible to figure out location of link without putting it under known folder name such as "Resources".
"name" is to figure out if it link and if link it should be under "Resources".
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.
I can see you reverted the getAppContentPath() back. I guess it happened after your comment :)
| Path appContentArg = TKit.createTempDirectory("app-content").resolve("Resources"); | ||
| var srcPath = TKit.TEST_SRC_ROOT.resolve(appContentPath); | ||
| var dstPath = appContentArg.resolve(srcPath.getFileName()); | ||
| Path dstPath = appContentArg.resolve(srcPath.getFileName()); |
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.
This is a redundant change
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.
Fixed.
|
|
||
| private static Path copyAppContentPath(Path appContentPath) throws IOException { | ||
| var appContentArg = TKit.createTempDirectory("app-content").resolve("Resources"); | ||
| Path appContentArg = TKit.createTempDirectory("app-content").resolve("Resources"); |
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.
This is a redundant change
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.
Fixed.
| private static List<Path> initAppContentPaths(List<Path> appContentPaths) { | ||
| if (copyInResources) { | ||
| boolean copy = (copyInResources || appContentPaths.stream() | ||
| .anyMatch(s -> s.toString().contains("Link"))); |
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.
s.toString().contains("Link") is a lousy way to detect if the path is a symlink. "s" can be an absolute path (to the local OpenJDK repo) that may have a "Link" substring in one of path components, like "/home/BLink/my-projects/open/test/jdk/tools/jpackage/non-existant". The test will fail, and we will have a very hard time figuring out the cause. I'd fix it by narrowing the scope from the full path to the filename; create a dedicated function for detecting if the given path is supposed to be a symlink instead of repeating .toString().contains("Link"):
private static boolean isSymlinkPath(Path v) {
return v.getFileName().toString().contains("Link");
}
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.
Fixed.
|
8352480: [macos] Don't follow symlinks in additional content for app images [v6]
|
|
/integrate |
|
Going to push as commit 601f05e.
Your commit was automatically rebased without conflicts. |
|
@sashamatveev Pushed as commit 601f05e. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
--app-contenton all platforms.MacHelperupdated to use "cp -R" instead of "cp -r" when unpacking DMG, since "cp -r" on macOS is not documented option and when usedcpwill follow symbolic links which breaks test. "cp -R" does not follow symbolic links.Progress
Issue
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/24974/head:pull/24974$ git checkout pull/24974Update a local copy of the PR:
$ git checkout pull/24974$ git pull https://git.openjdk.org/jdk.git pull/24974/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 24974View PR using the GUI difftool:
$ git pr show -t 24974Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/24974.diff
Using Webrev
Link to Webrev Comment