Skip to content

Add reuse-lintable copyright and license notices to all files#349

Open
jafingerhut wants to merge 4 commits into
p4lang:mainfrom
jafingerhut:add-copyright-license-annotations
Open

Add reuse-lintable copyright and license notices to all files#349
jafingerhut wants to merge 4 commits into
p4lang:mainfrom
jafingerhut:add-copyright-license-annotations

Conversation

@jafingerhut
Copy link
Copy Markdown

No description provided.

Signed-off-by: Andy Fingerhut <andy_fingerhut@alum.wustl.edu>
@jafingerhut
Copy link
Copy Markdown
Author

Hopefully CI will catch it if I used the wrong comment style for the .td and .mlir source files, but please spot-check one or two of those especially to see if they look good to you.

I have used "The P4 Language Consortium" as the copyright holder for all files in this PR, as suggested by fruffy in this issue: #344

If you prefer to have you as an individual, or the company you were working for, as the copyright holder on files that you created, let me know which ones, and who you want the copyright holder to be. None of what I am doing here will change the git commit log of this repo, so you still get credit there for code you wrote, if that is important to you.

I have used the year that the file was first added to this repository as the copyright notice year.

@fruffy fruffy requested a review from asl May 12, 2026 20:04
Copy link
Copy Markdown
Collaborator

@fruffy fruffy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's give this a couple of days to give @asl a chance to respond.

@asl
Copy link
Copy Markdown
Collaborator

asl commented May 12, 2026

@jafingerhut I'm seeing that different files use different years: 2024 vs 2025. Is this expected? Also, since all headers (*.h) are really C++ headers, it would make sense to use C++ comments there for uniformity...

Also, do we really want to throw licensing headers to all test files? This is not something I've seen elsewhere and what I expected.

@jafingerhut
Copy link
Copy Markdown
Author

The year used for every file is the year that the file was first added to this repository. Those range from 2024 to 2026, for different files.

@jafingerhut
Copy link
Copy Markdown
Author

I had a shift of perspective a few weeks ago regarding test files, when Steffen Smolka said that in a week or two of work using an AI coding assistant, he generated a replacement for the BMv2 software switch.

Part of the reason he could do this so quickly is that he had a large human-generated set of tests that he told the AI agent that the new program must pass. That gave it a seriously big set of guardrails to fit within, and prevented it from making up all kinds of stuff that it might otherwise have done. Also it had human-written fairly precise specification documents to give it.

So tests that have been thought about, written by, and reviewed by careful people are extremely valuable commodities. Tests written by AI tools I don't trust to be worth anything, at least not yet.

Also, the REUSE tools requires every file in a repository that it checks to have a copyright and license. We can choose a license other than Apache-2.0, but I don't see any compelling reason to pick something else.

Signed-off-by: Andy Fingerhut <andy_fingerhut@alum.wustl.edu>
…erhut/p4mlir-incubator into add-copyright-license-annotations
@jafingerhut
Copy link
Copy Markdown
Author

As of commit 4, I believe I have updated the comment style for all files with a file name suffix of ".h" to C++ style "//" comments

@asl
Copy link
Copy Markdown
Collaborator

asl commented May 12, 2026

@jafingerhut Thanks! For my understanding: are we expecting to run some pre-commit check to ensure all copyright headers are correct?

@jafingerhut
Copy link
Copy Markdown
Author

jafingerhut commented May 12, 2026

@jafingerhut Thanks! For my understanding: are we expecting to run some pre-commit check to ensure all copyright headers are correct?

Yes, for the following definition of "correct", which there is an open source tool called REUSE [1] that exists and I have set it up as a pre-commit check on other p4lang projects in the past few weeks. It checks that:

(1) every file has a copyright notice with proper syntax and elements included (year, a copyright holder)

(2) Every file has an SPDX-License-Identifier line with a license identifier that is one in the top-level LICENSES directory of the project. This will be only Apache-2.0 for this project, but there are some non-Apache-2.0 files in other p4lang projects (e.g. copied from third-party libraries that are licensed MIT or BSD, mostly).

What it cannot check automatically is whether the copyright holder is legally valid or correct for that source file, or that you haven't lied to it and told it has license X when legally it should have license Y. There are tools that can help you discover whether a file was copied from some other public source, but we haven't arranged to use one of those yet, and seems unlikely we will do so soon.

[1] https://pypi.org/project/reuse/

@jafingerhut
Copy link
Copy Markdown
Author

@asl There is absolutely no rush on this, but feel free to approve and merge if you think these changes are reasonable, or to ask more questions if you think of any.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants