Distribution/OS Source Differences lazarus / 8-Other ---------------------------------------------------------------------- sfeinst · 2010-03-02 15:44 Not sure if this belongs here, since it is really a FreePascal issue, but it is related to Lazarus. I downloaded and installed Lazarus for Windows.  It comes with the FPC 2.2.4 sources and binaries. On another machine, I have PCLinuxOS installed and using Synaptic, it installed FPC 2.2.4 as well as Lazarus. I ran into a problem with code referring to the time of a file using a SearchRec and FinFirst/Next.  Linux was returning invalid dates. I looked at the source for dos.pp (which has FindFirst/Next) in the Unix folder of both sets of sources.  FindFirst/Next call a function FindGetFileInfo.  I looked at that function.  The line related to setting the time value is different between the source sets.  The one on Windows (in the Unix folder) calls UnixDateToDt while the one on PCLOS in the Unix folder does not. Since both are 2.2.4, shouldn't the sources be the same? ---------------------------------------------------------------------- Ñuño_Martínez · 2010-03-02 16:23 Quote from: sfeinst on March 02, 2010, 04:44:32 pmSince both are 2.2.4, shouldn't the sources be the same? No, they don't "should" since they're different operating systems. Anyway, may be it's a bug. Can you post some code we can test to confirm? ---------------------------------------------------------------------- sfeinst · 2010-03-02 17:35 I made the assumption that the folders containing the OS names were the specific code for that OS (so windows folder would have windows code, unix would have linux/unix code) regardless of the OS the source was deployed on.  From what you wrote, this is not true and each deployment of source could be different based on the OS. Anyway, similar code to what I am using which produces the wrong date on Linux: var   FileInfo: SearchRec;   FileYear: word;   FileMonth: word;   FileDay: word; begin   try     FindFirst('*', anyFile, FileInfo);     while DosError = 0 do     begin       if (FileInfo.Name <> '.') and (FileInfo.Name <> '..') then       begin         decodedate(FileDateToDateTime(FileInfo.time), FileYear, FileMonth, FileDay);         writeln(FileInfo.Name + ':' + IntToStr(FileYear) + IntToStr(Filemonth));       end;       FindNext(FileInfo);     end;   finally     FileClose(FileInfo);   end; end; To get this to work on Linux, I changed: decodedate(FileDateToDateTime(FileInfo.time), FileYear, FileMonth, FileDay); to be: decodedate(FileDateToDateTime(FileAge(FileInfo.Name)), FileYear, FileMonth, FileDay); ---------------------------------------------------------------------- marcov · 2010-03-02 19:57 Note that FPC only releases one source as 2.2.4, so if these are different between distributions, some people messed with at least one of them. When in doubt, get the source from a freepascal.org source. Packaging problems, and other problems that can't be reproduced with the FPC reference distribution (the .tar.gz one) should be reported to the distribution's bug reporting systems. Moreover, 2.2.4 is not the most recent version, that is 2.4.0, which I would recommend to use, and also in general, I would functions in sysutils, and not unit dos. ---------------------------------------------------------------------- sfeinst · 2010-03-02 20:05 Thanks.  So the source should be the same. Quote from: marcov on March 02, 2010, 08:57:53 pmMoreover, 2.2.4 is not the most recent version, that is 2.4.0, which I would recommend to use. Already putting in a request to have this version.  Hopefully when they do this, it will be cleaned up. ---------------------------------------------------------------------- sfeinst · 2010-03-02 20:15 One other thing about the 2.2.4.  When I go to the Lazarus download site on sourceforge,  the FPC that is shown in the latest Lazarus version 0.98.2 is 2.2.4.  Why isn't Lazarus using 2.4.0 in its download area? ---------------------------------------------------------------------- marcov · 2010-03-02 20:17 Quote from: sfeinst on March 02, 2010, 09:15:17 pmOne other thing about the 2.2.4.  When I go to the Lazarus download site on sourceforge,  the FPC that is shown in the latest Lazarus version 0.98.2 is 2.2.4.  Why isn't Lazarus using 2.4.0 in its download area? From what I heard, Lazarus wants 2.4.0 in 0.9.30, but making that release ready  requires more time. They are also hoping that 2.4.2 will come out before 0.9.30, since 2.4.0 has some (minor) problems in the resource handling. ---------------------------------------------------------------------- Ñuño_Martínez · 2010-03-03 07:20 Quote from: sfeinst on March 02, 2010, 06:35:13 pmI made the assumption that the folders containing the OS names were the specific code for that OS (so windows folder would have windows code, unix would have linux/unix code) regardless of the OS the source was deployed on.  From what you wrote, this is not true and each deployment of source could be different based on the OS. I've read again what you wrote and I find my answer wasn't correct. I thought you were talking about different folders in different OS, not the same folder in different OS. marcov has the correct answer. Sorry. ---------------------------------------------------------------------- sfeinst · 2010-03-03 17:10 Quote from: marcov on March 02, 2010, 08:57:53 pmI would functions in sysutils, and not unit dos. Missed this line.  You are correct.  I should have been using sysutils not dos.  I'm going to change my code and see if anything changes on the Linux side (already tested in Windows and not issues making the change). ---------------------------------------------------------------------- sfeinst · 2010-03-03 22:22 Gee, use the correct units and see what happens, the code works.  Sysutils must set the time differently than dos does.  And since Dos was made to support Turbo Pascal, sysutils is the way to go.  Everything is working well on both Windows and Linux.  Now just need to work on my code to speed up some functions. Thanks for the help