#1 2020-11-25 10:43:03

mpv
Member
From: Ukraine
Registered: 2012-03-24
Posts: 1,571
Website

FPC 3.2 FileExists problem on NFTS with de-duplication

We found a critical problem in FPC 3.2 FileExists RTL function under Windows

In case file is placed on the NTFS file system with de-duplication enabled  and is de-duplicated (FILE_ATTRIBUTE_REPARSE_POINT attribute is sets for file) then FileExists(fileName) always returns False.

The solution is to use FileExists(fileName, false) to disable FollowLink check.

Offline

#2 2020-11-25 11:53:39

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,682
Website

Re: FPC 3.2 FileExists problem on NFTS with de-duplication

Won't it break existing code if we put an alias around FileExists() to force FollowLink=false in our framework?

Following you feedback, I am tempted, at least for mORMot 2, to define a FileExists() in mormot.core.os.pas for Windows, on both FPC and Delphi.
We could just call GetFileAttributesA/GetFileAttributesW for fast and simple check.
Will it work in your case?

Offline

#3 2020-11-25 17:23:13

mpv
Member
From: Ukraine
Registered: 2012-03-24
Posts: 1,571
Website

Re: FPC 3.2 FileExists problem on NFTS with de-duplication

Yes, for sure. In fact I already have such a function on Windows and use it everywhere except SyNode, so having it in  mormot.core.os. is a plus for me

Offline

#4 2020-12-02 21:14:17

PascalDragon
Member
From: Germany
Registered: 2016-06-01
Posts: 12

Re: FPC 3.2 FileExists problem on NFTS with de-duplication

mpv wrote:

We found a critical problem in FPC 3.2 FileExists RTL function under Windows

Would you please test whether this also happens with 3.2.1, cause I fixed the reparse point handling a few months ago and merged it to fixes?


Free Pascal Compiler Core developer

Offline

#5 2020-12-03 13:58:48

mpv
Member
From: Ukraine
Registered: 2012-03-24
Posts: 1,571
Website

Re: FPC 3.2 FileExists problem on NFTS with de-duplication

Unfortunately I can't verify it now - since a problem occurs on the production environment I do not have access to I ask their administrator to remove a de-duplication.

One thing I noticed - all deduplicated files have both FILE_ATTRIBUTE_REPARSE_POINT and FILE_ATTRIBUTE_SPARSE_FILE attributes enabled. May be this is a way to simplify a current implementation ( I mean in this line - https://github.com/graemeg/freepascal/b … s.pp#L565)

Once I got access to some deduplicated FS I will verify your patch

Offline

Board footer

Powered by FluxBB