Your message dated Mon, 01 Jun 2009 21:49:43 +0000
with message-id <[email protected]>
and subject line Bug#528681: fixed in fpc 2.2.4-2
has caused the Debian Bug report #528681,
regarding FindFirst() returns true, but the filename is an empty string
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
528681: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=528681
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: fp-units-rtl
Version: 2.2.4-1

The FindFirst() function returns true, but the filename is an empty string.

This Bug is fixed upstream. Log from revision 13074, trunk :
 * also consider the search attributes for findfirst if the name does
   not contain wildcards + test
 * don't return true from FindGetFileInfo if the file name is ok, but the
   search attributes don't match (resulted in returning multiple times the
   name of the previous entry that did fulfill all requirements)

I have attached a patch. It's the diff from rev 13074, without the added
testprogram. I had to fix one (easy) hunk manually.

How to reproduce:

Create an empty subdirectory './empty_dir' an start following program.
It should not give any output, but writes 'Found:  Len=0'.

program fpc_find;
uses sysutils;
var SearchRec : TSearchRec;
begin
  if ( FindFirst('./empty_dir/*', faAnyFile - faDirectory, SearchRec ) = 0 ) 
then
  with SearchRec do
    writeln( 'Found : ', Name,' Len=', length(Name) );
  FindClose( SearchRec );
end.

Thank you
Stefan Kisdaroczi
This patch fixes the FindFirst and FindGetFileInfo functions.

--- fpc-2.2.4.orig/fpcsrc/rtl/unix/sysutils.pp  2008-11-29 17:27:25.000000000 
+0100
+++ fpc-2.2.4/fpcsrc/rtl/unix/sysutils.pp       2009-05-13 14:10:02.000000000 
+0200
@@ -416,8 +416,6 @@ var
   UnixFindData : PUnixFindData;
 Begin
   UnixFindData:=PUnixFindData(f.FindHandle);
-  if UnixFindData=nil then
-    exit;
   if UnixFindData^.SearchType=0 then
     begin
       if UnixFindData^.dirptr<>nil then
@@ -430,27 +428,31 @@ End;

 Function FindGetFileInfo(const s:string;var f:TSearchRec):boolean;
 var
-  st      : baseunix.stat;
-  WinAttr : longint;
+  st           : baseunix.stat;
+  WinAttr      : longint;
+  ResolvedPath : string;
+  LinkLen      : ssize_t;

 begin
   FindGetFileInfo:=false;
   If Assigned(F.FindHandle) and ((((PUnixFindData(f.FindHandle)^.searchattr)) 
and faSymlink) > 0) then
-    FindGetFileInfo:=(fplstat(pointer(s),st)=0)
+    FindGetFileInfo:=(fplstat(pointer(s),st)=0)
   else
     FindGetFileInfo:=(fpstat(pointer(s),st)=0);
-  If not FindGetFileInfo then
-    exit;
+  If not FindGetFileInfo then
+    exit;
   WinAttr:=LinuxToWinAttr(PChar(pointer(s)),st);
-  If (f.FindHandle = nil) or ((WinAttr and 
Not(PUnixFindData(f.FindHandle)^.searchattr))=0) Then
+  If ((WinAttr and Not(PUnixFindData(f.FindHandle)^.searchattr))=0) Then
    Begin
      f.Name:=ExtractFileName(s);
      f.Attr:=WinAttr;
      f.Size:=st.st_Size;
      f.Mode:=st.st_mode;
      f.Time:=UnixToWinAge(st.st_mtime);
-     result:=true;
-   End;
+     FindGetFileInfo:=true;
+   End
+  else
+    FindGetFileInfo:=false;
 end;


@@ -469,7 +471,10 @@ Var
 Begin
   Result:=-1;
   UnixFindData:=PUnixFindData(Rslt.FindHandle);
-  if UnixFindData=nil then
+  { SearchSpec='' means that there were no wild cards, so only one file to
+    find.
+  }
+  if UnixFindData^.SearchSpec='' then
     exit;
   if (UnixFindData^.SearchType=0) and
      (UnixFindData^.Dirptr=nil) then
@@ -519,6 +524,12 @@ Begin
   fillchar(Rslt,sizeof(Rslt),0);
   if Path='' then
     exit;
+  { Allocate UnixFindData (we always need it, for the search attributes) }
+  New(UnixFindData);
+  FillChar(UnixFindData^,sizeof(UnixFindData^),0);
+  Rslt.FindHandle:=UnixFindData;
+   {We always also search for readonly and archive, regardless of Attr:}
+  UnixFindData^.SearchAttr := Attr or faarchive or fareadonly;
   {Wildcards?}
   if (Pos('?',Path)=0)  and (Pos('*',Path)=0) then
    begin
@@ -527,14 +538,8 @@ Begin
    end
   else
    begin
-     { Allocate UnixFindData }
-     New(UnixFindData);
-     FillChar(UnixFindData^,sizeof(UnixFindData^),0);
-     Rslt.FindHandle:=UnixFindData;
      {Create Info}
      UnixFindData^.SearchSpec := Path;
-     {We always also search for readonly and archive, regardless of Attr:}
-     UnixFindData^.SearchAttr := Attr or faarchive or fareadonly;
      UnixFindData^.NamePos := Length(UnixFindData^.SearchSpec);
      while (UnixFindData^.NamePos>0) and 
(UnixFindData^.SearchSpec[UnixFindData^.NamePos]<>'/') do
        dec(UnixFindData^.NamePos);

Attachment: signature.asc
Description: OpenPGP digital signature


--- End Message ---
--- Begin Message ---
Source: fpc
Source-Version: 2.2.4-2

We believe that the bug you reported is fixed in the latest version of
fpc, which is due to be installed in the Debian FTP archive:

fp-compiler_2.2.4-2_amd64.deb
  to pool/main/f/fpc/fp-compiler_2.2.4-2_amd64.deb
fp-docs_2.2.4-2_all.deb
  to pool/main/f/fpc/fp-docs_2.2.4-2_all.deb
fp-ide_2.2.4-2_amd64.deb
  to pool/main/f/fpc/fp-ide_2.2.4-2_amd64.deb
fp-units-base_2.2.4-2_amd64.deb
  to pool/main/f/fpc/fp-units-base_2.2.4-2_amd64.deb
fp-units-db_2.2.4-2_amd64.deb
  to pool/main/f/fpc/fp-units-db_2.2.4-2_amd64.deb
fp-units-fcl_2.2.4-2_amd64.deb
  to pool/main/f/fpc/fp-units-fcl_2.2.4-2_amd64.deb
fp-units-fv_2.2.4-2_amd64.deb
  to pool/main/f/fpc/fp-units-fv_2.2.4-2_amd64.deb
fp-units-gfx_2.2.4-2_amd64.deb
  to pool/main/f/fpc/fp-units-gfx_2.2.4-2_amd64.deb
fp-units-gnome1_2.2.4-2_amd64.deb
  to pool/main/f/fpc/fp-units-gnome1_2.2.4-2_amd64.deb
fp-units-gtk2_2.2.4-2_amd64.deb
  to pool/main/f/fpc/fp-units-gtk2_2.2.4-2_amd64.deb
fp-units-gtk_2.2.4-2_amd64.deb
  to pool/main/f/fpc/fp-units-gtk_2.2.4-2_amd64.deb
fp-units-misc_2.2.4-2_amd64.deb
  to pool/main/f/fpc/fp-units-misc_2.2.4-2_amd64.deb
fp-units-multimedia_2.2.4-2_amd64.deb
  to pool/main/f/fpc/fp-units-multimedia_2.2.4-2_amd64.deb
fp-units-net_2.2.4-2_amd64.deb
  to pool/main/f/fpc/fp-units-net_2.2.4-2_amd64.deb
fp-units-rtl_2.2.4-2_amd64.deb
  to pool/main/f/fpc/fp-units-rtl_2.2.4-2_amd64.deb
fp-utils_2.2.4-2_amd64.deb
  to pool/main/f/fpc/fp-utils_2.2.4-2_amd64.deb
fpc-source_2.2.4-2_all.deb
  to pool/main/f/fpc/fpc-source_2.2.4-2_all.deb
fpc_2.2.4-2.diff.gz
  to pool/main/f/fpc/fpc_2.2.4-2.diff.gz
fpc_2.2.4-2.dsc
  to pool/main/f/fpc/fpc_2.2.4-2.dsc
fpc_2.2.4-2_all.deb
  to pool/main/f/fpc/fpc_2.2.4-2_all.deb



A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to [email protected],
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Mazen Neifer <[email protected]> (supplier of updated fpc package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing [email protected])


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Format: 1.8
Date: Sat, 30 May 2009 17:46:00 +0200
Source: fpc
Binary: fpc fpc-source fp-compiler fp-ide fp-utils fp-docs fp-units-rtl 
fp-units-base fp-units-fcl fp-units-fv fp-units-gtk fp-units-gtk2 
fp-units-gnome1 fp-units-db fp-units-gfx fp-units-net fp-units-misc 
fp-units-multimedia fp-units-i386
Architecture: source amd64 all
Version: 2.2.4-2
Distribution: unstable
Urgency: low
Maintainer: Carlos Laviola <[email protected]>
Changed-By: Mazen Neifer <[email protected]>
Description: 
 fp-compiler - Free Pascal - Compiler
 fp-docs    - Free Pascal - Documentation
 fp-ide     - Free Pascal - IDE
 fp-units-base - Free Pascal - base units
 fp-units-db - Free Pascal - database libraries units
 fp-units-fcl - Free Pascal - Free Component Library
 fp-units-fv - Free Pascal - Free Vision units
 fp-units-gfx - Free Pascal - graphics libraries units
 fp-units-gnome1 - Free Pascal - GNOME 1 units
 fp-units-gtk - Free Pascal - GTK+ 1.2 units
 fp-units-gtk2 - Free Pascal - GTK+ 2.x units
 fp-units-i386 - Free Pascal - miscellaneous units
 fp-units-misc - Free Pascal - miscellaneous units
 fp-units-multimedia - Free Pascal - miscellaneous units
 fp-units-net - Free Pascal - networking units
 fp-units-rtl - Free Pascal - Runtime Library
 fp-utils   - Free Pascal - Utils
 fpc        - Free Pascal Compiler - Meta Package
 fpc-source - Free Pascal Compiler - Source Code
Closes: 511626 515035 528681
Changes: 
 fpc (2.2.4-2) unstable; urgency=low
 .
   [ Stefan Kisdaroczi ]
   * Fixed FindFirst and FindGetFileInfo functions. (Closes: Bug#528681)
 .
   [ Mazen Neifer ]
   * Added lintian override rules for embedded-zlib
   * Fixed wrong passing of function parameters for powerpc architecture.
     (Closes: Bug#515035, Bug#511626)
Checksums-Sha1: 
 7ef52c1bed73c7885c94a81fbc76d58d0908ee79 1579 fpc_2.2.4-2.dsc
 6a6db965d7f888ff6d73b7965da4977b1a33e7d6 20458 fpc_2.2.4-2.diff.gz
 85dac9537b846f7bbc74bad512d68fcfaddd7b69 1971658 fp-compiler_2.2.4-2_amd64.deb
 2ffa1a6cc35a739bb57ca53c9e96c8cb0ac9aa60 1261844 fp-ide_2.2.4-2_amd64.deb
 51a0f02f185a5e56c8ff0bead23e07f81dedece0 3818478 fp-utils_2.2.4-2_amd64.deb
 c1acc39195826519fb8c5e711d82a2692a839837 2054928 fp-units-rtl_2.2.4-2_amd64.deb
 ac5bcc6371b4ea343ae1a191a13cdd5a6e9951c3 1278032 
fp-units-base_2.2.4-2_amd64.deb
 14dc3b6ca631f3b01a78999f176dc6af082e6492 4357522 fp-units-fcl_2.2.4-2_amd64.deb
 88fb85c78a07d1653073d454e64e263f1a73878a 477468 fp-units-fv_2.2.4-2_amd64.deb
 413c27ef4c1ce5390869aeba6b4ee64f6947c870 993034 fp-units-gtk_2.2.4-2_amd64.deb
 935421a966b1ff0a8d1f82a4060f8b15e2454e60 1522522 
fp-units-gtk2_2.2.4-2_amd64.deb
 df0087c611e6b0f93ac8a1e2493369bc6f0579a9 350440 
fp-units-gnome1_2.2.4-2_amd64.deb
 157672c6a32af11c337cd936314a7d903a2dc402 1168468 fp-units-db_2.2.4-2_amd64.deb
 75a741160ce3984011ef71bfa26227a9ccca70f8 889954 fp-units-gfx_2.2.4-2_amd64.deb
 866518997a15f9367333069b838eca8dd580e06a 623726 fp-units-net_2.2.4-2_amd64.deb
 8dc497df24089b7e5125bf8169d8c02f05434e67 812386 fp-units-misc_2.2.4-2_amd64.deb
 48a5ca2d2bf29ca5c4693619d5e4b30c9c403195 174310 
fp-units-multimedia_2.2.4-2_amd64.deb
 e889442cb86d0faa900cb1f14d598f219e44b382 10584 fpc_2.2.4-2_all.deb
 86471564d63857e7453c86f1d3006c06c13d3c89 12915810 fpc-source_2.2.4-2_all.deb
 f44ff4e42601d0266191833f5882fa9bc6f44c48 1667436 fp-docs_2.2.4-2_all.deb
Checksums-Sha256: 
 420dc841906ebaa8570484e79f8a63d244836b0e984f83b11a53c1b3db4d8ed2 1579 
fpc_2.2.4-2.dsc
 42e4c81a2cd534c3f16d9292995bd44f9f02b6a5e522db48820b56a4f79cfdf1 20458 
fpc_2.2.4-2.diff.gz
 5998697dafca2e6c0ce2ee639b18834edd7c0d8efdbc050171983aad43784513 1971658 
fp-compiler_2.2.4-2_amd64.deb
 d97be0eadd68b2186bf3ec20eea4059ef2278160c951ce66866c63133cb20bd8 1261844 
fp-ide_2.2.4-2_amd64.deb
 308fe4cb6f1948e16fae52e6e92aa6b88f8f2dc9c4662f9dcc282f0611861901 3818478 
fp-utils_2.2.4-2_amd64.deb
 547ef08a6129cfc94f5fba505633d0af8cbb8dd2849cac23639e45ba0c670169 2054928 
fp-units-rtl_2.2.4-2_amd64.deb
 518b85c93f5fa786438696fc69ecf7b9c9a388afff92b6c66ee93c92bd77b349 1278032 
fp-units-base_2.2.4-2_amd64.deb
 67de2b494e4149e9ab199c62d9a350fa2a9ff0077d5e877abc9c363c59a3ed26 4357522 
fp-units-fcl_2.2.4-2_amd64.deb
 51278f81d21cd191d04536d9c7d41aea4fc540a6ff664deb244068f5ba023b87 477468 
fp-units-fv_2.2.4-2_amd64.deb
 b984921d3ec634ce57e061c56ecadbb9d0fd0036a89bb29343de1c76d6e8efc9 993034 
fp-units-gtk_2.2.4-2_amd64.deb
 4fdf47afa12d39808c32e894fb5a08c49f280d1ae0f9ed8b43d7cfc781ab8ebc 1522522 
fp-units-gtk2_2.2.4-2_amd64.deb
 6633aa547dc3dc3bf442c753b0d5b051ec5c4ddcdf31d2bef2712f0a5cb0aca5 350440 
fp-units-gnome1_2.2.4-2_amd64.deb
 afdbf67b40331b3a33f6cb34f871487e9f22a503ce180f72ae07cb2d8c1958dd 1168468 
fp-units-db_2.2.4-2_amd64.deb
 fbb84eb6277292d83fd3ae1881fc79893ea208aa2ae1c0eaec308a4d3f88e51e 889954 
fp-units-gfx_2.2.4-2_amd64.deb
 303b10d2df64875fee0a56463bb1d3d2fa93fdbcc4e8e1f0f5bdaf0659311051 623726 
fp-units-net_2.2.4-2_amd64.deb
 53a8067007b3f1c8717e3b2df1546144df5d1d71b7500938d83bacebbc163a46 812386 
fp-units-misc_2.2.4-2_amd64.deb
 fed1c92471a182063cf91c125dbfbc91c7e47f92c5e084974c00a5bd8f3e9650 174310 
fp-units-multimedia_2.2.4-2_amd64.deb
 e3330530010a3af278ea2a059149b00722e6f4e8f8c6201c618cb937cb23aa51 10584 
fpc_2.2.4-2_all.deb
 16dbbaba920a606bcd167fd5b8d0a4750f97b5e3755f00f21976ed7018ee9cf3 12915810 
fpc-source_2.2.4-2_all.deb
 3bd7faaf7ee8e4f693a7869340bd652752eb0bd609134ee383beff1fe300f10f 1667436 
fp-docs_2.2.4-2_all.deb
Files: 
 768e108258288518e67510681c1e4d96 1579 devel optional fpc_2.2.4-2.dsc
 93eb21438542b162468cab371d636f82 20458 devel optional fpc_2.2.4-2.diff.gz
 4866427066f6172ce4f4e9bc7c793b24 1971658 devel optional 
fp-compiler_2.2.4-2_amd64.deb
 f2d240c7449596c71fcf92007ca0160b 1261844 devel optional 
fp-ide_2.2.4-2_amd64.deb
 2b429941b2ceefcd0520d1efa0025178 3818478 devel optional 
fp-utils_2.2.4-2_amd64.deb
 0e56233f63a9993f3ab5410f9a1f6c4a 2054928 devel optional 
fp-units-rtl_2.2.4-2_amd64.deb
 6edd1b2ef9f02685d4c4d6c1c5fe4606 1278032 devel optional 
fp-units-base_2.2.4-2_amd64.deb
 869e59d9415c6f844a50bf0adf3d43b4 4357522 devel optional 
fp-units-fcl_2.2.4-2_amd64.deb
 bd4752b6a535ec114e76afde9b354cc9 477468 devel optional 
fp-units-fv_2.2.4-2_amd64.deb
 508605c58fa4014699c9db68a9fe56c3 993034 devel optional 
fp-units-gtk_2.2.4-2_amd64.deb
 8b58234962dc61a628acc2e9903edf43 1522522 devel optional 
fp-units-gtk2_2.2.4-2_amd64.deb
 0e0322fb10e0d60d5c2f43828d7a6805 350440 devel optional 
fp-units-gnome1_2.2.4-2_amd64.deb
 ed99e3354eaddb8ee46587ec2b19d14a 1168468 devel optional 
fp-units-db_2.2.4-2_amd64.deb
 cd89a508b308b36066318711623db2ae 889954 devel optional 
fp-units-gfx_2.2.4-2_amd64.deb
 913ba436cade395f998a5270a4a70e31 623726 devel optional 
fp-units-net_2.2.4-2_amd64.deb
 1414f46a03b68a957757ea1d8272e80a 812386 devel optional 
fp-units-misc_2.2.4-2_amd64.deb
 97e66e83abe5d8b63dea660ae5374521 174310 devel optional 
fp-units-multimedia_2.2.4-2_amd64.deb
 564e65e28c499384faaeee2d13350d2c 10584 devel optional fpc_2.2.4-2_all.deb
 e6de53ce4e18e8eda15bf8dfed33c6e1 12915810 devel optional 
fpc-source_2.2.4-2_all.deb
 da5dddbc1c9f9f029c96637cfc64d0be 1667436 doc optional fp-docs_2.2.4-2_all.deb

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkokLfAACgkQfY3dicTPjsNQTwCdFlzlvZnpatMNjVuquFnSWMl1
6SIAoJOFgVGzSQA1d963jjI5fbowroNH
=Kim9
-----END PGP SIGNATURE-----



--- End Message ---

Reply via email to