[fpc-pascal] Notice: Possible copyright infringements in FPC code base

Michael Van Canneyt michael.vancanneyt at wisa.be
Mon Nov 19 10:38:11 CET 2007


The FPC team has been recently made aware that a number of routines in the
Classes unit are apparently based on code originally from Borland/CodeGear.
After someone found a tool to automatically compare source code bodies to look
for structural similarities, we improved its support for Object Pascal (it's in
svn now) and used it to compare all FPC RTL and FCL units with their Kylix 3
and Delphi 7 equivalents (in so far these exist).

This enabled us to find more cases where code may have originally come from or
be based on Delphi/Kylix code. All such identified routines of sufficient
complexity and/or likeliness have been or are in the process of being rewritten
from scratch using a clean room approach: by someone who is not intimately
familiar with the current implementation, and only based on documentation
written by other people. I am personally supervising this effort.

This whole issue highlights a quite annoying problem though: one the one hand,
it is most certainly our responsibility to ensure that all committed code can be
legally licensed under FPC's modified LGPL license, and in particular does not
originate from Delphi/Kylix sources. On the other hand, we have to avoid reading
Delphi/Kylix code as much as possible since by doing so, we may become "tainted"
ourselves and unconsciously start writing code which is based too closely on
Borland/CodeGear code.

As everyone knows, we nevertheless all try our best to avoid committing tainted
code, see e.g. the comments attached to the following bug reports:
* http://www.freepascal.org/mantis/view.php?id=7680
* http://www.freepascal.org/mantis/view.php?id=8248
* http://www.freepascal.org/mantis/view.php?id=9770

And yet, from time to time it nevertheless happens anyway:
* http://www.freepascal.org/mantis/view.php?id=8661

So this is one area where you, our users, can make a big difference and help us
in preventing this from happening in the future, as well as with notifying us as
soon as possible when it does happen (or when you know it happened in the past).
Most importantly: please ensure that you *never* submit patches based on code 
copyrighted by third parties.

Let one thing be clear, however: none of the code that you wrote yourself can be
affected by this issue, as long as this code is not based on the tainted code
(whereby "based" means "based on their source code"; it does not mean, a.o.,
deriving from a tainted class, or calling a tainted routine -- in these cases
your own code is clean). Simply recompiling your program with an untainted
version of FPC will automatically clear your programs of any taint as well.

We are in a constructive dialog with people from CodeGear over this issue, and
will report back later on the repercussions as far as current and previous FPC
releases are concerned. 

For the FPC Team,


PS: for those interested, here is the preliminary list of tainted routines we
have identified. If you are aware of more cases, please let us know as soon as
possible so we can evaluate them and put them in the queue for re-implementation!

* ExtractStrings
* TParser.TokenComponentIdent
* TParser.NextToken
* TReader.DoFixupReferences
* TReader.ReadCollection
* TReader.FindComponentClass
* TWriter.WriteComponent
* TWriter.WriteComponentData
* TWriter.WriteProperties
* TPropFixup.MakeGlobalReference
* FindNestedComponent
* GlobalFixupReferences
* GetFixupInstanceNames
* RemoveFixupReferences (RemoveFixups in Delphi),
* RedirectFixupReferences
* GetFixupInstanceNames (GetFixupReferenceNames in Delphi),
* RemoveGlobalFixup
* RemoveFixups
* TStringList.Grow
* TStringList.QuickSort
* TStringList.Find
* TCollection.GetNamePath
* TFPList.Assign (Kylix: tlist.assign)
* TFPList.Delete (Kylix: tlist.delete)
* TList.Extract

* SearchBuf
* DecodeSoundexInt

* DoVarClearArray

* MomentSkewKurtosis:

* Needs complete re-implementation (was taken from the net...)

* TDataset.SetFieldValues
* TDataset.DataEvent
* TDataSet.CalculateFields,
* TDataset.EnableControls
* TDataLink.CalcFirstRecord
* TField.RefreshLookupList
* TField.CalcLookupValue

* HandleSafeCallException

More information about the fpc-pascal mailing list