2024-11-23 19:05 AEDT

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0000388mercuryBugpublic2015-12-14 10:31
Reporterjuliensf 
Assigned Tojuliensf 
PrioritynormalSeverityminorReproducibilityhave not tried
StatusresolvedResolutionfixed 
Product Version 
Target Version15.11Fixed in Version 
Summary0000388: Inconsistent permissions on library jar files
DescriptionThe Java archives for the standard libraries are installed in such a way that they only user readable and writeable. Aside from not being very useful in multi-user environments, this is also inconsistent with the permissions on the library files in other grades (which are group readable and writeable and world readable.)
TagsNo tags attached.
Attached Files
  • diff file icon fix-java-jar-index.diff (1,733 bytes) 2015-07-10 14:16 -
    diff --git a/compiler/compile_target_code.m b/compiler/compile_target_code.m
    index c710fcf..ec87928 100644
    --- a/compiler/compile_target_code.m
    +++ b/compiler/compile_target_code.m
    @@ -1708,15 +1708,19 @@ file_as_new_as(FileNameA, Rel, FileNameB, !IO) :-
     
     compare_file_timestamps(FileNameA, FileNameB, MaybeCompare, !IO) :-
         io.file_modification_time(FileNameA, TimeResultA, !IO),
    -    io.file_modification_time(FileNameB, TimeResultB, !IO),
    -    (
    -        TimeResultA = ok(TimeA),
    -        TimeResultB = ok(TimeB)
    -    ->
    -        compare(Compare, TimeA, TimeB),
    -        MaybeCompare = yes(Compare)
    -    ;
    -        MaybeCompare = no
    +    ( if FileNameA = FileNameB then
    +        MaybeCompare = ( if TimeResultA = ok(_) then yes((=)) else no )
    +    else
    +        io.file_modification_time(FileNameB, TimeResultB, !IO),
    +        ( if
    +            TimeResultA = ok(TimeA),
    +            TimeResultB = ok(TimeB)
    +        then
    +            compare(Compare, TimeA, TimeB),
    +            MaybeCompare = yes(Compare)
    +        else
    +            MaybeCompare = no
    +        )
         ).
     
     %-----------------------------------------------------------------------------%
    @@ -3116,11 +3120,7 @@ create_java_exe_or_lib(Globals, ErrorStream, LinkTargetType, MainModuleName,
             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)
    
    diff file icon fix-java-jar-index.diff (1,733 bytes) 2015-07-10 14:16 +
  • log file icon fix-java-jar-index.log (986 bytes) 2015-07-10 14:16

-Relationships
+Relationships

-Notes

~0000840

juliensf (administrator)

This is occurring on a CentOS 7 system. Thing are ok on OS X system.

~0000841

sebgod (reporter)

Hello Julien. I have the same problem on Fedora as well. This is a problem introduced by Java 7+, where temporary files get only 0600 permissions.
This happens when the Mercury compiler invokes the Java index option, which is currently used in a wrong fashion any way, since the jar index only works for multiple referenced jar files, but Mercury only references the jar file itself, which is not needed.
I've added a patch to make that point clearer.

~0000871

juliensf (administrator)

Fixed in commit 2d01e41. (The race condition on Windows has been moved into bug 0000399.)
+Notes

-Issue History
Date Modified Username Field Change
2015-07-10 13:50 juliensf New Issue
2015-07-10 14:07 juliensf Note Added: 0000840
2015-07-10 14:15 sebgod Note Added: 0000841
2015-07-10 14:16 sebgod File Added: fix-java-jar-index.diff
2015-07-10 14:16 sebgod File Added: fix-java-jar-index.log
2015-11-02 13:30 juliensf Assigned To => juliensf
2015-11-02 13:30 juliensf Status new => assigned
2015-11-02 13:30 juliensf Target Version => 15.11
2015-12-14 10:27 juliensf Issue cloned: 0000399
2015-12-14 10:31 juliensf Note Added: 0000871
2015-12-14 10:31 juliensf Status assigned => resolved
2015-12-14 10:31 juliensf Resolution open => fixed
+Issue History