Boost logo

Boost :

Subject: Re: [boost] Legal problem with Stackoverflow contribution under the "Creative Commons Attribution Share Alike 3.0" license
From: Dom (dchabaud63_at_[hidden])
Date: 2018-02-20 19:45:00


Niall,
I confirm what Karen said: the scanning software automatically flagged your
contribution. As Karen explained such software are able to flag using
different techniques, one is code signature comparison with a database of
code signatures which they explained me is automatically enriched by web
repositories and forums scanning. I do not have the information how your
contribution has been flagged.
And for the things to be clear this is not the legal department of my
company which said it's a problem, this is an independent lawyer office,
different than the external company which made the scan.

I do not agree with your approach to check the IP of a function piece by
piece and saying as each piece is not covered by IP, the assembly of all
pieces is also not covered by IP. If you compare to a patented hardware for
example, it is probable that each individual piece is not covered by any IP
or patent, but the assembly of all pieces make something original and
provide a new feature which can be patented.

What lawyers explained me is that there is a risk, when there is a risk the
decision could be lawyers against lawyers, and companies do not like such
risks.

I will now stop this discussion, my company found a solution for delivering
our software products without this polluting contribution. I am sure Boost
contributors or Steering Committee will make the good decision.

Dominique

-----Original Message-----
From: Boost [mailto:boost-bounces_at_[hidden]] On Behalf Of Niall
Douglas via Boost
Sent: mardi 20 février 2018 20:07
To: Boost Developers List
Cc: Niall Douglas; Boost Steering Committee
Subject: Re: [boost] Legal problem with Stackoverflow contribution under the
"Creative Commons Attribution Share Alike 3.0" license

>> Let me repeat: the only reason that my use of SO code snippets was
>> noticed is because I added a comment linking back to the original.
>
> Current generation software designed to find copyright and IP code
> infringement in source code do not need the author to put notices in
> the source code. They can even find instances of infringement where
> the author deliberately acted to obscure the infringement, by, for
> example, changing variables or hiding critical code in small functions or
macros or etc.

I am more familiar with this than most. You can rewrite code into a
different programming language and it may still infringe. Simply rewriting a
routine will not make infringement magically disappear, despite most
programmers thinking this to be the case that if it isn't exactly the same,
it's not infringing.

But in any case all this is moot. No copyright is being infringed in any
case due to the AFC test, which for the record I applied before choosing to
reuse this snippet, as I do for all snippets I reuse from StackOverflow.
This eliminates problems with IP ownership, which is why I do it.

I am not incompetent at my job or as a software engineer. I do not make
choices on IP in ignorance or laziness. Unlike most engineers, I actively
read case law as a hobby. In a different life I would have entered law. I
know what I am talking about, and I would have wished to have been trusted
on my opinion on this.

But okay, let's take the long road on this, as my expert opinion clearly
carries zero weight here.

> You obviously didn't act to obscure anything. But Dominique has said
> such software has flagged the code. Enough said. The rational path is
> to just rewrite the code and move on. Honest mistakes happen in code all
the time.

No, he said that his legal team flagged it. And that's because it has a
source attributing comment. Had I not commented on its source, nothing would
have been flagged by his legal team. Like all the other stackoverflow reuse,
it would have slipped by without comment.

Here is the "problem" routine in full:

```
ULONGLONG MyTickCount64(void)
{
    static volatile DWORD count = 0xFFFFFFFF;
    DWORD previous_count, current_tick32, previous_count_zone,
current_tick32_zone;
    ULONGLONG current_tick64;

    previous_count = InterlockedCompareExchange(&count, 0, 0);
    current_tick32 = GetTickCount();

    if (previous_count == 0xFFFFFFFF)
    {
        // count has never been written
        DWORD initial_count;
        initial_count = current_tick32 >> 28;
        previous_count = InterlockedCompareExchange(&count,
initial_count, 0xFFFFFFFF);

        current_tick64 = initial_count;
        current_tick64 <<= 28;
        current_tick64 += current_tick32 & 0x0FFFFFFF;
        return current_tick64;
    }

    previous_count_zone = previous_count & 15;
    current_tick32_zone = current_tick32 >> 28;

    if (current_tick32_zone == previous_count_zone)
    {
        // The top four bits of the 32-bit tick count haven't changed since
count was last written.
        current_tick64 = previous_count;
        current_tick64 <<= 28;
        current_tick64 += current_tick32 & 0x0FFFFFFF;
        return current_tick64;
    }

    if (current_tick32_zone == previous_count_zone + 1 ||
(current_tick32_zone == 0 && previous_count_zone == 15))
    {
        // The top four bits of the 32-bit tick count have been incremented
since count was last written.
        InterlockedCompareExchange(&count, previous_count + 1,
previous_count);
        current_tick64 = previous_count + 1;
        current_tick64 <<= 28;
        current_tick64 += current_tick32 & 0x0FFFFFFF;
        return current_tick64;
    }

    // Oops, we weren't called often enough, we're stuck
    return 0xFFFFFFFF;
}
```

Let's apply
https://en.wikipedia.org/wiki/Abstraction-Filtration-Comparison_test, so
stage 1 is Abstraction into individual operations which is what copyright is
actually on, not the specific textual form as most programmer think:

1. Persist a count variable across calls of the function.

2. If count is not initialised, store the top four bits of the 32 bit count,
and exit.

3. Are the top four bits of the 32 bit count same as last time we were
called? If so, exit.

4. Update the persisted count variable with the new top four bits of the
32 bit count, and adjust the value returned to account for the 32 bit wrap
so it is accurate.

5. If the top four bits overflowed since the last time we were called,
return a failure.

Now apply the Filtration stage where we remove (i) elements dictated by
efficiency, (ii) elements dictated by external factors, and (iii) elements
taken from the public domain:

1. This is standard programming, and so in the public domain. Remove.

2. The call to fetch the 32 bit count and use of atomics is dictated by
external factors. Remove. The only remaining item is the choice of top four
bits.

3. All standard programming. Remove.

4. All standard programming and external factors. Remove.

5. Returning from a function is standard programming. Remove. That leaves
those top four bits again.

The final part of Filtration stage is whether the choice of four bits is an
element dictated by efficiency. Two bits wouldn't allow detection of
overflow. Six bits is overkill and detracts from efficiency. So we can
remove the choice of four bits.

Finally we move onto the Comparison stage: compare what is remaining after
the previous two stages to see if copyright has been infringed.
Except, as I just proved, **there is nothing remaining**. So therefore
copyright cannot have been infringed by the AFC legal test. The routine is
not different from what any skilled programmer would have written if
implementing the same thing. Therefore no copyright applies. This use is
fair use under US law, de minimis under other jurisdictions.

*Every programmer* should be applying the AFC test to any code they study if
they are replicating any of its behaviour. Otherwise they may quite easily
infringe on copyright. Simply rewriting a routine does not help. Using a
different programming language does not help. Replacing one routine with
another which does the exact same thing does not help.

I stand by my claim that no copyright violation has occurred here. There is
nothing to hold copyright upon. I look forward to seeing what the SFC
lawyers say regarding this specific instance (feel free to send them a copy
of the above discussion).

Niall

--
ned Productions Limited Consulting
http://www.nedproductions.biz/ http://ie.linkedin.com/in/nialldouglas/
_______________________________________________
Unsubscribe & other changes:
http://lists.boost.org/mailman/listinfo.cgi/boost

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk