make/src/classes/build/tools/module/ImageBuilder.java
Print this page
rev 11064 : 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
@@ -347,25 +347,10 @@
private List<String> resolve(Set<String> mods ) {
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(" ")));
ImageFileHelper imageHelper = new ImageFileHelper(modules);
imageHelper.createModularImage(options.output);
@@ -375,11 +360,11 @@
Path lib = options.output.resolve("lib");
Optional<Path> helper = Files.walk(lib, 2)
.filter(f -> f.getFileName().equals(jspawnhelper))
.findFirst();
if (helper.isPresent())
- setExecutable(helper.get());
+ helper.get().toFile().setExecutable(true, false);
}
private class ImageFileHelper {
final Collection<String> modules;
final Set<String> bootModules;