View Issue Details

IDProjectCategoryView StatusLast Update
0026635FPCUtilitiespublic2014-08-26 23:07
ReporterChrisFAssigned ToMarco van de Voort 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
PlatformWindowsOSOS Version
Product Version2.6.4Product Build 
Target VersionFixed in Version3.0.0 
Summary0026635: InstantFPC 1.3 doesn't work (Windows version only)
DescriptionImpossible to run a Pascal program with InstantFPC 1.3 (which is coming with FPC 2.6.4) in Windows.


There are 2 main issues due to the 1.3 version:

-the .exe extension is not fully used in the code, which gives 2 errors: neither the deletion of the .exe file in the cache directory is done, nor the copy (i.e. "rename") of the .exe file from the __tmpxxxx directory to the cache directory (the last one being the "current visible" bug observed when running InstantFPC 1.3 in Windows),

-the __tmpxxxx directory is not deleted (FindClose is missing).


Attached, a patch for the FPC trunk version which is fixing these 2 issues.
TagsNo tags attached.
Fixed in Revision28523
FPCOldBugId
FPCTarget
Attached Files
  • mypatch.diff (2,336 bytes)
    Index: instantfpc/instantfptools.pas
    ===================================================================
    --- instantfpc/instantfptools.pas	(r�vision 28521)
    +++ instantfpc/instantfptools.pas	(copie de travail)
    @@ -264,6 +264,7 @@
             Halt(1);
           end;
         until FindNext(FileInfo)<>0;
    +    Findclose(FileInfo);
       end;
       if not RemoveDir(Directory) then begin
         writeln('unable to delete directory "'+Directory+'"');
    @@ -281,7 +282,7 @@
       buf : Array[1..4096] of byte;
       pid: SizeUInt;
       BuildDir: String;
    -  BuildOutputFilename: String;
    +  OutputFilenameExe, BuildOutputFilename: String;
     
       procedure CleanUp;
       begin
    @@ -295,14 +296,15 @@
       Compiler:=GetCompiler;
       pid:=GetProcessID;
       BuildDir:='';
    -  BuildOutputFilename:=OutputFilename;
    +  OutputFilenameExe:=OutputFilename {$IFDEF HASEXEEXT} + '.exe' {$ENDIF};
    +  BuildOutputFilename:=OutputFilenameExe;
       if pid>0 then begin
    -    BuildDir:=ExtractFilePath(OutputFilename)+'__tmp'+IntToStr(pid)+PathDelim;
    -    BuildOutputFilename:=BuildDir+ExtractFileName(OutputFilename);
    +    BuildDir:=ExtractFilePath(OutputFilenameExe)+'__tmp'+IntToStr(pid)+PathDelim;
    +    BuildOutputFilename:=BuildDir+ExtractFileName(OutputFilenameExe);
       end;
       //writeln('Compiler=',Compiler,' Params=',CompParams);
    -  if FileExists(OutputFilename) and not DeleteFile(OutputFilename) then begin
    -    writeln('unable to delete ',OutputFilename);
    +  if FileExists(OutputFilenameExe) and not DeleteFile(OutputFilenameExe) then begin
    +    writeln('unable to delete ',OutputFilenameExe);
         Halt(1);
       end;
       if BuildDir<>'' then begin
    @@ -337,8 +339,8 @@
         end;
         if BuildDir<>'' then begin
           // move from build directory to cache
    -      if not RenameFile(BuildOutputFilename,OutputFilename) then begin
    -        writeln('unable to move "',BuildOutputFilename,'" to "',OutputFilename,'"');
    +      if not RenameFile(BuildOutputFilename,OutputFilenameExe) then begin
    +        writeln('unable to move "',BuildOutputFilename,'" to "',OutputFilenameExe,'"');
             Halt(1);
           end;
         end;
    @@ -370,7 +372,7 @@
         end;
       if OutputDirectory<>'' then
         AddParam('-FU'+OutputDirectory,Result);
    -  AddParam('-o'+OutputFilename {$IFDEF HASEXEEXT} + '.exe' {$ENDIF},Result);
    +  AddParam('-o'+OutputFilename,Result);
       AddParam(SrcFilename,Result);
     end;
     
    
    mypatch.diff (2,336 bytes)

Activities

ChrisF

2014-08-26 19:10

reporter  

mypatch.diff (2,336 bytes)
Index: instantfpc/instantfptools.pas
===================================================================
--- instantfpc/instantfptools.pas	(r�vision 28521)
+++ instantfpc/instantfptools.pas	(copie de travail)
@@ -264,6 +264,7 @@
         Halt(1);
       end;
     until FindNext(FileInfo)<>0;
+    Findclose(FileInfo);
   end;
   if not RemoveDir(Directory) then begin
     writeln('unable to delete directory "'+Directory+'"');
@@ -281,7 +282,7 @@
   buf : Array[1..4096] of byte;
   pid: SizeUInt;
   BuildDir: String;
-  BuildOutputFilename: String;
+  OutputFilenameExe, BuildOutputFilename: String;
 
   procedure CleanUp;
   begin
@@ -295,14 +296,15 @@
   Compiler:=GetCompiler;
   pid:=GetProcessID;
   BuildDir:='';
-  BuildOutputFilename:=OutputFilename;
+  OutputFilenameExe:=OutputFilename {$IFDEF HASEXEEXT} + '.exe' {$ENDIF};
+  BuildOutputFilename:=OutputFilenameExe;
   if pid>0 then begin
-    BuildDir:=ExtractFilePath(OutputFilename)+'__tmp'+IntToStr(pid)+PathDelim;
-    BuildOutputFilename:=BuildDir+ExtractFileName(OutputFilename);
+    BuildDir:=ExtractFilePath(OutputFilenameExe)+'__tmp'+IntToStr(pid)+PathDelim;
+    BuildOutputFilename:=BuildDir+ExtractFileName(OutputFilenameExe);
   end;
   //writeln('Compiler=',Compiler,' Params=',CompParams);
-  if FileExists(OutputFilename) and not DeleteFile(OutputFilename) then begin
-    writeln('unable to delete ',OutputFilename);
+  if FileExists(OutputFilenameExe) and not DeleteFile(OutputFilenameExe) then begin
+    writeln('unable to delete ',OutputFilenameExe);
     Halt(1);
   end;
   if BuildDir<>'' then begin
@@ -337,8 +339,8 @@
     end;
     if BuildDir<>'' then begin
       // move from build directory to cache
-      if not RenameFile(BuildOutputFilename,OutputFilename) then begin
-        writeln('unable to move "',BuildOutputFilename,'" to "',OutputFilename,'"');
+      if not RenameFile(BuildOutputFilename,OutputFilenameExe) then begin
+        writeln('unable to move "',BuildOutputFilename,'" to "',OutputFilenameExe,'"');
         Halt(1);
       end;
     end;
@@ -370,7 +372,7 @@
     end;
   if OutputDirectory<>'' then
     AddParam('-FU'+OutputDirectory,Result);
-  AddParam('-o'+OutputFilename {$IFDEF HASEXEEXT} + '.exe' {$ENDIF},Result);
+  AddParam('-o'+OutputFilename,Result);
   AddParam(SrcFilename,Result);
 end;
 
mypatch.diff (2,336 bytes)

Marco van de Voort

2014-08-26 23:07

manager   ~0076727

Applied

Issue History

Date Modified Username Field Change
2014-08-26 19:10 ChrisF New Issue
2014-08-26 19:10 ChrisF File Added: mypatch.diff
2014-08-26 23:07 Marco van de Voort Fixed in Revision => 28523
2014-08-26 23:07 Marco van de Voort Note Added: 0076727
2014-08-26 23:07 Marco van de Voort Status new => resolved
2014-08-26 23:07 Marco van de Voort Fixed in Version => 2.7.1
2014-08-26 23:07 Marco van de Voort Resolution open => fixed
2014-08-26 23:07 Marco van de Voort Assigned To => Marco van de Voort