8066766: The commands in the modular images are executable by the owner only
authorsimonis
Fri, 05 Dec 2014 19:46:15 +0100
changeset 27934 2b4d774b50dc
parent 27933 2e48c9e946a7
child 27935 80c148fb46c5
8066766: The commands in the modular images are executable by the owner only Summary: Also simplify the 'set executable' step of jspawnhelper in ImageBuilder.java Reviewed-by: chegar, alanb
jdk/make/src/classes/build/tools/module/ImageBuilder.java
jdk/make/src/classes/build/tools/module/ModuleArchive.java
--- a/jdk/make/src/classes/build/tools/module/ImageBuilder.java	Fri Dec 05 15:35:15 2014 +0000
+++ b/jdk/make/src/classes/build/tools/module/ImageBuilder.java	Fri Dec 05 19:46:15 2014 +0100
@@ -349,21 +349,6 @@
         return (new SimpleResolver(mods, moduleGraph)).resolve();
     }
 
-    /**
-     * chmod ugo+x file
-     */
-    private void setExecutable(Path file) {
-        try {
-            Set<PosixFilePermission> 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<String> modules = resolve(options.mods);
         log.print(modules.stream().collect(Collectors.joining(" ")));
@@ -377,7 +362,7 @@
                                      .filter(f -> f.getFileName().equals(jspawnhelper))
                                      .findFirst();
         if (helper.isPresent())
-            setExecutable(helper.get());
+            helper.get().toFile().setExecutable(true, false);
     }
 
     private class ImageFileHelper {
--- a/jdk/make/src/classes/build/tools/module/ModuleArchive.java	Fri Dec 05 15:35:15 2014 +0000
+++ b/jdk/make/src/classes/build/tools/module/ModuleArchive.java	Fri Dec 05 19:46:15 2014 +0100
@@ -194,7 +194,7 @@
                         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));