From 2570fc54182a4c0e1e2c13ab369f9bd83f975845 Mon Sep 17 00:00:00 2001 From: Volker Simonis Date: Fri, 5 Dec 2014 19:46:15 +0100 Subject: [PATCH] 8066766: The commands in the modular images are executable by the owner only Also simplify the 'set executable' step of jspawnhelper in ImageBuilder.java Reviewed-by: chegar, alanb --- .../build/tools/module/ImageBuilder.java | 17 +---------------- .../build/tools/module/ModuleArchive.java | 2 +- 2 files changed, 2 insertions(+), 17 deletions(-) diff --git a/jdk/make/src/classes/build/tools/module/ImageBuilder.java b/jdk/make/src/classes/build/tools/module/ImageBuilder.java index 9f0da161a8f..e9de90b8e5b 100644 --- a/jdk/make/src/classes/build/tools/module/ImageBuilder.java +++ b/jdk/make/src/classes/build/tools/module/ImageBuilder.java @@ -349,21 +349,6 @@ class ImageBuilder { return (new SimpleResolver(mods, moduleGraph)).resolve(); } - /** - * chmod ugo+x file - */ - private void setExecutable(Path file) { - try { - Set perms = Files.getPosixFilePermissions(file); - perms.add(PosixFilePermission.OWNER_EXECUTE); - perms.add(PosixFilePermission.GROUP_EXECUTE); - perms.add(PosixFilePermission.OTHERS_EXECUTE); - Files.setPosixFilePermissions(file, perms); - } catch (IOException ioe) { - throw new UncheckedIOException(ioe); - } - } - private void createImage() throws IOException { Collection modules = resolve(options.mods); log.print(modules.stream().collect(Collectors.joining(" "))); @@ -377,7 +362,7 @@ class ImageBuilder { .filter(f -> f.getFileName().equals(jspawnhelper)) .findFirst(); if (helper.isPresent()) - setExecutable(helper.get()); + helper.get().toFile().setExecutable(true, false); } private class ImageFileHelper { diff --git a/jdk/make/src/classes/build/tools/module/ModuleArchive.java b/jdk/make/src/classes/build/tools/module/ModuleArchive.java index 41d7ae1c282..f05020b9842 100644 --- a/jdk/make/src/classes/build/tools/module/ModuleArchive.java +++ b/jdk/make/src/classes/build/tools/module/ModuleArchive.java @@ -194,7 +194,7 @@ public class ModuleArchive implements Archive { case CMDS: Path path = destFile("bin", filename); writeEntry(in, path); - path.toFile().setExecutable(true); + path.toFile().setExecutable(true, false); break; case CONFIGS: writeEntry(in, destFile("conf", filename));