[Interest] Is it a LGPLv3 infringement to copy paste qFuzzyCompare implementation

Ch'Gans chgans at gna.org
Fri Jul 22 11:41:59 CEST 2016


On 22 July 2016 at 20:25, Jean-Michaël Celerier
<jeanmichael.celerier at gmail.com> wrote:
>> I was pointed out that there's a potential LGPLv3 license
> infringement, although I understand where the FUD is coming from, I
> think that it is OK to read LGPLv3 source code to get inspired as long
> as you don't blindly copy/paste code (In my case i checked out quite a
> few articles and forum threads before choosing the Qt way as the best
> way to do it for my application).
>
> There is no infrigement, you can even use directly qFuzzyCompare in your
> proprietary code :
> From the LGPLv3.0
>
> The object code form of an Application may incorporate material from a
> header file that is part of the Library. You may convey such object code
> under terms of your choice, provided that, if the incorporated material is
> not limited to numerical parameters, data structure layouts and accessors,
> or small macros, inline functions and templates (ten or fewer lines in
> length), you do both of the following:
>
> a) Give prominent notice with each copy of the object code that the Library
> is used in it and that the Library and its use are covered by this License.
> b) Accompany the object code with a copy of the GNU GPL and this license
> document.

Interesting excerpt indeed. So you can use small inlines and templates
of a LGPLv3 header file "under terms of your choice"! What a surprise!
This is quite liberal for a so-called "viral" license.
I'm using "viral" here because this is quite often the term used to
spread FUD, I have personally always liked GNU licenses and have great
respect toward all the people behind them.

Thanks a lot for pointing that out.

Chris

>
> qFuzzyCompare clearly is in the "inline function ten or fewer lines in
> length" case so you can use it without problems and without even requiring
> to "give prominent notice".
>
> Best
>
> Jean-Michaël
>
>
> On Fri, Jul 22, 2016 at 10:10 AM, Benjamin TERRIER <b.terrier at gmail.com>
> wrote:
>>
>> Hi,
>>
>> My personal experience is that it will depend on the countries in
>> which you develop
>> and distribute your software.
>>
>> In France for instance software are protected by "author's rights" which
>> implies
>> that to be protected a piece of code must have some kind of creativity
>> and/or
>> originality. So my guess would be that according to French laws
>> qFuzzyCompare
>> cannot be protected and thus can be copy-pasted without infringing
>> neither the law
>> nor the LGPL.
>> Note that this is only a guess as only judges can rule if a piece of
>> code is original
>> enough to be protected.
>>
>> If you want to be sure your best move is to contact the FSF or a
>> lawyer specializing in copyright.
>>
>> BR,
>>
>> Benjamin
>>
>> 2016-07-22 5:00 GMT+02:00 Ch'Gans <chgans at gna.org>:
>> > Hi there,
>> >
>> > I've recently added a "bool FuzzyCompare(float f1, float f2)" function
>> > to a proprietary software I'm currently paid to work on (this is plain
>> > C++ project, it doesn't use the Qt framework at all).
>> > Being a more-than-happy Qt user in my spare time I decided that I
>> > would first checkout the qFuzzyCompare implementation since I consider
>> > Qt developers as top-of-the-notch C++ wizards (no kidding and no
>> > attempt to be nice with them).
>> >
>> > I have added a comment to "my" implementation referring to the
>> > implementation of "qFuzzyCompare" in Qt5 source code (along with [1]).
>> > The 2 implementations look alike indeed (apart from using std::fabsf,
>> > std::min, etc.. in place of qAbs, qMin, ...), since the fuzzy compare
>> > is a well-known algorithm.
>> > My reference to Qt5 was there to justify the use of the "magic
>> > constant" 100000.f.
>> >
>> > I was pointed out that there's a potential LGPLv3 license
>> > infringement, although I understand where the FUD is coming from, I
>> > think that it is OK to read LGPLv3 source code to get inspired as long
>> > as you don't blindly copy/paste code (In my case i checked out quite a
>> > few articles and forum threads before choosing the Qt way as the best
>> > way to do it for my application).
>> >
>> > So my question is actually very serious, in this particular case,
>> > would this be considered as a LGPLv3 infringement of Qt5 to add this
>> > to a piece of proprietary software:
>> >    // Taken from Qt5 source code, see
>> > http://doc.qt.io/qt-5/qtglobal.html#qFuzzyCompare-1 and
>> >     //
>> > https://code.woboq.org/qt5/qtbase/src/corelib/global/qglobal.h.html#_ZL13qFuzzyCompareff
>> >     // And for the insomniacs:
>> >
>> > https://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/
>> >     bool FuzzyCompare(float f1, float f2)
>> >     {
>> >         return (::fabsf(f1 - f2) * 100000.0f <= std::min(::fabsf(f1),
>> > ::fabsf(f2)));
>> >     }
>> >
>> > For comparison purpose, here is the Qt source code:
>> > Q_DECL_CONSTEXPR static inline bool qFuzzyCompare(float p1, float p2)
>> > {
>> >   return (qAbs(p1 - p2) * 100000.f <= qMin(qAbs(p1), qAbs(p2)));
>> > }
>> >
>> > You can find many more implementations of this algorithm on
>> > stack-overflow and other forums.
>> >
>> > At the end, I proposed to change the comments to refer to wikipedia
>> > instead of Qt5 source code and saying that 100000.0f is the right
>> > value for epsilon.
>> >
>> > I know this is a drop in an ocean (we're talking 1 line of C++), but i
>> > think the question is indeed interesting. Thanks for shedding light on
>> > this particular issue.
>> >
>> > Chris
>> >
>> >
>> > [1]
>> > https://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/
>> > _______________________________________________
>> > Interest mailing list
>> > Interest at qt-project.org
>> > http://lists.qt-project.org/mailman/listinfo/interest
>> _______________________________________________
>> Interest mailing list
>> Interest at qt-project.org
>> http://lists.qt-project.org/mailman/listinfo/interest
>
>



More information about the Interest mailing list