changeset 11065:caff423bb810

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
author simonis
date Fri, 05 Dec 2014 19:46:15 +0100
parents f2434e959e18
children b3620b8c9b47
files make/src/classes/build/tools/module/ImageBuilder.java make/src/classes/build/tools/module/ModuleArchive.java
diffstat 2 files changed, 2 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/make/src/classes/build/tools/module/ImageBuilder.java	Fri Dec 05 15:35:15 2014 +0000
+++ b/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/make/src/classes/build/tools/module/ModuleArchive.java	Fri Dec 05 15:35:15 2014 +0000
+++ b/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));