| DFSG-AUTHOR-CHECK(1) | User Commands | DFSG-AUTHOR-CHECK(1) |
NAME¶
dfsg-author-check - find copyright holders missing from debian/copyright
SYNOPSIS¶
dfsg-author-check [-all] [-q]
[-json|-dep5|-markdown] [-max-files n]
[-copyright-file file]... [-author-file file]...
[directory]
dfsg-author-check -help
DESCRIPTION¶
dfsg-author-check reads the copyright notices in the files of an unpacked Debian source package and reports every copyright holder that the package's debian/copyright does not name.
directory is the top of the unpacked source tree, the directory that contains debian/. The default is the current directory.
Each holder found in the tree is put into one of four groups:
- missing
- No holder declared in debian/copyright matches it.
- possible
- No declared holder matches it, but it resembles one, so it may be the same holder under another spelling. The report shows the declared names it resembles.
- known
- A declared holder matches it.
- ignored
- It is not known, and it was found only in files that debian/copyright-scan-patterns.yml excludes.
The default report lists the missing, possible and ignored holders, each with the files and line numbers where it was found, followed by a one-line result and by suggested Files paragraphs for debian/copyright (see SUGGESTED PARAGRAPHS). Only missing holders change the exit status.
The check works from the text of copyright notices and can be wrong in both directions. It is an aid to reviewing debian/copyright, not a replacement for reading the source.
OPTIONS¶
Options begin with one dash; two are accepted as well.
- -all
- Also list the known holders and where each was found. This has no effect with -dep5; with -json the known holders are always included.
- Treat the holders listed in file as declared. The file has one holder on each line; leading years are allowed and ignored, as are empty lines and lines that begin with #. May be given more than once.
- -copyright-file file
- Treat the holders named in the copyright notices of file as declared. The file is read for notices in the same way as a file of the package (see Copyright notices), so each holder must appear in a notice such as “Copyright 2020 A. Name”; it is not parsed as a debian/copyright file. May be given more than once.
- -dep5
- Print only the suggested Files paragraphs. Nothing is printed when no holder is missing.
- -h, -help
- Print a summary of the options and exit with status 0.
- -json
- Print the whole result as a JSON object (see JSON OUTPUT).
- -markdown
- Print the report as Markdown, suitable for pasting into a review note.
- -max-files n
- List at most n locations for each holder, followed by a count of the rest. The default is 5; 0 lists them all. This has no effect with -json or -dep5.
- -q, -quiet
- Print nothing when there are no missing and no possible holders. Ignored holders alone do not cause any output. Warnings are still printed. This option cannot be combined with -all or -json.
At most one of -json, -dep5 and -markdown may be given.
HOW THE CHECK WORKS¶
Declared holders¶
The declared holders are taken from the Copyright fields of debian/copyright and of every debian/package.copyright file. A debian/copyright that is not in the machine-readable format has no such fields, so it declares no holders and every holder found is reported as missing. The -copyright-file and -author-file options add to the declared holders.
Files that are read¶
Every regular file below directory is read, except:
- the top-level debian directory (but see Files created by patches);
- any directory named upstream inside a directory named debian;
- directories named .git, .svn, .hg, .bzr, CVS, .pc, .tox, __pycache__, .pytest_cache, .cache, .idea, .vscode or LICENSES;
- files whose name begins with .git, such as .gitignore;
- symbolic links and other things that are not regular files;
- binary files, taken to be those with a NUL byte in their first 512 bytes. UTF-16 text that begins with a byte order mark is decoded and read.
Only the first 2 MiB of a file are read. Directories such as vendor, node_modules and build are not skipped: code bundled there is part of the source package and its holders belong in debian/copyright.
Copyright notices¶
A line is taken as a copyright notice when it has one of these forms:
- the word “Copyright” followed by a holder, where the line also gives a year or says “by” before the name, as in “Copyright (C) 2019 A. Name” or “Copyright by A. Name”;
- “SPDX-FileCopyrightText:” followed by a holder;
- “(c)”, “©” or “©” followed directly by a four-digit year and a holder.
A notice that is wrapped onto the next line of the same comment is read as one notice. A line that gives several holders, each after its own years, yields each of them.
The holder is what remains after removing the years, comment markers and trailing text such as “All rights reserved” or the start of a licence grant. Lines that are licence wording rather than a notice (for example “the copyright holder”) and template placeholders (for example “<year>” or “<name>”) are discarded. In PostScript, PDF and SVG files, the notice of the program that generated the file (a Creator line) is discarded too.
Licence files¶
A licence text carries the copyright notice of the licence's own author: every copy of the GPL names the Free Software Foundation. That author is not a copyright holder of the package, so notices that name the Free Software Foundation, the Perl Foundation, or “The Linux Foundation and its contributors” are discarded when they are found in a licence file. All other notices in a licence file are read as usual.
A licence file is a file whose name begins, in any letter case, with COPYING, LICENSE, LICENCE, COPYRIGHT or NOTICE, optionally after a “third party” prefix (as in ThirdPartyNotices.txt), or any file below a directory named license, licenses, licence or licences.
Matching names¶
A holder found in the tree is known when it matches a declared holder. Matching ignores letter case, punctuation, accents, character encoding damage, e-mail addresses and common abbreviations (such as “Corp” for “Corporation”), and recognises an organisation's acronym. A notice that lists several names, as in “A. Name, B. Name and C. Name”, is known when every one of them is declared.
A holder that is not known is possible, rather than missing, when:
- it contains the whole of a declared name along with other words;
- it shares a distinctive word, such as a surname, with a declared name; or
- it differs from a declared name by a likely spelling mistake.
REUSE.toml¶
A REUSE.toml file (REUSE specification 3.2), at any depth of the tree, states the copyright of other files. For each of its [[annotations]] tables, the holders in SPDX-FileCopyrightText are attributed to the files in the tree that match path. A path is relative to the directory of the REUSE.toml; * matches within one directory and ** matches across directories.
The report shows such a holder at the line of REUSE.toml that names it, followed by the files it was attributed to:
REUSE.toml:12, for:
icons/open.png
icons/save.png
The following rules apply:
- With precedence = "closest", which is the default, an annotation is not applied to a file that contains a copyright notice of its own.
- With any other precedence the annotation is applied to every matching file. Notices inside the files are still read and reported, including under override.
- An annotation that matches no file in the tree adds no holder. This is the usual case when the files were removed by repacking (Files-Excluded).
- Copyright notices in the comments of REUSE.toml are read as notices of that file itself.
- A REUSE.toml that cannot be parsed, or is larger than 2 MiB, produces a warning and is read as an ordinary text file.
Files created by patches¶
In a package whose debian/source/format is 3.0 (quilt), the patches listed in the series file are read to find the files that they create, that is, the files whose old name in the patch is /dev/null. The series file is debian/patches/debian.series if it exists and debian/patches/series otherwise. Patches are read as patch -p1 would apply them.
A copyright notice in the lines that a patch adds to a file it creates is reported at the line of the patch, together with the name of the created file:
debian/patches/add-cmake.patch:14 (creates cmake/FindFoo.cmake)
This gives the same report whether or not the patches have been applied to the tree. When they have been applied, the created file is also in the tree, and a notice found both there and in the patch is reported once, at the patch. A notice that is in the tree's copy of the file but not in the patch is reported at the file.
Created files are not read from a patch when they would not be read in the tree either: those below debian/ or in a skipped directory. A created REUSE.toml is not read from the patch.
Only files that a patch creates are handled this way. A notice that a patch adds to an existing upstream file is found only if the patches have been applied to the tree.
Excluded files¶
debian/copyright-scan-patterns.yml is the file in which a maintainer tells cme(1) which files to leave out of its copyright scan. dfsg-author-check honours its ignore section (see FILES). A typical use is a third-party notices file that upstream still ships although the code it describes was removed when the source was repacked: the holders it names have no code in the package.
Excluded files are still read, but a holder that is found only in excluded files and is not known is put in the ignored group. Ignored holders are listed in a separate section of the report, do not change the exit status, and get no suggested paragraph. A holder that is also found in files that are not excluded is reported as missing or possible, with those files only. A file that a patch creates is excluded by its own path, not by the path of the patch.
SUGGESTED PARAGRAPHS¶
When holders are missing, the report ends with Files paragraphs that can be appended to debian/copyright. -dep5 prints these paragraphs and nothing else.
The files in which a missing holder was found are grouped by the existing Files paragraph of debian/copyright that applies to them, which is the last one whose patterns match. One paragraph is suggested for each group. It contains:
- Files
- Each file of the group that contains a missing holder, one on a line. A holder that comes from REUSE.toml is listed with the files it was attributed to, and a holder found in a file that a patch creates is listed with the patch, for example debian/patches/add-cmake.patch.
- Copyright
- Every holder found in those files, not just the missing ones, each with the years given in its notices.
- License
- The first line of the License field of the existing paragraph, or UNKNOWN if no paragraph applies to the files.
In debian/copyright the last paragraph that matches a file is the one that applies to it, so a paragraph appended at the end replaces the existing paragraph for the files it lists. That is why it repeats the holders that are already declared.
The paragraphs are a starting point and need to be checked before use:
- The License is copied from the existing paragraph, not determined from the files.
- The Copyright field lists only holders that the check recognised. A holder that a file mentions only in running text, or in a notice of a form described above as discarded, is absent.
- The years are those given in the files. Years that the existing paragraph gives for a holder are not carried over.
JSON OUTPUT¶
-json prints one object with these members:
- copyright_files
- The files the declared holders were read from.
- declared
- The declared holders.
- files_scanned
- The number of files read as text.
- files_cut
- How many of those were larger than 2 MiB and read only in part.
- missing, possible, known, ignored
- The holders in each group. Each is an object with holder (the name) and files (every location, as path:line), and where they apply might_be (the declared names it resembles), covers (for a location in a REUSE.toml, the files the holder was attributed to) and creates (for a location in a patch, the file the patch creates).
- ignore_file
- debian/copyright-scan-patterns.yml when it excludes some files; otherwise absent.
- warnings
- The warnings, when there are any. With -json they are not printed to standard error.
- stanzas
- The suggested paragraphs, each with files, copyright and license.
EXIT STATUS¶
- 0
- No holder is missing. There may still be possible or ignored holders.
- 1
- At least one holder is missing.
- 2
- The check could not be made: the options were wrong, the package has no debian/copyright or debian/package.copyright file, or a file named with -copyright-file or -author-file could not be read.
FILES¶
All of these are relative to directory.
- debian/copyright
- debian/package.copyright
- The declared holders, and the Files paragraphs used for the suggested paragraphs. At least one must exist. One that is larger than 64 MiB is an error.
- debian/source/format
- Patches are read only when this contains 3.0 (quilt).
- debian/patches/debian.series
- debian/patches/series
- The list of patches to read. At most 2000 patches, 64 MiB of patches in total and 5000 created files are read. Reaching a limit produces a warning and the rest are not read.
- debian/copyright-scan-patterns.yml
- The files to exclude. Only the ignore section is used:
ignore:
suffixes:
- png
pattern:
- ^\./build/monaco/ThirdPartyNotices\.txt$
Each entry of suffixes excludes the files whose names end in a dot followed by that entry. Each entry of pattern is a regular expression that is matched against the path of a file written as ./path from the top of the tree. It is not anchored, so /test/ excludes every file below any directory named test.
cme(1) reads the patterns as Perl regular expressions, while this program uses Go's syntax (see https://pkg.go.dev/regexp/syntax), which lacks look-around assertions and backreferences. A pattern that Go does not accept produces a warning and is not used. If the ignore section cannot be parsed, a warning is printed and no file is excluded. The lists may be written one entry to a line, as above, or as [a, b].
- REUSE.toml
- Read wherever it appears in the tree; see REUSE.toml.
DIAGNOSTICS¶
Warnings are written to standard error, one on a line. They report parts of the package that could not be used as intended: a REUSE.toml that could not be parsed, an unusable debian/copyright-scan-patterns.yml or pattern, or a limit reached while reading patches. A warning does not change the exit status.
EXAMPLES¶
Check the package in the current directory:
$ cd hello-2.10 $ dfsg-author-check Author check: hello-2.10 Scanned 3 files. Authors declared in debian/copyright: 2 Not named in debian/copyright (1):
Bruno Example
src/quote.c:1 Possibly named in debian/copyright under a similar name (1):
Free Software Fundation (might be "Free Software Foundation, Inc")
src/x.mk:1 Result: 1 holder not named in debian/copyright, and 1 possibly named under a similar name To name them, add to the end of debian/copyright (see -help): Files: src/quote.c Copyright: 2003, 2005 Bruno Example
2014 Free Software Foundation, Inc License: GPL-3+
(The Result line is wrapped here; the program prints it on one line.)
Check a package in another directory and list every location of each holder:
dfsg-author-check -max-files 0 path/to/hello-2.10
Append the suggested paragraphs to debian/copyright for editing:
dfsg-author-check -dep5 >> debian/copyright
Accept holders that are documented somewhere other than debian/copyright:
dfsg-author-check -author-file ../known-holders.txt
Use in a script, staying silent when there is nothing to report:
dfsg-author-check -q || echo "debian/copyright is incomplete"
SECURITY¶
The package is treated as untrusted input. The program only reads it: it runs nothing from it, does not read through symbolic links in the tree, and reads the files below debian/ only when they resolve to a location inside the package. In the text and Markdown reports, control characters and bidirectional formatting characters in text taken from the package are replaced by “?”.
When untrusted packages are checked automatically, the program should nevertheless be run in a sandbox.
SEE ALSO¶
cme(1), dpkg-source(1), Dpkg::Copyright::Scanner(3pm)
AUTHOR¶
Andrew McMillan <andrew@mcmillan.net.nz>
| November 2026 | dfsg-author-check |