jMonkeyEngine / jmonkeyengine

A complete 3-D game development suite written in Java.
http://jmonkeyengine.org
BSD 3-Clause "New" or "Revised" License
3.75k stars 1.12k forks source link

Github License detection fails #1569

Closed MeFisto94 closed 1 year ago

MeFisto94 commented 3 years ago

A very minor issue, but when accessing https://github.com/jMonkeyEngine/jmonkeyengine/blob/master/LICENSE, github does not recognize the license type automatically.

If someone is bored to debug that, potentially we may need to change the wording by a small bit to make it fit the official regex. A quick search made me wonder if BSD-3 is even detected by github at all, but to show what I mean, have a look at this, being licensed under MIT: https://github.com/mit-license/mit-license.github.io/blob/master/LICENSE

https://docs.github.com/en/github/creating-cloning-and-archiving-repositories/creating-a-repository-on-github/licensing-a-repository#detecting-a-license on the other hand claims that BSD3 is supported. Maybe someone can experiment with the ruby gem

stephengold commented 3 years ago

Github can recognize BSD3 licenses. For instance, see

Editing the LICENSE file now might not help. I suspect that license recognition occurs when a repo is created. As evidence of this, note that my fork of JMonkeyEngine has a recognized license:

pspeed42 commented 3 years ago

I think it just needs the: BSD 3-Clause License ...line at the top.

I tried that in one of my projects and it worked.

NetzwergX commented 3 years ago

I think GitHub supports detection of SPDX License Identifiers: https://spdx.org/licenses/

MeFisto94 commented 3 years ago

Apparently I can confirm what paul said, the licenses that my projects have, that have been automatically inited by Github contain BSD 3-Clause License, one blank line and then start with the Copyright.

Currently the license is detected as "other"

stephengold commented 3 years ago

I edited the LICENSE file at 8017f3bc but so far I haven't seen evidence that Github recognizes the license.

Ali-RS commented 3 years ago

Maybe the .md extension should be added to the LICENSE file for Github to recognize it. "LICENSE.md" or "license.md"

pspeed42 commented 3 years ago

Renaming didn't seem to help. Now it's also in a weird state where I've edited the bullets to be 1., 2., etc. but if you view the raw file it still shows *. Maybe something is cached now.

Edit: if anyone wants to compare, this is my own file that I changed some time back and it worked: https://github.com/Simsilica/SimMath/blob/master/license.md ...you can see the edit in the commits.

tlf30 commented 3 years ago

The third bullet in jme's license had been customized compared to the standard bsd3. Also, bullet points do not have justified paragraphs against the bullet.

A correct version of the license is as such:

BSD 3-Clause License

Copyright (c) 2009-2021 jMonkeyEngine
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions 
are met:

1. Redistributions of source code must retain the above copyright 
   notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright 
   notice, this list of conditions and the following disclaimer in 
   the documentation and/or other materials provided with the 
   distribution.

3. Neither the name of the copyright holder nor the names of its 
   contributors may be used to endorse or promote products derived 
   from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 
OF THE POSSIBILITY OF SUCH DAMAGE.
stephengold commented 3 years ago

Renaming might break web links. Also, it was unnecessary. I have several projects where the license file has no extension (or .txt) and those licenses are detected just fine. See the list above.

The .md file extension causes Github to apply "markdown" formatting, which explains why the raw file doesn't match what's displayed.

pspeed42 commented 3 years ago

Real raw file had 1., 2., 3. The raw file when I viewed it had *'s. Github was messing up somehow.

Versus on my own project where the exact same formatting was sensible.

Easy enough to name it back, I was just trying to see what it would take to match. Once github stopped seeing my updates, I quit.

stephengold commented 3 years ago

It seems like we're all guessing here, and so far none of our guesses has paid off. I'll put the license files back the way they were.

tlf30 commented 3 years ago

@stephengold see my comment above. The jme license has custom verbiage in the third bullet that needs to be normalized for the github detection to work.

stephengold commented 3 years ago

custom verbiage in the third bullet that needs to be normalized for the github detection to work

Do you have access to Github's algorithm, or are you guessing?

Either way, it's not worth altering our license just to get it recognized by Github. As the OP said, it's a very minor issue.

tlf30 commented 3 years ago

That is the only difference (other than the copyright name at the top) when performing a diff on a working license file that github detected with the exact same name (when it was names license.txt, it has had several names over the last couple days 😄 )

stephengold commented 3 years ago

Perhaps Github only performs license detection when a repo is created...

pspeed42 commented 3 years ago

But earlier in this thread I fixed one of my repositories by simply changing the license. So if it's in the right format then it will find the type. (My own more closely matches the BSD template since it doesn't have the extraneous stuff that JME adds to its license.)

stephengold commented 3 years ago

I fixed one of my repositories by simply changing the license

I didn't realize that.

So suppose we get the LICENSE file just the way Github wants it. Are we also going change the 7,300 copies of that license that are embedded in Java source files?

NetzwergX commented 3 years ago

Do you have access to Github's algorithm, or are you guessing?

According to https://docs.github.com/en/github/creating-cloning-and-archiving-repositories/creating-a-repository-on-github/licensing-a-repository, GitHub uses https://github.com/licensee/licensee to detect the license.

It only detects the license if the Sørensen–Dice coefficient is greater than 95%.

I just tested it in a fork. If you

  1. Put the text @tlf30 posted into the license.md file and
  2. delete the license.txt or rename it to license-template.txt or something else

then the license is correctly detected.

There is two things throwing GitHub off: the custom verbiage in the 3rd bullet point, and the license.txt file.

This is what my fork shows after the changes:

image

b0n541 commented 1 year ago

Can I take this issue for Hacktoberfest?

tlf30 commented 1 year ago

I don't see why not

b0n541 commented 1 year ago

I fixed the license in my fork of this repository:

https://github.com/b0n541/jmonkeyengine/blob/master/LICENSE.md

Do you want me to also change the license block on top of all of the source files?

b0n541 commented 1 year ago

I also found out that GitHub only seems to re-detect a license if the LICENSE.md file is re-created in a repository and the source file header template file doesn't contain the string "license".

b0n541 commented 1 year ago

Pull request: https://github.com/jMonkeyEngine/jmonkeyengine/pull/1855

Sailsman63 commented 1 year ago

This issue seems to have been resolved when #1855 was merged. Ping to close?

Ali-RS commented 1 year ago

@Sailsman63 thanks for reminding