[m-rev.] diff: fix bug #388

Julien Fischer jfischer at opturion.com
Sun Nov 29 14:40:45 AEDT 2015

Fix bug #388.

Doing 'sudo make install' on Linux with Java 7 or later results in the installed
standard library jars being owned by the root user (which is fine) and with
permissions 0600 (which is not).  This is occurring because as part of building
the library jars we create a jar index using the 'jar -i' command.  Doing so
creates a temporary file with the above permissions and the installed version
inherits those.  Building the index is only useful for executable jars anyway
and the Mercury compiler never builds those, so the fix is to simply not build
the index.

This fix is due to Sebastian Godelet.

      As above.

diff --git a/compiler/compile_target_code.m b/compiler/compile_target_code.m
index 322a0ef..2e3b98e 100644
--- a/compiler/compile_target_code.m
+++ b/compiler/compile_target_code.m
@@ -3058,13 +3058,8 @@ create_java_exe_or_lib(Globals, ErrorStream, LinkTargetType, MainModuleName,
          invoke_system_command(Globals, ErrorStream, cmd_verbose_commands, Cmd,
              Succeeded0, !IO),
          io.remove_file(TempFileName, _, !IO),
-            Succeeded0 = yes,
-            % Add an index, which is supposed to speed up class loading.
-            IndexCmd = string.append_list([Jar, " i ", JarFileName]),
-            invoke_system_command(Globals, ErrorStream, cmd_verbose_commands,
-                IndexCmd, _, !IO)
+            Succeeded0 = yes
              Succeeded0 = no,
              io.remove_file(JarFileName, _, !IO)

More information about the reviews mailing list