[fpc-pascal] Why opening a file for write fails in fpc 2.6?
jonas.maebe at elis.ugent.be
Thu Nov 1 01:07:09 CET 2012
On 01 Nov 2012, at 00:24, Giuliano Colla wrote:
> Well, from the way Delphi File Mode are defined since the dawn of times, if you don't or fmWrite with anything, the default behavior is to open in fmShareCompat mode (=0), a legacy DOS mode tied to the long time dead FCB inherited from CP/1, which, to my knowledge, doesn't grant an exclusive lock, and which has no Unix equivalent. IMHO opinion it would be more reasonable to map this mode to a plain non-locking mode, in Unix environment.
I based the implementation on the Delphi for Windows behaviour, where it does result in taking an exclusive lock. It seems that on Linux (Kylix) they did map it to fmShareDenyNone though: https://groups.google.com/forum/?fromgroups=#!topic/borland.public.delphi.language.delphi.general/edJN6SobJP8
I'm personally not a big fan of having different behaviour across platforms when it can be avoided without too much trouble, and I doubt there's much source code around that relies on Kylix-specific behaviour. I don't know what XE2 does on Mac OS X.
More information about the fpc-pascal