2024-11-23 20:27 AEDT

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0000399mercuryBugpublic2015-12-14 10:28
Reporterjuliensf 
Assigned Tojuliensf 
PrioritynormalSeverityminorReproducibilityhave not tried
StatusassignedResolutionopen 
Product Version 
Target VersionFixed in Version 
Summary0000399: race condition on Windows when comparing a file to itself.
DescriptionThe attached patch fixes a race condition on Windows when comparing a file to itself.
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

~0000870

juliensf (administrator)

The parts of the patch that deal with 0000388 have been handled separately.
+Notes

-Issue History
Date Modified Username Field Change
2015-12-14 10:27 juliensf New Issue
2015-12-14 10:27 juliensf Status new => assigned
2015-12-14 10:27 juliensf Assigned To => juliensf
2015-12-14 10:27 juliensf Issue generated from: 0000388
2015-12-14 10:28 juliensf Note Added: 0000870
+Issue History