media: siano: Use the correct style for SPDX License Identifier
Subsystems (40)
PATCH 1/1 media: siano: Use the correct style for SPDX License Identifier
This patch corrects the SPDX License Identifier style in header file related to Siano Mobile Silicon Digital TV. For C header files Documentation/process/license-rules.rst mandates C-like comments (opposed to C source files where C++ style should be used)
Changes made by using a script provided by Joe Perches here:
https://lkml.org/lkml/2019/2/7/46
--- drivers/media/common/siano/smsir.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/common/siano/smsir.h +1 -1
@@ -1,5 +1,5 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ /* -* SPDX-License-Identifier: GPL-2.0+ * * Siano Mobile Silicon, Inc. * MDTV receiver kernel modules.
Signature · 1 line
2.17.1
Mauro Carvalho Chehab
maintainerEm Sat, 31 Aug 2019 20:41:51 +0530
Nishad Kamdar <[email protected]> escreveu:
Quoted 20 lines
This patch corrects the SPDX License Identifier style in header file related to Siano Mobile Silicon Digital TV. For C header files
Documentation/process/license-rules.rstmandates C-like comments (opposed to C source files where C++ style should be used)Changes made by using a script provided by Joe Perches here:
https://lkml.org/lkml/2019/2/7/46Suggested-by Joe Perches <[email protected]>Signed-off-by Nishad Kamdar <[email protected]>--- drivers/media/common/siano/smsir.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/media/common/siano/smsir.h +0
-0
drivers/media/common/siano/smsir.h line 5
Quoted 6 lines
drivers/media/common/siano/smsir.h +1
-1@@ -1,5 +1,5 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ /* -* SPDX-License-Identifier: GPL-2.0+ * * Siano Mobile Silicon, Inc. * MDTV receiver kernel modules.
What's wrong with that? The above is a perfectly fine SPDX header.
Thanks,
Mauro
Greg Kroah-Hartman
maintainerQuoted 18 lines · Mauro Carvalho Chehab
Em Sat, 31 Aug 2019 20:41:51 +0530
Nishad Kamdar <[email protected]> escreveu:Quoted 15 lines
This patch corrects the SPDX License Identifier style in header file related to Siano Mobile Silicon Digital TV. For C header files
Documentation/process/license-rules.rstmandates C-like comments (opposed to C source files where C++ style should be used)Changes made by using a script provided by Joe Perches here:
https://lkml.org/lkml/2019/2/7/46Suggested-by Joe Perches <[email protected]>Signed-off-by Nishad Kamdar <[email protected]>--- drivers/media/common/siano/smsir.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 13 lines
drivers/media/common/siano/smsir.h line 5
Quoted 11 lines
drivers/media/common/siano/smsir.h +1
-1@@ -1,5 +1,5 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ /* -* SPDX-License-Identifier: GPL-2.0+ * * Siano Mobile Silicon, Inc. * MDTV receiver kernel modules. What's wrong with that? The above is a perfectly fine SPDX header.
It is not the first line of the file :(
Mauro Carvalho Chehab
maintainerEm Wed, 4 Sep 2019 20:36:08 +0200
Greg Kroah-Hartman <[email protected]> escreveu:
Quoted 33 lines · Mauro Carvalho Chehab
Quoted 18 lines
Em Sat, 31 Aug 2019 20:41:51 +0530
Nishad Kamdar <[email protected]> escreveu:Quoted 15 lines
This patch corrects the SPDX License Identifier style in header file related to Siano Mobile Silicon Digital TV. For C header files
Documentation/process/license-rules.rstmandates C-like comments (opposed to C source files where C++ style should be used)Changes made by using a script provided by Joe Perches here:
https://lkml.org/lkml/2019/2/7/46Suggested-by Joe Perches <[email protected]>Signed-off-by Nishad Kamdar <[email protected]>--- drivers/media/common/siano/smsir.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)Quoted 13 lines
drivers/media/common/siano/smsir.h line 5
Quoted 11 lines
drivers/media/common/siano/smsir.h +1
-1@@ -1,5 +1,5 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ /* -* SPDX-License-Identifier: GPL-2.0+ * * Siano Mobile Silicon, Inc. * MDTV receiver kernel modules. What's wrong with that? The above is a perfectly fine SPDX header.
Quoted 2 lines
It is not the first line of the file :(
A requirement for having it at the first line is not realistic. I'd say more: some script that would check for SPDX only at the first line won't work.
The reason is simple: we have some scripts at the Kernel tree.
Since ever, Unix shells use the first line to interpret what program will handle it, e. g.:
#! /usr/bin/perl
So, all perl/python scripts should reserve the first line for such usage.
With Python, you can't even use the second line, as it is reserved for charset encoding.
So, realistically, the SPDX header could be up to the third line of a given file.
Besides that, I vaguely remember some discussions we had, back on the days SPDX was introduced, envolving Thomas, Linus and others. My understanding for such discussions is that something like this:
/*
* SPDX-License-Identifier: GPL-2.0+
*
* some other notes about the file
*/
Would be acceptable, as the first line of the comment (with is at the beginning of the file) is the SPDX tag.
Thanks,
Mauro
Quoted 10 lines · Mauro Carvalho Chehab
With Python, you can't even use the second line, as it is reserved for charset encoding.
So, realistically, the SPDX header could be up to the third line of a given file.
Besides that, I vaguely remember some discussions we had, back on the days SPDX was introduced, envolving Thomas, Linus and others. My understanding for such discussions is that something like this:
Quoted 8 lines
/*
* SPDX-License-Identifier: GPL-2.0+
*
* some other notes about the file
*/Would be acceptable, as the first line of the comment (with is at the beginning of the file) is the SPDX tag.
Using the 2nd line of a .[ch] file does not follow the documented mechanisms.
Documentation/process/license-rules.rst-1. Placement:Documentation/process/license-rules.rst-
Documentation/process/license-rules.rst- The SPDX license identifier in kernel files shall be added at the first Documentation/process/license-rules.rst: possible line in a file which can contain a comment. For the majority Documentation/process/license-rules.rst: of files this is the first line, except for scripts which require the Documentation/process/license-rules.rst: '#!PATH_TO_INTERPRETER' in the first line. For those scripts the SPDX Documentation/process/license-rules.rst: identifier goes into the second line.
Greg Kroah-Hartman
maintainerQuoted 36 lines · Mauro Carvalho Chehab
Em Wed, 4 Sep 2019 20:36:08 +0200
Greg Kroah-Hartman <[email protected]> escreveu:Quoted 33 lines · Mauro Carvalho Chehab
Quoted 31 lines
Em Sat, 31 Aug 2019 20:41:51 +0530
Nishad Kamdar <[email protected]> escreveu:Quoted 20 lines
This patch corrects the SPDX License Identifier style in header file related to Siano Mobile Silicon Digital TV. For C header files
Documentation/process/license-rules.rstmandates C-like comments (opposed to C source files where C++ style should be used)Changes made by using a script provided by Joe Perches here:
https://lkml.org/lkml/2019/2/7/46Suggested-by Joe Perches <[email protected]>Signed-off-by Nishad Kamdar <[email protected]>--- drivers/media/common/siano/smsir.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/media/common/siano/smsir.h +0
-0drivers/media/common/siano/smsir.h line 5
Quoted 6 lines
drivers/media/common/siano/smsir.h +1
-1@@ -1,5 +1,5 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ /* -* SPDX-License-Identifier: GPL-2.0+ * * Siano Mobile Silicon, Inc. * MDTV receiver kernel modules. What's wrong with that? The above is a perfectly fine SPDX header.
Quoted 4 lines
Quoted 2 lines
It is not the first line of the file :(
A requirement for having it at the first line is not realistic.
But it is "the rule" as Joe points out.
Quoted 4 lines
I'd say more: some script that would check for SPDX only at the first line won't work.
The reason is simple: we have some scripts at the Kernel tree.
This is not a script, for those, it is fine to use the second line, again, this is documented.
This isn't new at all, been that way since December of 2017, see commit aa19a176df95 ("Documentation: Add license-rules.rst to describe how to properly identify file licenses")
thanks,
greg k-h
Mauro Carvalho Chehab
maintainerEm Thu, 5 Sep 2019 07:54:30 +0200
Greg Kroah-Hartman <[email protected]> escreveu:
Quoted 47 lines · Mauro Carvalho Chehab
Quoted 36 lines
Em Wed, 4 Sep 2019 20:36:08 +0200
Greg Kroah-Hartman <[email protected]> escreveu:Quoted 33 lines · Mauro Carvalho Chehab
Quoted 31 lines
Em Sat, 31 Aug 2019 20:41:51 +0530
Nishad Kamdar <[email protected]> escreveu:Quoted 20 lines
This patch corrects the SPDX License Identifier style in header file related to Siano Mobile Silicon Digital TV. For C header files
Documentation/process/license-rules.rstmandates C-like comments (opposed to C source files where C++ style should be used)Changes made by using a script provided by Joe Perches here:
https://lkml.org/lkml/2019/2/7/46Suggested-by Joe Perches <[email protected]>Signed-off-by Nishad Kamdar <[email protected]>--- drivers/media/common/siano/smsir.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/media/common/siano/smsir.h +0
-0drivers/media/common/siano/smsir.h line 5
Quoted 6 lines
drivers/media/common/siano/smsir.h +1
-1@@ -1,5 +1,5 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ /* -* SPDX-License-Identifier: GPL-2.0+ * * Siano Mobile Silicon, Inc. * MDTV receiver kernel modules. What's wrong with that? The above is a perfectly fine SPDX header.
Quoted 4 lines
Quoted 2 lines
It is not the first line of the file :(
A requirement for having it at the first line is not realistic.
But it is "the rule" as Joe points out.
Quoted 3 lines
I'd say more: some script that would check for SPDX only at the first line won't work.
Quoted 8 lines
Quoted 1 line
The reason is simple: we have some scripts at the Kernel tree.
This is not a script, for those, it is fine to use the second line, again, this is documented.
This isn't new at all, been that way since December of 2017, see commit
aa19a176df95("Documentation: Addlicense-rules.rstto describe how to properly identify file licenses")
It sounds that I somehow misinterpreted this. Ok, be it. I'll accept this patch and keep such rule in mind for next SPDX changes.
Anyway, with regards to script, we need to change the rules in order to allow adding SPDX for python scripts, as otherwise the addition of SPDX headers may cause regressions.
As mentioned on
https://stackoverflow.com/questions/728891/correct-way-to-define-python-source-code-encoding
Python's PEP-263 [1] dictates that an script that needs to default to UTF-8 encoding has to follow this rule:
'Python will default to ASCII as standard encoding if no other
encoding hints are given.
To define a source code encoding, a magic comment must be placed into the source files either as first or second line in the file'
And:
'More precisely, the first or second line must match the following regular expression: ^[ \t\f]*#.*?coding[:=][ \t]*([-_.a-zA-Z0-9]+)'
[1] https://www.python.org/dev/peps/pep-0263/
If a script has both shebang and the charset encoding line, we can't place a SPDX tag without either violating license-rules.rst or breaking the script by making it crash with non-ASCII characters.
I'll submit a separate patch in order to address such issue at license-rules.txt.
Thanks,
Mauro
PATCH 1/1 docs: license-rules.txt: cover SPDX headers on Python scripts
The author of the license-rules.rst file wanted to be very restrict with regards to the location of the SPDX header. It says that the SPDX header "shall be added at the first possible line in a file which can contain a comment". Not happy with this already restrictive requiement, it goes further:
"For the majority of files this is the first line, except for scripts", opening an exception to have the SPDX header at the second line, if the first line starts with "#!".
Well, it turns that this is too restrictive for Python scripts, and may cause regressions if this would be enforced.
As mentioned on:
https://stackoverflow.com/questions/728891/correct-way-to-define-python-source-code-encoding
Python's PEP-263 [1] dictates that an script that needs to default to UTF-8 encoding has to follow this rule:
'Python will default to ASCII as standard encoding if no other
encoding hints are given.
To define a source code encoding, a magic comment must be placed into the source files either as first or second line in the file'
And:
'More precisely, the first or second line must match the following regular expression: ^[ \t\f]*#.*?coding[:=][ \t]*([-_.a-zA-Z0-9]+)'
[1] https://www.python.org/dev/peps/pep-0263/
If a script has both "#!" and the charset encoding line, we can't place a SPDX tag without either violating license-rules.rst or breaking the script by making it crash with non-ASCII characters.
So, add a sort notice saying that, for Python scripts, the SPDX header may be up to the third line, in order to cover the case where both "#!" and "# .*coding.*UTF-8" lines are found.
--- Documentation/process/license-rules.rst | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
Documentation/process/license-rules.rst +5 -2
@@ -64,9 +64,12 @@ License identifier syntax possible line in a file which can contain a comment. For the majority of files this is the first line, except for scripts which require the '#!PATH_TO_INTERPRETER' in the first line. For those scripts the SPDX - identifier goes into the second line. + identifier goes into the second line\ [1]_. -| +.. [1] Please notice that Python scripts may also need an encoding rule + as defined on PEP-263, which should be defined either at the first + or the second line. So, for such scripts, the SPDX identifier may + go up to the third line. 2. Style:
Signature · 1 line
2.21.0
Greg Kroah-Hartman
maintainerRe: [PATCH] docs: license-rules.txt: cover SPDX headers on Python scripts
Quoted 55 lines · Mauro Carvalho Chehab
The author of the
license-rules.rstfile wanted to be very restrict with regards to the location of the SPDX header. It says that the SPDX header "shall be added at the first possible line in a file which can contain a comment". Not happy with this already restrictive requiement, it goes further:"For the majority of files this is the first line, except for scripts", opening an exception to have the SPDX header at the second line, if the first line starts with "#!".
Well, it turns that this is too restrictive for Python scripts, and may cause regressions if this would be enforced.
As mentioned on:
https://stackoverflow.com/questions/728891/correct-way-to-define-python-source-code-encodingPython's PEP-263 [1] dictates that an script that needs to default to UTF-8 encoding has to follow this rule:
'Python will default to ASCII as standard encoding if no other
encoding hints are given.To define a source code encoding, a magic comment must be placed into the source files either as first or second line in the file'
And:
'More precisely, the first or second line must match the following regular expression: ^[ \t\f]*#.*?coding[:=][ \t]*([-_.a-zA-Z0-9]+)'[1] https://www.python.org/dev/peps/pep-0263/
If a script has both "#!" and the charset encoding line, we can't place a SPDX tag without either violating
license-rules.rstor breaking the script by making it crash with non-ASCII characters.So, add a sort notice saying that, for Python scripts, the SPDX header may be up to the third line, in order to cover the case where both "#!" and "# .*coding.*UTF-8" lines are found.
Signed-off-by Mauro Carvalho Chehab <[email protected]>--- Documentation/process/license-rules.rst | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)Documentation/process/license-rules.rst +0
-1@@ -64,9 +64,12 @@ License identifier syntax possible line in a file which can contain a comment. For the majority of files this is the first line, except for scripts which require the '#!PATH_TO_INTERPRETER' in the first line. For those scripts the SPDX - identifier goes into the second line.
Documentation/process/license-rules.rst License identifier syntax · line 75
Quoted 10 lines
Documentation/process/license-rules.rst +5
-1+ identifier goes into the second line\ [1]_. -| +.. [1] Please notice that Python scripts may also need an encoding rule + as defined on PEP-263, which should be defined either at the first + or the second line. So, for such scripts, the SPDX identifier may + go up to the third line. 2. Style:
If you are going to do this, can you also fix up scripts/spdxcheck.py to properly catch this, as well as fixing up the location of the spdx tag line in the file itself?
thanks,
greg k-h
Re: [PATCH] docs: license-rules.txt: cover SPDX headers on Python scripts
Em Thu, 5 Sep 2019 11:27:03 +0200
Greg Kroah-Hartman <[email protected]> escreveu:
Quoted 64 lines · Mauro Carvalho Chehab
Quoted 63 lines
The author of the
license-rules.rstfile wanted to be very restrict with regards to the location of the SPDX header. It says that the SPDX header "shall be added at the first possible line in a file which can contain a comment". Not happy with this already restrictive requiement, it goes further:"For the majority of files this is the first line, except for scripts", opening an exception to have the SPDX header at the second line, if the first line starts with "#!".
Well, it turns that this is too restrictive for Python scripts, and may cause regressions if this would be enforced.
As mentioned on:
https://stackoverflow.com/questions/728891/correct-way-to-define-python-source-code-encodingPython's PEP-263 [1] dictates that an script that needs to default to UTF-8 encoding has to follow this rule:
'Python will default to ASCII as standard encoding if no other
encoding hints are given.To define a source code encoding, a magic comment must be placed into the source files either as first or second line in the file'
And:
'More precisely, the first or second line must match the following regular expression: ^[ \t\f]*#.*?coding[:=][ \t]*([-_.a-zA-Z0-9]+)'[1] https://www.python.org/dev/peps/pep-0263/
If a script has both "#!" and the charset encoding line, we can't place a SPDX tag without either violating
license-rules.rstor breaking the script by making it crash with non-ASCII characters.So, add a sort notice saying that, for Python scripts, the SPDX header may be up to the third line, in order to cover the case where both "#!" and "# .*coding.*UTF-8" lines are found.
Signed-off-by Mauro Carvalho Chehab <[email protected]>--- Documentation/process/license-rules.rst | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)Documentation/process/license-rules.rst +5
-2@@ -64,9 +64,12 @@ License identifier syntax possible line in a file which can contain a comment. For the majority of files this is the first line, except for scripts which require the '#!PATH_TO_INTERPRETER' in the first line. For those scripts the SPDX - identifier goes into the second line. + identifier goes into the second line\ [1]_. -| +.. [1] Please notice that Python scripts may also need an encoding rule + as defined on PEP-263, which should be defined either at the first + or the second line. So, for such scripts, the SPDX identifier may + go up to the third line.
Quoted 5 lines
Documentation/process/license-rules.rst License identifier syntax · line 75
Quoted 2 lines
Documentation/process/license-rules.rst +0
-02. Style:If you are going to do this, can you also fix up
scripts/spdxcheck.pyto properly catch this,
Hmm... it defaults to analyze the first 15 lines:
ap.add_argument('-m', '--maxlines', type=int, default=15,
help='Maximum number of lines to scan in a file. Default 15')
So, I guess it won't require any changes.
Quoted 2 lines
as well as fixing up the location of the spdx tag
line in the file itself?
Good point. I'll write a patch fixing the SPDX location at the three files where the coding location is at the wrong place.
Quoted 4 lines
thanks,
greg k-h
Thanks,
Mauro
PATCH 1/3 docs: sphinx: add SPDX header for some sphinx extensions
Those extensions are released under GPLv2, as stated at the :license: markup tag.
Add the corresponding SPDX tags for such license.
--- Documentation/sphinx/kernel_include.py | 1 + Documentation/sphinx/rstFlatTable.py | 1 + 2 files changed, 2 insertions(+)
Documentation/sphinx/kernel_include.py +1 -0
@@ -1,5 +1,6 @@ #!/usr/bin/env python3 # -*- coding: utf-8; mode: python -*- +# SPDX-License-Identifier: GPL-2.0 # pylint: disable=R0903, C0330, R0914, R0912, E0401 u"""
Documentation/sphinx/rstFlatTable.py +1 -0
@@ -1,5 +1,6 @@ #!/usr/bin/env python3 # -*- coding: utf-8; mode: python -*- +# SPDX-License-Identifier: GPL-2.0 # pylint: disable=C0330, R0903, R0912 u"""
Signature · 1 line
2.21.0
PATCH 2/3 tools: perf: fix SPDX header in the light of PEP-263
As stated at PEP-263, the coding tag should be at the first or second line. On those two scripts, the tag is at the wrong line.
It also contains a separate e-macs line to tell it to consider the file as a python one. Merge this with the encoding tag, using the same coding line that we're using on other python files.
--- tools/perf/python/tracepoint.py | 3 +-- tools/perf/python/twatch.py | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-)
tools/perf/python/tracepoint.py +1 -2
@@ -1,7 +1,6 @@ #! /usr/bin/python +# -*- coding: utf-8; mode: python -*- # SPDX-License-Identifier: GPL-2.0 -# -*- python -*- -# -*- coding: utf-8 -*- import perf
tools/perf/python/twatch.py +1 -2
@@ -1,7 +1,6 @@ #! /usr/bin/python +# -*- coding: utf-8; mode: python -*- # SPDX-License-Identifier: GPL-2.0-only -# -*- python -*- -# -*- coding: utf-8 -*- # twatch - Experimental use of the perf python interface # Copyright (C) 2011 Arnaldo Carvalho de Melo <[email protected]> #
Signature · 1 line
2.21.0
PATCH 3/3 tools: intel_pstate_tracer.py: fix SPDX header in the light of PEP-263
In reply to Mauro Carvalho ChehabAs stated at PEP-263, the coding tag should be at the first or second line. On those two scripts, the tag is at the wrong line.
Place it at the right place and use the same kind of line that we're using on other python scripts that also work fine with emacs.
--- tools/power/x86/intel_pstate_tracer/intel_pstate_tracer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/power/x86/intel_pstate_tracer/intel_pstate_tracer.py +1 -1
@@ -1,6 +1,6 @@ #!/usr/bin/python +# -*- coding: utf-8; mode: python -*- # SPDX-License-Identifier: GPL-2.0-only -# -*- coding: utf-8 -*- # """ This utility can be used to debug and tune the performance of the intel_pstate driver. This utility can be used in two ways:
Signature · 1 line
2.21.0
Re: [PATCH] docs: license-rules.txt: cover SPDX headers on Python scripts
In reply to Greg Kroah-HartmanEm Thu, 5 Sep 2019 11:27:03 +0200
Greg Kroah-Hartman <[email protected]> escreveu:
Quoted 64 lines · Mauro Carvalho Chehab
Quoted 63 lines
The author of the
license-rules.rstfile wanted to be very restrict with regards to the location of the SPDX header. It says that the SPDX header "shall be added at the first possible line in a file which can contain a comment". Not happy with this already restrictive requiement, it goes further:"For the majority of files this is the first line, except for scripts", opening an exception to have the SPDX header at the second line, if the first line starts with "#!".
Well, it turns that this is too restrictive for Python scripts, and may cause regressions if this would be enforced.
As mentioned on:
https://stackoverflow.com/questions/728891/correct-way-to-define-python-source-code-encodingPython's PEP-263 [1] dictates that an script that needs to default to UTF-8 encoding has to follow this rule:
'Python will default to ASCII as standard encoding if no other
encoding hints are given.To define a source code encoding, a magic comment must be placed into the source files either as first or second line in the file'
And:
'More precisely, the first or second line must match the following regular expression: ^[ \t\f]*#.*?coding[:=][ \t]*([-_.a-zA-Z0-9]+)'[1] https://www.python.org/dev/peps/pep-0263/
If a script has both "#!" and the charset encoding line, we can't place a SPDX tag without either violating
license-rules.rstor breaking the script by making it crash with non-ASCII characters.So, add a sort notice saying that, for Python scripts, the SPDX header may be up to the third line, in order to cover the case where both "#!" and "# .*coding.*UTF-8" lines are found.
Signed-off-by Mauro Carvalho Chehab <[email protected]>--- Documentation/process/license-rules.rst | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)Documentation/process/license-rules.rst +5
-2@@ -64,9 +64,12 @@ License identifier syntax possible line in a file which can contain a comment. For the majority of files this is the first line, except for scripts which require the '#!PATH_TO_INTERPRETER' in the first line. For those scripts the SPDX - identifier goes into the second line. + identifier goes into the second line\ [1]_. -| +.. [1] Please notice that Python scripts may also need an encoding rule + as defined on PEP-263, which should be defined either at the first + or the second line. So, for such scripts, the SPDX identifier may + go up to the third line.
Quoted 5 lines
Documentation/process/license-rules.rst License identifier syntax · line 75
Quoted 2 lines
Documentation/process/license-rules.rst +0
-02. Style:If you are going to do this, can you also fix up
scripts/spdxcheck.pyto properly catch this
For completeness, just added a check for it, and a "stats" mode at the script that will tell on what line the first SPDX tag occurs.
I'll probably rework at the patch later, in order to disable the pedantic mode by default.
There are currently 227 files that don't complain with the "up to line 3" rule, including COPYING (with should probably be excluded from the check).
Patches are at:
https://git.linuxtv.org/mchehab/experimental.git/log/?h=spdx_pedantic
Btw, most violations are due to:
/*
* SPDX...
Regards,
Mauro
Re: [PATCH] docs: license-rules.txt: cover SPDX headers on Python scripts
Quoted 11 lines · Mauro Carvalho Chehab
There are currently 227 files that don't complain with the "up to line 3" rule, including COPYING (with should probably be excluded from the check).
Patches are at:
https://git.linuxtv.org/mchehab/experimental.git/log/?h=spdx_pedantic
Btw, most violations are due to:
/*
* SPDX...
Hey Mauro.
Here's a little script to move all of the improperly located SPDX-License-Identifier lines in [.ch] files.
Using this command line:
$ git grep -n 'SPDX-License-Identifier: ' -- '*.[ch]' | \ grep -v ':1:' | perl move_spdx.pl
and
$ cat move_spdx.pl
while (<>) {
/^([^:]+):([^:]+):(.*)/;
my ($file, $line, $spdx) = ($1, $2, $3);
$spdx =~ s/^\s*\/?\*\s*//;
$spdx =~ s/\s*\*\/\s*$//;
if ($file =~ /\.h$/) {
$spdx = "/* $spdx */";
} else {
$spdx = "// $spdx";
}
open(FH, '<', $file) or die $!;
my @lines = <FH>;
close FH;
open(FH, '>', $file) or die $!;
print FH "$spdx\n";
my $count = 0;
foreach (@lines) {
$count++;
next if ($count == $line);
next if ($count == $line - 1 && $_ =~ /^\s*\*\s*$/);
next if ($count == $line + 1 && $_ =~ /^\s*\*\s*$/);
print FH "$_";
}
close FH;
}which gives this diff for today's -next
--- arch/x86/kernel/apic/apic_common.c | 3 +-- drivers/dma/sprd-dma.c | 3 +-- drivers/gpu/drm/i915/gem/i915_gem_busy.c | 3 +-- drivers/gpu/drm/i915/gem/i915_gem_clflush.c | 3 +-- drivers/gpu/drm/i915/gem/i915_gem_clflush.h | 3 +-- drivers/gpu/drm/i915/gem/i915_gem_context.c | 3 +-- drivers/gpu/drm/i915/gem/i915_gem_context.h | 3 +-- drivers/gpu/drm/i915/gem/i915_gem_context_types.h | 3 +-- drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c | 3 +-- drivers/gpu/drm/i915/gem/i915_gem_domain.c | 3 +-- drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c | 3 +-- drivers/gpu/drm/i915/gem/i915_gem_fence.c | 3 +-- drivers/gpu/drm/i915/gem/i915_gem_internal.c | 3 +-- drivers/gpu/drm/i915/gem/i915_gem_ioctls.h | 3 +-- drivers/gpu/drm/i915/gem/i915_gem_mman.c | 3 +-- drivers/gpu/drm/i915/gem/i915_gem_object.h | 3 +-- drivers/gpu/drm/i915/gem/i915_gem_object_types.h | 3 +-- drivers/gpu/drm/i915/gem/i915_gem_pages.c | 3 +-- drivers/gpu/drm/i915/gem/i915_gem_phys.c | 3 +-- drivers/gpu/drm/i915/gem/i915_gem_pm.c | 3 +-- drivers/gpu/drm/i915/gem/i915_gem_pm.h | 3 +-- drivers/gpu/drm/i915/gem/i915_gem_shmem.c | 3 +-- drivers/gpu/drm/i915/gem/i915_gem_shrinker.c | 3 +-- drivers/gpu/drm/i915/gem/i915_gem_stolen.c | 3 +-- drivers/gpu/drm/i915/gem/i915_gem_throttle.c | 3 +-- drivers/gpu/drm/i915/gem/i915_gem_tiling.c | 3 +-- drivers/gpu/drm/i915/gem/i915_gem_userptr.c | 3 +-- drivers/gpu/drm/i915/gem/i915_gem_wait.c | 3 +-- drivers/gpu/drm/i915/gem/i915_gemfs.c | 3 +-- drivers/gpu/drm/i915/gem/i915_gemfs.h | 3 +-- drivers/gpu/drm/i915/gem/selftests/huge_gem_object.c | 3 +-- drivers/gpu/drm/i915/gem/selftests/huge_gem_object.h | 3 +-- drivers/gpu/drm/i915/gem/selftests/huge_pages.c | 3 +-- drivers/gpu/drm/i915/gem/selftests/i915_gem_coherency.c | 3 +-- drivers/gpu/drm/i915/gem/selftests/i915_gem_context.c | 3 +-- drivers/gpu/drm/i915/gem/selftests/i915_gem_dmabuf.c | 3 +-- drivers/gpu/drm/i915/gem/selftests/i915_gem_mman.c | 3 +-- drivers/gpu/drm/i915/gem/selftests/i915_gem_object.c | 3 +-- drivers/gpu/drm/i915/gem/selftests/i915_gem_phys.c | 3 +-- drivers/gpu/drm/i915/gem/selftests/igt_gem_utils.c | 3 +-- drivers/gpu/drm/i915/gem/selftests/igt_gem_utils.h | 3 +-- drivers/gpu/drm/i915/gem/selftests/mock_context.c | 3 +-- drivers/gpu/drm/i915/gem/selftests/mock_context.h | 3 +-- drivers/gpu/drm/i915/gem/selftests/mock_dmabuf.c | 3 +-- drivers/gpu/drm/i915/gem/selftests/mock_dmabuf.h | 3 +-- drivers/gpu/drm/i915/gem/selftests/mock_gem_object.h | 3 +-- drivers/gpu/drm/i915/gt/intel_context.c | 3 +-- drivers/gpu/drm/i915/gt/intel_context.h | 3 +-- drivers/gpu/drm/i915/gt/intel_context_types.h | 3 +-- drivers/gpu/drm/i915/gt/intel_engine_pm.c | 3 +-- drivers/gpu/drm/i915/gt/intel_engine_pm.h | 3 +-- drivers/gpu/drm/i915/gt/intel_engine_pool.c | 3 +-- drivers/gpu/drm/i915/gt/intel_engine_pool.h | 3 +-- drivers/gpu/drm/i915/gt/intel_engine_pool_types.h | 3 +-- drivers/gpu/drm/i915/gt/intel_engine_types.h | 3 +-- drivers/gpu/drm/i915/gt/intel_engine_user.c | 3 +-- drivers/gpu/drm/i915/gt/intel_engine_user.h | 3 +-- drivers/gpu/drm/i915/gt/intel_gpu_commands.h | 3 +-- drivers/gpu/drm/i915/gt/intel_gt_irq.c | 3 +-- drivers/gpu/drm/i915/gt/intel_gt_irq.h | 3 +-- drivers/gpu/drm/i915/gt/intel_gt_pm.c | 3 +-- drivers/gpu/drm/i915/gt/intel_gt_pm.h | 3 +-- drivers/gpu/drm/i915/gt/intel_gt_pm_irq.c | 3 +-- drivers/gpu/drm/i915/gt/intel_gt_pm_irq.h | 3 +-- drivers/gpu/drm/i915/gt/intel_lrc_reg.h | 3 +-- drivers/gpu/drm/i915/gt/intel_reset.c | 3 +-- drivers/gpu/drm/i915/gt/intel_reset.h | 3 +-- drivers/gpu/drm/i915/gt/intel_sseu.c | 3 +-- drivers/gpu/drm/i915/gt/intel_sseu.h | 3 +-- drivers/gpu/drm/i915/gt/intel_timeline.c | 3 +-- drivers/gpu/drm/i915/gt/intel_timeline_types.h | 3 +-- drivers/gpu/drm/i915/gt/intel_workarounds.c | 3 +-- drivers/gpu/drm/i915/gt/intel_workarounds.h | 3 +-- drivers/gpu/drm/i915/gt/intel_workarounds_types.h | 3 +-- drivers/gpu/drm/i915/gt/selftest_context.c | 3 +-- drivers/gpu/drm/i915/gt/selftest_engine.c | 3 +-- drivers/gpu/drm/i915/gt/selftest_engine.h | 3 +-- drivers/gpu/drm/i915/gt/selftest_engine_cs.c | 3 +-- drivers/gpu/drm/i915/gt/selftest_engine_pm.c | 3 +-- drivers/gpu/drm/i915/gt/selftest_lrc.c | 3 +-- drivers/gpu/drm/i915/gt/selftest_timeline.c | 3 +-- drivers/gpu/drm/i915/gt/selftest_workarounds.c | 3 +-- drivers/gpu/drm/i915/gt/selftests/mock_timeline.c | 3 +-- drivers/gpu/drm/i915/gt/selftests/mock_timeline.h | 3 +-- drivers/gpu/drm/i915/i915_active.c | 3 +-- drivers/gpu/drm/i915/i915_active.h | 3 +-- drivers/gpu/drm/i915/i915_active_types.h | 3 +-- drivers/gpu/drm/i915/i915_getparam.c | 2 +- drivers/gpu/drm/i915/i915_globals.c | 3 +-- drivers/gpu/drm/i915/i915_globals.h | 3 +-- drivers/gpu/drm/i915/i915_gpu_error.h | 3 +-- drivers/gpu/drm/i915/i915_pmu.c | 3 +-- drivers/gpu/drm/i915/i915_pmu.h | 3 +-- drivers/gpu/drm/i915/i915_priolist_types.h | 3 +-- drivers/gpu/drm/i915/i915_query.c | 3 +-- drivers/gpu/drm/i915/i915_query.h | 3 +-- drivers/gpu/drm/i915/i915_scatterlist.c | 3 +-- drivers/gpu/drm/i915/i915_scatterlist.h | 3 +-- drivers/gpu/drm/i915/i915_scheduler.c | 3 +-- drivers/gpu/drm/i915/i915_scheduler.h | 3 +-- drivers/gpu/drm/i915/i915_scheduler_types.h | 3 +-- drivers/gpu/drm/i915/i915_sw_fence.c | 3 +-- drivers/gpu/drm/i915/i915_sw_fence.h | 3 +-- drivers/gpu/drm/i915/i915_user_extensions.c | 3 +-- drivers/gpu/drm/i915/i915_user_extensions.h | 3 +-- drivers/gpu/drm/i915/intel_wakeref.c | 3 +-- drivers/gpu/drm/i915/intel_wakeref.h | 3 +-- drivers/gpu/drm/i915/intel_wopcm.h | 3 +-- drivers/gpu/drm/i915/selftests/i915_active.c | 3 +-- drivers/gpu/drm/i915/selftests/i915_gem.c | 3 +-- drivers/gpu/drm/i915/selftests/igt_flush_test.c | 3 +-- drivers/gpu/drm/i915/selftests/igt_flush_test.h | 3 +-- drivers/gpu/drm/i915/selftests/igt_live_test.c | 3 +-- drivers/gpu/drm/i915/selftests/igt_live_test.h | 3 +-- drivers/gpu/drm/i915/selftests/igt_reset.c | 3 +-- drivers/gpu/drm/i915/selftests/igt_reset.h | 3 +-- drivers/gpu/drm/i915/selftests/igt_spinner.c | 3 +-- drivers/gpu/drm/i915/selftests/igt_spinner.h | 3 +-- drivers/gpu/drm/msm/disp/dpu1/dpu_mdss.c | 2 +- drivers/gpu/drm/msm/dsi/phy/dsi_phy_10nm.c | 2 +- drivers/gpu/drm/msm/dsi/pll/dsi_pll_10nm.c | 2 +- drivers/hid/hid-redragon.c | 2 +- drivers/i2c/busses/i2c-sprd.c | 3 +-- drivers/media/common/siano/smsir.h | 3 +-- drivers/media/i2c/saa711x_regs.h | 2 +- drivers/media/i2c/tvp5150_reg.h | 3 +-- drivers/media/pci/bt8xx/bttv-audio-hook.h | 3 +-- drivers/media/platform/meson/ao-cec.c | 3 +-- drivers/media/rc/rc-core-priv.h | 2 +- drivers/media/tuners/tuner-xc2028-types.h | 2 +- drivers/media/tuners/tuner-xc2028.h | 2 +- drivers/media/usb/tm6000/tm6000-regs.h | 2 +- drivers/media/usb/tm6000/tm6000-usb-isoc.h | 2 +- drivers/media/usb/tm6000/tm6000.h | 2 +- drivers/pinctrl/meson/pinctrl-meson-axg-pmx.c | 3 +-- drivers/pinctrl/meson/pinctrl-meson-axg-pmx.h | 3 +-- drivers/pinctrl/meson/pinctrl-meson-axg.c | 3 +-- drivers/rtc/rtc-rtd119x.c | 3 +-- drivers/rtc/rtc-sc27xx.c | 3 +-- drivers/soc/amlogic/meson-gx-pwrc-vpu.c | 3 +-- drivers/soc/amlogic/meson-gx-socinfo.c | 3 +-- drivers/soc/amlogic/meson-mx-socinfo.c | 3 +-- drivers/spi/spi-meson-spicc.c | 3 +-- drivers/spi/spi-sprd-adi.c | 3 +-- drivers/watchdog/rtd119x_wdt.c | 3 +-- include/acpi/nfit.h | 2 +- include/dt-bindings/clock/sun8i-de2.h | 3 +-- include/dt-bindings/gpio/meson-axg-gpio.h | 3 +-- include/dt-bindings/power/owl-s500-powergate.h | 3 +-- include/dt-bindings/reset/amlogic,meson8b-clkc-reset.h | 3 +-- include/dt-bindings/reset/sun8i-de2.h | 3 +-- include/linux/ascii85.h | 3 +-- include/linux/soc/actions/owl-sps.h | 3 +-- include/media/dvb_vb2.h | 3 +-- tools/perf/util/cs-etm-decoder/cs-etm-decoder.h | 3 +-- tools/perf/util/rlimit.h | 2 +- 156 files changed, 156 insertions(+), 298 deletions(-)
arch/x86/kernel/apic/apic_common.c +1 -2
@@ -1,7 +1,6 @@ +// SPDX-License-Identifier: GPL-2.0 /* * Common functions shared between the various APIC flavours -* -* SPDX-License-Identifier: GPL-2.0 */ #include <linux/irq.h> #include <asm/apic.h>
drivers/dma/sprd-dma.c +1 -2
@@ -1,7 +1,6 @@ +// SPDX-License-Identifier: GPL-2.0 /* * Copyright (C) 2017 Spreadtrum Communications Inc. -* -* SPDX-License-Identifier: GPL-2.0 */ #include <linux/clk.h>
drivers/gpu/drm/i915/gem/i915_gem_busy.c +1 -2
@@ -1,6 +1,5 @@ +// SPDX-License-Identifier: MIT /* -* SPDX-License-Identifier: MIT -* * Copyright © 2014-2016 Intel Corporation */
drivers/gpu/drm/i915/gem/i915_gem_clflush.c +1 -2
@@ -1,6 +1,5 @@ +// SPDX-License-Identifier: MIT /* -* SPDX-License-Identifier: MIT -* * Copyright © 2016 Intel Corporation */
drivers/gpu/drm/i915/gem/i915_gem_clflush.h +1 -2
@@ -1,6 +1,5 @@ +/* SPDX-License-Identifier: MIT */ /* -* SPDX-License-Identifier: MIT -* * Copyright © 2016 Intel Corporation */
drivers/gpu/drm/i915/gem/i915_gem_context.c +1 -2
@@ -1,6 +1,5 @@ +// SPDX-License-Identifier: MIT /* -* SPDX-License-Identifier: MIT -* * Copyright © 2011-2012 Intel Corporation */
drivers/gpu/drm/i915/gem/i915_gem_context.h +1 -2
@@ -1,6 +1,5 @@ +/* SPDX-License-Identifier: MIT */ /* -* SPDX-License-Identifier: MIT -* * Copyright © 2016 Intel Corporation */
drivers/gpu/drm/i915/gem/i915_gem_context_types.h +1 -2
@@ -1,6 +1,5 @@ +/* SPDX-License-Identifier: MIT */ /* -* SPDX-License-Identifier: MIT -* * Copyright © 2019 Intel Corporation */
drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c +1 -2
@@ -1,6 +1,5 @@ +// SPDX-License-Identifier: MIT /* -* SPDX-License-Identifier: MIT -* * Copyright 2012 Red Hat Inc */
drivers/gpu/drm/i915/gem/i915_gem_domain.c +1 -2
@@ -1,6 +1,5 @@ +// SPDX-License-Identifier: MIT /* -* SPDX-License-Identifier: MIT -* * Copyright © 2014-2016 Intel Corporation */
drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c +1 -2
@@ -1,6 +1,5 @@ +// SPDX-License-Identifier: MIT /* -* SPDX-License-Identifier: MIT -* * Copyright © 2008,2010 Intel Corporation */
drivers/gpu/drm/i915/gem/i915_gem_fence.c +1 -2
@@ -1,6 +1,5 @@ +// SPDX-License-Identifier: MIT /* -* SPDX-License-Identifier: MIT -* * Copyright © 2019 Intel Corporation */
drivers/gpu/drm/i915/gem/i915_gem_internal.c +1 -2
@@ -1,6 +1,5 @@ +// SPDX-License-Identifier: MIT /* -* SPDX-License-Identifier: MIT -* * Copyright © 2014-2016 Intel Corporation */
drivers/gpu/drm/i915/gem/i915_gem_ioctls.h +1 -2
@@ -1,6 +1,5 @@ +/* SPDX-License-Identifier: MIT */ /* -* SPDX-License-Identifier: MIT -* * Copyright © 2019 Intel Corporation */
drivers/gpu/drm/i915/gem/i915_gem_mman.c +1 -2
@@ -1,6 +1,5 @@ +// SPDX-License-Identifier: MIT /* -* SPDX-License-Identifier: MIT -* * Copyright © 2014-2016 Intel Corporation */
drivers/gpu/drm/i915/gem/i915_gem_object.h +1 -2
@@ -1,6 +1,5 @@ +/* SPDX-License-Identifier: MIT */ /* -* SPDX-License-Identifier: MIT -* * Copyright © 2016 Intel Corporation */
drivers/gpu/drm/i915/gem/i915_gem_object_types.h +1 -2
@@ -1,6 +1,5 @@ +/* SPDX-License-Identifier: MIT */ /* -* SPDX-License-Identifier: MIT -* * Copyright © 2016 Intel Corporation */
drivers/gpu/drm/i915/gem/i915_gem_pages.c +1 -2
@@ -1,6 +1,5 @@ +// SPDX-License-Identifier: MIT /* -* SPDX-License-Identifier: MIT -* * Copyright © 2014-2016 Intel Corporation */
drivers/gpu/drm/i915/gem/i915_gem_phys.c +1 -2
@@ -1,6 +1,5 @@ +// SPDX-License-Identifier: MIT /* -* SPDX-License-Identifier: MIT -* * Copyright © 2014-2016 Intel Corporation */
drivers/gpu/drm/i915/gem/i915_gem_pm.c +1 -2
@@ -1,6 +1,5 @@ +// SPDX-License-Identifier: MIT /* -* SPDX-License-Identifier: MIT -* * Copyright © 2019 Intel Corporation */
drivers/gpu/drm/i915/gem/i915_gem_pm.h +1 -2
@@ -1,6 +1,5 @@ +/* SPDX-License-Identifier: MIT */ /* -* SPDX-License-Identifier: MIT -* * Copyright © 2019 Intel Corporation */
drivers/gpu/drm/i915/gem/i915_gem_shmem.c +1 -2
@@ -1,6 +1,5 @@ +// SPDX-License-Identifier: MIT /* -* SPDX-License-Identifier: MIT -* * Copyright © 2014-2016 Intel Corporation */
drivers/gpu/drm/i915/gem/i915_gem_shrinker.c +1 -2
@@ -1,6 +1,5 @@ +// SPDX-License-Identifier: MIT /* -* SPDX-License-Identifier: MIT -* * Copyright © 2008-2015 Intel Corporation */
drivers/gpu/drm/i915/gem/i915_gem_stolen.c +1 -2
@@ -1,6 +1,5 @@ +// SPDX-License-Identifier: MIT /* -* SPDX-License-Identifier: MIT -* * Copyright © 2008-2012 Intel Corporation */
drivers/gpu/drm/i915/gem/i915_gem_throttle.c +1 -2
@@ -1,6 +1,5 @@ +// SPDX-License-Identifier: MIT /* -* SPDX-License-Identifier: MIT -* * Copyright © 2014-2016 Intel Corporation */
drivers/gpu/drm/i915/gem/i915_gem_tiling.c +1 -2
@@ -1,6 +1,5 @@ +// SPDX-License-Identifier: MIT /* -* SPDX-License-Identifier: MIT -* * Copyright © 2008 Intel Corporation */
drivers/gpu/drm/i915/gem/i915_gem_userptr.c +1 -2
@@ -1,6 +1,5 @@ +// SPDX-License-Identifier: MIT /* -* SPDX-License-Identifier: MIT -* * Copyright © 2012-2014 Intel Corporation */
drivers/gpu/drm/i915/gem/i915_gem_wait.c +1 -2
@@ -1,6 +1,5 @@ +// SPDX-License-Identifier: MIT /* -* SPDX-License-Identifier: MIT -* * Copyright © 2016 Intel Corporation */
drivers/gpu/drm/i915/gem/i915_gemfs.c +1 -2
@@ -1,6 +1,5 @@ +// SPDX-License-Identifier: MIT /* -* SPDX-License-Identifier: MIT -* * Copyright © 2017 Intel Corporation */
drivers/gpu/drm/i915/gem/i915_gemfs.h +1 -2
@@ -1,6 +1,5 @@ +/* SPDX-License-Identifier: MIT */ /* -* SPDX-License-Identifier: MIT -* * Copyright © 2017 Intel Corporation */
drivers/gpu/drm/i915/gem/selftests/huge_gem_object.c +1 -2
@@ -1,6 +1,5 @@ +// SPDX-License-Identifier: MIT /* -* SPDX-License-Identifier: MIT -* * Copyright © 2016 Intel Corporation */
drivers/gpu/drm/i915/gem/selftests/huge_gem_object.h +1 -2
@@ -1,6 +1,5 @@ +/* SPDX-License-Identifier: MIT */ /* -* SPDX-License-Identifier: MIT -* * Copyright © 2016 Intel Corporation */
drivers/gpu/drm/i915/gem/selftests/huge_pages.c +1 -2
@@ -1,6 +1,5 @@ +// SPDX-License-Identifier: MIT /* -* SPDX-License-Identifier: MIT -* * Copyright © 2017 Intel Corporation */
drivers/gpu/drm/i915/gem/selftests/i915_gem_coherency.c +1 -2
@@ -1,6 +1,5 @@ +// SPDX-License-Identifier: MIT /* -* SPDX-License-Identifier: MIT -* * Copyright © 2017 Intel Corporation */
drivers/gpu/drm/i915/gem/selftests/i915_gem_context.c +1 -2
@@ -1,6 +1,5 @@ +// SPDX-License-Identifier: MIT /* -* SPDX-License-Identifier: MIT -* * Copyright © 2017 Intel Corporation */
drivers/gpu/drm/i915/gem/selftests/i915_gem_dmabuf.c +1 -2
@@ -1,6 +1,5 @@ +// SPDX-License-Identifier: MIT /* -* SPDX-License-Identifier: MIT -* * Copyright © 2016 Intel Corporation */
drivers/gpu/drm/i915/gem/selftests/i915_gem_mman.c +1 -2
@@ -1,6 +1,5 @@ +// SPDX-License-Identifier: MIT /* -* SPDX-License-Identifier: MIT -* * Copyright © 2016 Intel Corporation */
drivers/gpu/drm/i915/gem/selftests/i915_gem_object.c +1 -2
@@ -1,6 +1,5 @@ +// SPDX-License-Identifier: MIT /* -* SPDX-License-Identifier: MIT -* * Copyright © 2016 Intel Corporation */
drivers/gpu/drm/i915/gem/selftests/i915_gem_phys.c +1 -2
@@ -1,6 +1,5 @@ +// SPDX-License-Identifier: MIT /* -* SPDX-License-Identifier: MIT -* * Copyright © 2016 Intel Corporation */
drivers/gpu/drm/i915/gem/selftests/igt_gem_utils.c +1 -2
@@ -1,6 +1,5 @@ +// SPDX-License-Identifier: MIT /* -* SPDX-License-Identifier: MIT -* * Copyright © 2018 Intel Corporation */
drivers/gpu/drm/i915/gem/selftests/igt_gem_utils.h +1 -2
@@ -1,6 +1,5 @@ +/* SPDX-License-Identifier: MIT */ /* -* SPDX-License-Identifier: MIT -* * Copyright © 2018 Intel Corporation */
drivers/gpu/drm/i915/gem/selftests/mock_context.c +1 -2
@@ -1,6 +1,5 @@ +// SPDX-License-Identifier: MIT /* -* SPDX-License-Identifier: MIT -* * Copyright © 2016 Intel Corporation */
drivers/gpu/drm/i915/gem/selftests/mock_context.h +1 -2
@@ -1,6 +1,5 @@ +/* SPDX-License-Identifier: MIT */ /* -* SPDX-License-Identifier: MIT -* * Copyright © 2016 Intel Corporation */
drivers/gpu/drm/i915/gem/selftests/mock_dmabuf.c +1 -2
@@ -1,6 +1,5 @@ +// SPDX-License-Identifier: MIT /* -* SPDX-License-Identifier: MIT -* * Copyright © 2016 Intel Corporation */
drivers/gpu/drm/i915/gem/selftests/mock_dmabuf.h +1 -2
@@ -1,6 +1,5 @@ +/* SPDX-License-Identifier: MIT */ /* -* SPDX-License-Identifier: MIT -* * Copyright © 2016 Intel Corporation */
drivers/gpu/drm/i915/gem/selftests/mock_gem_object.h +1 -2
@@ -1,6 +1,5 @@ +/* SPDX-License-Identifier: MIT */ /* -* SPDX-License-Identifier: MIT -* * Copyright © 2016 Intel Corporation */
drivers/gpu/drm/i915/gt/intel_context.c +1 -2
@@ -1,6 +1,5 @@ +// SPDX-License-Identifier: MIT /* -* SPDX-License-Identifier: MIT -* * Copyright © 2019 Intel Corporation */
drivers/gpu/drm/i915/gt/intel_context.h +1 -2
@@ -1,6 +1,5 @@ +/* SPDX-License-Identifier: MIT */ /* -* SPDX-License-Identifier: MIT -* * Copyright © 2019 Intel Corporation */
drivers/gpu/drm/i915/gt/intel_context_types.h +1 -2
@@ -1,6 +1,5 @@ +/* SPDX-License-Identifier: MIT */ /* -* SPDX-License-Identifier: MIT -* * Copyright © 2019 Intel Corporation */
drivers/gpu/drm/i915/gt/intel_engine_pm.c +1 -2
@@ -1,6 +1,5 @@ +// SPDX-License-Identifier: MIT /* -* SPDX-License-Identifier: MIT -* * Copyright © 2019 Intel Corporation */
drivers/gpu/drm/i915/gt/intel_engine_pm.h +1 -2
@@ -1,6 +1,5 @@ +/* SPDX-License-Identifier: MIT */ /* -* SPDX-License-Identifier: MIT -* * Copyright © 2019 Intel Corporation */
drivers/gpu/drm/i915/gt/intel_engine_pool.c +1 -2
@@ -1,6 +1,5 @@ +// SPDX-License-Identifier: MIT /* -* SPDX-License-Identifier: MIT -* * Copyright © 2014-2018 Intel Corporation */
drivers/gpu/drm/i915/gt/intel_engine_pool.h +1 -2
@@ -1,6 +1,5 @@ +/* SPDX-License-Identifier: MIT */ /* -* SPDX-License-Identifier: MIT -* * Copyright © 2014-2018 Intel Corporation */
drivers/gpu/drm/i915/gt/intel_engine_pool_types.h +1 -2
@@ -1,6 +1,5 @@ +/* SPDX-License-Identifier: MIT */ /* -* SPDX-License-Identifier: MIT -* * Copyright © 2014-2018 Intel Corporation */
drivers/gpu/drm/i915/gt/intel_engine_types.h +1 -2
@@ -1,6 +1,5 @@ +/* SPDX-License-Identifier: MIT */ /* -* SPDX-License-Identifier: MIT -* * Copyright © 2019 Intel Corporation */
drivers/gpu/drm/i915/gt/intel_engine_user.c +1 -2
@@ -1,6 +1,5 @@ +// SPDX-License-Identifier: MIT /* -* SPDX-License-Identifier: MIT -* * Copyright © 2019 Intel Corporation */
drivers/gpu/drm/i915/gt/intel_engine_user.h +1 -2
@@ -1,6 +1,5 @@ +/* SPDX-License-Identifier: MIT */ /* -* SPDX-License-Identifier: MIT -* * Copyright © 2019 Intel Corporation */
drivers/gpu/drm/i915/gt/intel_gpu_commands.h +1 -2
@@ -1,6 +1,5 @@ +/* SPDX-License-Identifier: MIT */ /* -* SPDX-License-Identifier: MIT -* * Copyright � 2003-2018 Intel Corporation */
drivers/gpu/drm/i915/gt/intel_gt_irq.c +1 -2
@@ -1,6 +1,5 @@ +// SPDX-License-Identifier: MIT /* -* SPDX-License-Identifier: MIT -* * Copyright © 2019 Intel Corporation */
drivers/gpu/drm/i915/gt/intel_gt_irq.h +1 -2
@@ -1,6 +1,5 @@ +/* SPDX-License-Identifier: MIT */ /* -* SPDX-License-Identifier: MIT -* * Copyright © 2019 Intel Corporation */
drivers/gpu/drm/i915/gt/intel_gt_pm.c +1 -2
@@ -1,6 +1,5 @@ +// SPDX-License-Identifier: MIT /* -* SPDX-License-Identifier: MIT -* * Copyright © 2019 Intel Corporation */
drivers/gpu/drm/i915/gt/intel_gt_pm.h +1 -2
@@ -1,6 +1,5 @@ +/* SPDX-License-Identifier: MIT */ /* -* SPDX-License-Identifier: MIT -* * Copyright © 2019 Intel Corporation */
drivers/gpu/drm/i915/gt/intel_gt_pm_irq.c +1 -2
@@ -1,6 +1,5 @@ +// SPDX-License-Identifier: MIT /* -* SPDX-License-Identifier: MIT -* * Copyright © 2019 Intel Corporation */
drivers/gpu/drm/i915/gt/intel_gt_pm_irq.h +1 -2
@@ -1,6 +1,5 @@ +/* SPDX-License-Identifier: MIT */ /* -* SPDX-License-Identifier: MIT -* * Copyright © 2019 Intel Corporation */
drivers/gpu/drm/i915/gt/intel_lrc_reg.h +1 -2
@@ -1,6 +1,5 @@ +/* SPDX-License-Identifier: MIT */ /* -* SPDX-License-Identifier: MIT -* * Copyright © 2014-2018 Intel Corporation */
drivers/gpu/drm/i915/gt/intel_reset.c +1 -2
@@ -1,6 +1,5 @@ +// SPDX-License-Identifier: MIT /* -* SPDX-License-Identifier: MIT -* * Copyright © 2008-2018 Intel Corporation */
drivers/gpu/drm/i915/gt/intel_reset.h +1 -2
@@ -1,6 +1,5 @@ +/* SPDX-License-Identifier: MIT */ /* -* SPDX-License-Identifier: MIT -* * Copyright © 2008-2018 Intel Corporation */
drivers/gpu/drm/i915/gt/intel_sseu.c +1 -2
@@ -1,6 +1,5 @@ +// SPDX-License-Identifier: MIT /* -* SPDX-License-Identifier: MIT -* * Copyright © 2019 Intel Corporation */
drivers/gpu/drm/i915/gt/intel_sseu.h +1 -2
@@ -1,6 +1,5 @@ +/* SPDX-License-Identifier: MIT */ /* -* SPDX-License-Identifier: MIT -* * Copyright © 2019 Intel Corporation */
drivers/gpu/drm/i915/gt/intel_timeline.c +1 -2
@@ -1,6 +1,5 @@ +// SPDX-License-Identifier: MIT /* -* SPDX-License-Identifier: MIT -* * Copyright © 2016-2018 Intel Corporation */
drivers/gpu/drm/i915/gt/intel_timeline_types.h +1 -2
@@ -1,6 +1,5 @@ +/* SPDX-License-Identifier: MIT */ /* -* SPDX-License-Identifier: MIT -* * Copyright © 2016 Intel Corporation */
drivers/gpu/drm/i915/gt/intel_workarounds.c +1 -2
@@ -1,6 +1,5 @@ +// SPDX-License-Identifier: MIT /* -* SPDX-License-Identifier: MIT -* * Copyright © 2014-2018 Intel Corporation */
drivers/gpu/drm/i915/gt/intel_workarounds.h +1 -2
@@ -1,6 +1,5 @@ +/* SPDX-License-Identifier: MIT */ /* -* SPDX-License-Identifier: MIT -* * Copyright © 2014-2018 Intel Corporation */
drivers/gpu/drm/i915/gt/intel_workarounds_types.h +1 -2
@@ -1,6 +1,5 @@ +/* SPDX-License-Identifier: MIT */ /* -* SPDX-License-Identifier: MIT -* * Copyright © 2014-2018 Intel Corporation */
drivers/gpu/drm/i915/gt/selftest_context.c +1 -2
@@ -1,6 +1,5 @@ +// SPDX-License-Identifier: GPL-2.0 /* -* SPDX-License-Identifier: GPL-2.0 -* * Copyright © 2019 Intel Corporation */
drivers/gpu/drm/i915/gt/selftest_engine.c +1 -2
@@ -1,6 +1,5 @@ +// SPDX-License-Identifier: GPL-2.0 /* -* SPDX-License-Identifier: GPL-2.0 -* * Copyright © 2018 Intel Corporation */
drivers/gpu/drm/i915/gt/selftest_engine.h +1 -2
@@ -1,6 +1,5 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* -* SPDX-License-Identifier: GPL-2.0 -* * Copyright © 2019 Intel Corporation */
drivers/gpu/drm/i915/gt/selftest_engine_cs.c +1 -2
@@ -1,6 +1,5 @@ +// SPDX-License-Identifier: GPL-2.0 /* -* SPDX-License-Identifier: GPL-2.0 -* * Copyright © 2018 Intel Corporation */
drivers/gpu/drm/i915/gt/selftest_engine_pm.c +1 -2
@@ -1,6 +1,5 @@ +// SPDX-License-Identifier: GPL-2.0 /* -* SPDX-License-Identifier: GPL-2.0 -* * Copyright © 2018 Intel Corporation */
drivers/gpu/drm/i915/gt/selftest_lrc.c +1 -2
@@ -1,6 +1,5 @@ +// SPDX-License-Identifier: MIT /* -* SPDX-License-Identifier: MIT -* * Copyright © 2018 Intel Corporation */
drivers/gpu/drm/i915/gt/selftest_timeline.c +1 -2
@@ -1,6 +1,5 @@ +// SPDX-License-Identifier: MIT /* -* SPDX-License-Identifier: MIT -* * Copyright © 2017-2018 Intel Corporation */
drivers/gpu/drm/i915/gt/selftest_workarounds.c +1 -2
@@ -1,6 +1,5 @@ +// SPDX-License-Identifier: MIT /* -* SPDX-License-Identifier: MIT -* * Copyright © 2018 Intel Corporation */
drivers/gpu/drm/i915/gt/selftests/mock_timeline.c +1 -2
@@ -1,6 +1,5 @@ +// SPDX-License-Identifier: MIT /* -* SPDX-License-Identifier: MIT -* * Copyright © 2017-2018 Intel Corporation */
drivers/gpu/drm/i915/gt/selftests/mock_timeline.h +1 -2
@@ -1,6 +1,5 @@ +/* SPDX-License-Identifier: MIT */ /* -* SPDX-License-Identifier: MIT -* * Copyright © 2017-2018 Intel Corporation */
drivers/gpu/drm/i915/i915_active.c +1 -2
@@ -1,6 +1,5 @@ +// SPDX-License-Identifier: MIT /* -* SPDX-License-Identifier: MIT -* * Copyright © 2019 Intel Corporation */
drivers/gpu/drm/i915/i915_active.h +1 -2
@@ -1,6 +1,5 @@ +/* SPDX-License-Identifier: MIT */ /* -* SPDX-License-Identifier: MIT -* * Copyright © 2019 Intel Corporation */
drivers/gpu/drm/i915/i915_active_types.h +1 -2
@@ -1,6 +1,5 @@ +/* SPDX-License-Identifier: MIT */ /* -* SPDX-License-Identifier: MIT -* * Copyright © 2019 Intel Corporation */
drivers/gpu/drm/i915/i915_getparam.c +1 -1
@@ -1,5 +1,5 @@ +// SPDX-License-Identifier: MIT /* -* SPDX-License-Identifier: MIT */ #include "gt/intel_engine_user.h"
drivers/gpu/drm/i915/i915_globals.c +1 -2
@@ -1,6 +1,5 @@ +// SPDX-License-Identifier: MIT /* -* SPDX-License-Identifier: MIT -* * Copyright © 2019 Intel Corporation */
drivers/gpu/drm/i915/i915_globals.h +1 -2
@@ -1,6 +1,5 @@ +/* SPDX-License-Identifier: MIT */ /* -* SPDX-License-Identifier: MIT -* * Copyright © 2019 Intel Corporation */
drivers/gpu/drm/i915/i915_gpu_error.h +1 -2
@@ -1,6 +1,5 @@ +/* SPDX-License-Identifier: MIT */ /* -* SPDX-License-Identifier: MIT -* * Copyright � 2008-2018 Intel Corporation */
drivers/gpu/drm/i915/i915_pmu.c +1 -2
@@ -1,6 +1,5 @@ +// SPDX-License-Identifier: MIT /* -* SPDX-License-Identifier: MIT -* * Copyright © 2017-2018 Intel Corporation */
drivers/gpu/drm/i915/i915_pmu.h +1 -2
@@ -1,6 +1,5 @@ +/* SPDX-License-Identifier: MIT */ /* -* SPDX-License-Identifier: MIT -* * Copyright © 2017-2018 Intel Corporation */
drivers/gpu/drm/i915/i915_priolist_types.h +1 -2
@@ -1,6 +1,5 @@ +/* SPDX-License-Identifier: MIT */ /* -* SPDX-License-Identifier: MIT -* * Copyright © 2018 Intel Corporation */
drivers/gpu/drm/i915/i915_query.c +1 -2
@@ -1,6 +1,5 @@ +// SPDX-License-Identifier: MIT /* -* SPDX-License-Identifier: MIT -* * Copyright © 2018 Intel Corporation */
drivers/gpu/drm/i915/i915_query.h +1 -2
@@ -1,6 +1,5 @@ +/* SPDX-License-Identifier: MIT */ /* -* SPDX-License-Identifier: MIT -* * Copyright © 2018 Intel Corporation */
drivers/gpu/drm/i915/i915_scatterlist.c +1 -2
@@ -1,6 +1,5 @@ +// SPDX-License-Identifier: MIT /* -* SPDX-License-Identifier: MIT -* * Copyright © 2016 Intel Corporation */
drivers/gpu/drm/i915/i915_scatterlist.h +1 -2
@@ -1,6 +1,5 @@ +/* SPDX-License-Identifier: MIT */ /* -* SPDX-License-Identifier: MIT -* * Copyright © 2016 Intel Corporation */
drivers/gpu/drm/i915/i915_scheduler.c +1 -2
@@ -1,6 +1,5 @@ +// SPDX-License-Identifier: MIT /* -* SPDX-License-Identifier: MIT -* * Copyright © 2018 Intel Corporation */
drivers/gpu/drm/i915/i915_scheduler.h +1 -2
@@ -1,6 +1,5 @@ +/* SPDX-License-Identifier: MIT */ /* -* SPDX-License-Identifier: MIT -* * Copyright © 2018 Intel Corporation */
drivers/gpu/drm/i915/i915_scheduler_types.h +1 -2
@@ -1,6 +1,5 @@ +/* SPDX-License-Identifier: MIT */ /* -* SPDX-License-Identifier: MIT -* * Copyright © 2018 Intel Corporation */
drivers/gpu/drm/i915/i915_sw_fence.c +1 -2
@@ -1,6 +1,5 @@ +// SPDX-License-Identifier: MIT /* -* SPDX-License-Identifier: MIT -* * (C) Copyright 2016 Intel Corporation */
drivers/gpu/drm/i915/i915_sw_fence.h +1 -2
@@ -1,6 +1,5 @@ +/* SPDX-License-Identifier: MIT */ /* -* SPDX-License-Identifier: MIT -* * i915_sw_fence.h - library routines for N:M synchronisation points * * Copyright (C) 2016 Intel Corporation
drivers/gpu/drm/i915/i915_user_extensions.c +1 -2
@@ -1,6 +1,5 @@ +// SPDX-License-Identifier: MIT /* -* SPDX-License-Identifier: MIT -* * Copyright © 2018 Intel Corporation */
drivers/gpu/drm/i915/i915_user_extensions.h +1 -2
@@ -1,6 +1,5 @@ +/* SPDX-License-Identifier: MIT */ /* -* SPDX-License-Identifier: MIT -* * Copyright © 2018 Intel Corporation */
drivers/gpu/drm/i915/intel_wakeref.c +1 -2
@@ -1,6 +1,5 @@ +// SPDX-License-Identifier: MIT /* -* SPDX-License-Identifier: MIT -* * Copyright © 2019 Intel Corporation */
drivers/gpu/drm/i915/intel_wakeref.h +1 -2
@@ -1,6 +1,5 @@ +/* SPDX-License-Identifier: MIT */ /* -* SPDX-License-Identifier: MIT -* * Copyright © 2019 Intel Corporation */
drivers/gpu/drm/i915/intel_wopcm.h +1 -2
@@ -1,6 +1,5 @@ +/* SPDX-License-Identifier: MIT */ /* -* SPDX-License-Identifier: MIT -* * Copyright © 2017-2018 Intel Corporation */
drivers/gpu/drm/i915/selftests/i915_active.c +1 -2
@@ -1,6 +1,5 @@ +// SPDX-License-Identifier: MIT /* -* SPDX-License-Identifier: MIT -* * Copyright © 2018 Intel Corporation */
drivers/gpu/drm/i915/selftests/i915_gem.c +1 -2
@@ -1,6 +1,5 @@ +// SPDX-License-Identifier: MIT /* -* SPDX-License-Identifier: MIT -* * Copyright © 2018 Intel Corporation */
drivers/gpu/drm/i915/selftests/igt_flush_test.c +1 -2
@@ -1,6 +1,5 @@ +// SPDX-License-Identifier: MIT /* -* SPDX-License-Identifier: MIT -* * Copyright © 2018 Intel Corporation */
drivers/gpu/drm/i915/selftests/igt_flush_test.h +1 -2
@@ -1,6 +1,5 @@ +/* SPDX-License-Identifier: MIT */ /* -* SPDX-License-Identifier: MIT -* * Copyright © 2018 Intel Corporation */
drivers/gpu/drm/i915/selftests/igt_live_test.c +1 -2
@@ -1,6 +1,5 @@ +// SPDX-License-Identifier: MIT /* -* SPDX-License-Identifier: MIT -* * Copyright © 2018 Intel Corporation */
drivers/gpu/drm/i915/selftests/igt_live_test.h +1 -2
@@ -1,6 +1,5 @@ +/* SPDX-License-Identifier: MIT */ /* -* SPDX-License-Identifier: MIT -* * Copyright © 2019 Intel Corporation */
drivers/gpu/drm/i915/selftests/igt_reset.c +1 -2
@@ -1,6 +1,5 @@ +// SPDX-License-Identifier: MIT /* -* SPDX-License-Identifier: MIT -* * Copyright © 2018 Intel Corporation */
drivers/gpu/drm/i915/selftests/igt_reset.h +1 -2
@@ -1,6 +1,5 @@ +/* SPDX-License-Identifier: MIT */ /* -* SPDX-License-Identifier: MIT -* * Copyright © 2018 Intel Corporation */
drivers/gpu/drm/i915/selftests/igt_spinner.c +1 -2
@@ -1,6 +1,5 @@ +// SPDX-License-Identifier: MIT /* -* SPDX-License-Identifier: MIT -* * Copyright © 2018 Intel Corporation */ #include "gt/intel_gt.h"
drivers/gpu/drm/i915/selftests/igt_spinner.h +1 -2
@@ -1,6 +1,5 @@ +/* SPDX-License-Identifier: MIT */ /* -* SPDX-License-Identifier: MIT -* * Copyright © 2018 Intel Corporation */
drivers/gpu/drm/msm/disp/dpu1/dpu_mdss.c +1 -1
@@ -1,5 +1,5 @@ +// SPDX-License-Identifier: GPL-2.0 /* -* SPDX-License-Identifier: GPL-2.0 * Copyright (c) 2018, The Linux Foundation */
drivers/gpu/drm/msm/dsi/phy/dsi_phy_10nm.c +1 -1
@@ -1,5 +1,5 @@ +// SPDX-License-Identifier: GPL-2.0 /* -* SPDX-License-Identifier: GPL-2.0 * Copyright (c) 2018, The Linux Foundation */
drivers/gpu/drm/msm/dsi/pll/dsi_pll_10nm.c +1 -1
@@ -1,5 +1,5 @@ +// SPDX-License-Identifier: GPL-2.0 /* -* SPDX-License-Identifier: GPL-2.0 * Copyright (c) 2018, The Linux Foundation */
drivers/hid/hid-redragon.c +1 -1
@@ -1,8 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * HID driver for Redragon keyboards * * Copyright (c) 2017 Robert Munteanu -* SPDX-License-Identifier: GPL-2.0+ */ /*
drivers/i2c/busses/i2c-sprd.c +1 -2
@@ -1,7 +1,6 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) /* * Copyright (C) 2017 Spreadtrum Communications Inc. -* -* SPDX-License-Identifier: (GPL-2.0+ OR MIT) */ #include <linux/clk.h>
drivers/media/common/siano/smsir.h +1 -2
@@ -1,6 +1,5 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ /* -* SPDX-License-Identifier: GPL-2.0+ -* * Siano Mobile Silicon, Inc. * MDTV receiver kernel modules. * Copyright (C) 2006-2009, Uri Shkolnik
drivers/media/i2c/saa711x_regs.h +1 -1
@@ -1,5 +1,5 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ /* -* SPDX-License-Identifier: GPL-2.0+ * saa711x - Philips SAA711x video decoder register specifications * * Copyright (c) 2006 Mauro Carvalho Chehab <[email protected]>
drivers/media/i2c/tvp5150_reg.h +1 -2
@@ -1,6 +1,5 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* -* SPDX-License-Identifier: GPL-2.0 -* * tvp5150 - Texas Instruments TVP5150A/AM1 video decoder registers * * Copyright (c) 2005,2006 Mauro Carvalho Chehab <[email protected]>
drivers/media/pci/bt8xx/bttv-audio-hook.h +1 -2
@@ -1,6 +1,5 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* -* SPDX-License-Identifier: GPL-2.0 -* * Handlers for board audio hooks, split from bttv-cards * * Copyright (c) 2006 Mauro Carvalho Chehab <[email protected]>
drivers/media/platform/meson/ao-cec.c +1 -2
@@ -1,11 +1,10 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * Driver for Amlogic Meson AO CEC Controller * * Copyright (C) 2015 Amlogic, Inc. All rights reserved * Copyright (C) 2017 BayLibre, SAS * Author: Neil Armstrong <[email protected]> -* -* SPDX-License-Identifier: GPL-2.0+ */ #include <linux/bitfield.h>
drivers/media/rc/rc-core-priv.h +1 -1
@@ -1,5 +1,5 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* -* SPDX-License-Identifier: GPL-2.0 * Remote Controller core raw events header * * Copyright (C) 2010 by Mauro Carvalho Chehab
drivers/media/tuners/tuner-xc2028-types.h +1 -1
@@ -1,5 +1,5 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* -* SPDX-License-Identifier: GPL-2.0 * tuner-xc2028_types * * This file includes internal tipes to be used inside tuner-xc2028.
drivers/media/tuners/tuner-xc2028.h +1 -1
@@ -1,5 +1,5 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* -* SPDX-License-Identifier: GPL-2.0 * tuner-xc2028 * * Copyright (c) 2007-2008 Mauro Carvalho Chehab <[email protected]>
drivers/media/usb/tm6000/tm6000-regs.h +1 -1
@@ -1,5 +1,5 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* -* SPDX-License-Identifier: GPL-2.0 * tm6000-regs.h - driver for TM5600/TM6000/TM6010 USB video capture devices * * Copyright (c) 2006-2007 Mauro Carvalho Chehab <[email protected]>
drivers/media/usb/tm6000/tm6000-usb-isoc.h +1 -1
@@ -1,5 +1,5 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* -* SPDX-License-Identifier: GPL-2.0 * tm6000-buf.c - driver for TM5600/TM6000/TM6010 USB video capture devices * * Copyright (c) 2006-2007 Mauro Carvalho Chehab <[email protected]>
drivers/media/usb/tm6000/tm6000.h +1 -1
@@ -1,5 +1,5 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* -* SPDX-License-Identifier: GPL-2.0 * tm6000.h - driver for TM5600/TM6000/TM6010 USB video capture devices * * Copyright (c) 2006-2007 Mauro Carvalho Chehab <[email protected]>
drivers/pinctrl/meson/pinctrl-meson-axg-pmx.c +1 -2
@@ -1,3 +1,4 @@ +// SPDX-License-Identifier: (GPL-2.0+ or MIT) /* * Second generation of pinmux driver for Amlogic Meson-AXG SoC. *
@@ -6,8 +7,6 @@* * Copyright (c) 2017 Amlogic, Inc. All rights reserved. * Author: Xingyu Chen <[email protected]> -* -* SPDX-License-Identifier: (GPL-2.0+ or MIT) */ /*
drivers/pinctrl/meson/pinctrl-meson-axg-pmx.h +1 -2
@@ -1,11 +1,10 @@ +/* SPDX-License-Identifier: (GPL-2.0+ or MIT) */ /* * Copyright (c) 2017 Baylibre SAS. * Author: Jerome Brunet <[email protected]> * * Copyright (c) 2017 Amlogic, Inc. All rights reserved. * Author: Xingyu Chen <[email protected]> -* -* SPDX-License-Identifier: (GPL-2.0+ or MIT) */ struct meson_pmx_bank {
drivers/pinctrl/meson/pinctrl-meson-axg.c +1 -2
@@ -1,10 +1,9 @@ +// SPDX-License-Identifier: (GPL-2.0+ or MIT) /* * Pin controller and GPIO driver for Amlogic Meson AXG SoC. * * Copyright (c) 2017 Amlogic, Inc. All rights reserved. * Author: Xingyu Chen <[email protected]> -* -* SPDX-License-Identifier: (GPL-2.0+ or MIT) */ #include <dt-bindings/gpio/meson-axg-gpio.h>
drivers/rtc/rtc-rtd119x.c +1 -2
@@ -1,9 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * Realtek RTD129x RTC * * Copyright (c) 2017 Andreas Färber -* -* SPDX-License-Identifier: GPL-2.0+ */ #include <linux/clk.h>
drivers/rtc/rtc-sc27xx.c +1 -2
@@ -1,7 +1,6 @@ +// SPDX-License-Identifier: GPL-2.0 /* * Copyright (C) 2017 Spreadtrum Communications Inc. -* -* SPDX-License-Identifier: GPL-2.0 */ #include <linux/bitops.h>
drivers/soc/amlogic/meson-gx-pwrc-vpu.c +1 -2
@@ -1,8 +1,7 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * Copyright (c) 2017 BayLibre, SAS * Author: Neil Armstrong <[email protected]> -* -* SPDX-License-Identifier: GPL-2.0+ */ #include <linux/of_address.h>
drivers/soc/amlogic/meson-gx-socinfo.c +1 -2
@@ -1,8 +1,7 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * Copyright (c) 2017 BayLibre, SAS * Author: Neil Armstrong <[email protected]> -* -* SPDX-License-Identifier: GPL-2.0+ */ #include <linux/io.h>
drivers/soc/amlogic/meson-mx-socinfo.c +1 -2
@@ -1,7 +1,6 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * Copyright (c) 2017 Martin Blumenstingl <[email protected]> -* -* SPDX-License-Identifier: GPL-2.0+ */ #include <linux/io.h>
drivers/spi/spi-meson-spicc.c +1 -2
@@ -1,10 +1,9 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * Driver for Amlogic Meson SPI communication controller (SPICC) * * Copyright (C) BayLibre, SAS * Author: Neil Armstrong <[email protected]> -* -* SPDX-License-Identifier: GPL-2.0+ */ #include <linux/bitfield.h>
drivers/spi/spi-sprd-adi.c +1 -2
@@ -1,7 +1,6 @@ +// SPDX-License-Identifier: GPL-2.0 /* * Copyright (C) 2017 Spreadtrum Communications Inc. -* -* SPDX-License-Identifier: GPL-2.0 */ #include <linux/delay.h>
drivers/watchdog/rtd119x_wdt.c +1 -2
@@ -1,9 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * Realtek RTD129x watchdog * * Copyright (c) 2017 Andreas Färber -* -* SPDX-License-Identifier: GPL-2.0+ */ #include <linux/bitops.h>
include/acpi/nfit.h +1 -1
@@ -1,5 +1,5 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* -* SPDX-License-Identifier: GPL-2.0 * Copyright (C) 2018 Intel Corporation */
include/dt-bindings/clock/sun8i-de2.h +1 -2
@@ -1,7 +1,6 @@ +/* SPDX-License-Identifier: (GPL-2.0+ OR MIT) */ /* * Copyright (C) 2016 Icenowy Zheng <[email protected]> -* -* SPDX-License-Identifier: (GPL-2.0+ OR MIT) */ #ifndef _DT_BINDINGS_CLOCK_SUN8I_DE2_H_
include/dt-bindings/gpio/meson-axg-gpio.h +1 -2
@@ -1,8 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ /* * Copyright (c) 2017 Amlogic, Inc. All rights reserved. * Author: Xingyu Chen <[email protected]> -* -* SPDX-License-Identifier: GPL-2.0+ */ #ifndef _DT_BINDINGS_MESON_AXG_GPIO_H
include/dt-bindings/power/owl-s500-powergate.h +1 -2
@@ -1,7 +1,6 @@ +/* SPDX-License-Identifier: (GPL-2.0+ OR MIT) */ /* * Copyright (c) 2017 Andreas Färber -* -* SPDX-License-Identifier: (GPL-2.0+ OR MIT) */ #ifndef DT_BINDINGS_POWER_OWL_S500_POWERGATE_H #define DT_BINDINGS_POWER_OWL_S500_POWERGATE_H
include/dt-bindings/reset/amlogic,meson8b-clkc-reset.h +1 -2
@@ -1,7 +1,6 @@ +/* SPDX-License-Identifier: (GPL-2.0+ OR MIT) */ /* * Copyright (c) 2017 Martin Blumenstingl <[email protected]>. -* -* SPDX-License-Identifier: (GPL-2.0+ OR MIT) */ #ifndef _DT_BINDINGS_AMLOGIC_MESON8B_CLKC_RESET_H
include/dt-bindings/reset/sun8i-de2.h +1 -2
@@ -1,7 +1,6 @@ +/* SPDX-License-Identifier: (GPL-2.0+ OR MIT) */ /* * Copyright (C) 2016 Icenowy Zheng <[email protected]> -* -* SPDX-License-Identifier: (GPL-2.0+ OR MIT) */ #ifndef _DT_BINDINGS_RESET_SUN8I_DE2_H_
include/linux/ascii85.h +1 -2
@@ -1,6 +1,5 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* -* SPDX-License-Identifier: GPL-2.0 -* * Copyright (c) 2008 Intel Corporation * Copyright (c) 2018 The Linux Foundation. All rights reserved. */
include/linux/soc/actions/owl-sps.h +1 -2
@@ -1,7 +1,6 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ /* * Copyright (c) 2017 Andreas Färber -* -* SPDX-License-Identifier: GPL-2.0+ */ #ifndef SOC_ACTIONS_OWL_SPS_H #define SOC_ACTIONS_OWL_SPS_H
include/media/dvb_vb2.h +1 -2
@@ -1,6 +1,5 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* -* SPDX-License-Identifier: GPL-2.0 -* * dvb-vb2.h - DVB driver helper framework for streaming I/O * * Copyright (C) 2015 Samsung Electronics
tools/perf/util/cs-etm-decoder/cs-etm-decoder.h +1 -2
@@ -1,6 +1,5 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* -* SPDX-License-Identifier: GPL-2.0 -* * Copyright(C) 2015-2018 Linaro Limited. * * Author: Tor Jeremiassen <[email protected]>
tools/perf/util/rlimit.h +1 -1
@@ -1,6 +1,6 @@ +/* SPDX-License-Identifier: LGPL-2.1 */ #ifndef __PERF_RLIMIT_H_#define __PERF_RLIMIT_H_ -/* SPDX-License-Identifier: LGPL-2.1 */ void rlimit__bump_memlock (void );#endif // __PERF_RLIMIT_H_
Re: [PATCH] docs: license-rules.txt: cover SPDX headers on Python scripts
Em Thu, 05 Sep 2019 10:45:36 -0700
Joe Perches <[email protected]> escreveu:
Quoted 52 lines · Mauro Carvalho Chehab
Quoted 11 lines
There are currently 227 files that don't complain with the "up to line 3" rule, including COPYING (with should probably be excluded from the check).
Patches are at:
https://git.linuxtv.org/mchehab/experimental.git/log/?h=spdx_pedantic
Btw, most violations are due to:
/*
* SPDX...Hey Mauro.
Here's a little script to move all of the improperly located SPDX-License-Identifier lines in [.ch] files.
Using this command line:
$ git grep -n 'SPDX-License-Identifier: ' -- '*.[ch]' | \ grep -v ':1:' | perl move_spdx.pland
$ cat move_spdx.pl while (<>) { /^([^:]+):([^:]+):(.*)/; my ($file, $line, $spdx) = ($1, $2, $3); $spdx =~ s/^\s*\/?\*\s*//; $spdx =~ s/\s*\*\/\s*$//; if ($file =~ /\.h$/) { $spdx = "/* $spdx */"; } else { $spdx = "// $spdx"; } open(FH, '<', $file) or die $!; my @lines = <FH>; close FH; open(FH, '>', $file) or die $!; print FH "$spdx\n"; my $count = 0; foreach (@lines) { $count++; next if ($count == $line); next if ($count == $line - 1 && $_ =~ /^\s*\*\s*$/); next if ($count == $line + 1 && $_ =~ /^\s*\*\s*$/); print FH "$_"; } close FH; }
Quoted 1 line
which gives this diff for today's -next
Nice script!
I did some changes on it, plus one change at the pedantic mode of scripts/spdxcheck.py, and placed the corresponding patches at:
https://git.linuxtv.org/mchehab/experimental.git/log/?h=spdx_pedantic
With that, we now have (next-20190904):
Warning: SPDX header for file Documentation/networking/caif/caif.rst is at line 2
Warning: SPDX header for file Documentation/networking/mac80211_hwsim/mac80211_hwsim.rst is at line 2
Warning: SPDX header for file tools/thermal/tmon/tmon.8 is at line 2
The first two are due to a ":orphan:" tag at the RST files. IMO, it makes sense to have this at the very beginning of the files with weren't added yet at the documentation body. Having them generating a warning is a plus.
The last one is interesting... what's the "very first line" where a SPDX header tag should be on a man page?
Thanks,
Mauro
Re: [PATCH] docs: license-rules.txt: cover SPDX headers on Python scripts
Em Fri, 6 Sep 2019 08:34:57 -0300
Mauro Carvalho Chehab <[email protected]> escreveu:
Quoted 55 lines
Em Thu, 05 Sep 2019 10:45:36 -0700
Joe Perches <[email protected]> escreveu:Quoted 52 lines · Mauro Carvalho Chehab
Quoted 11 lines
There are currently 227 files that don't complain with the "up to line 3" rule, including COPYING (with should probably be excluded from the check).
Patches are at:
https://git.linuxtv.org/mchehab/experimental.git/log/?h=spdx_pedantic
Btw, most violations are due to:
/*
* SPDX...Hey Mauro.
Here's a little script to move all of the improperly located SPDX-License-Identifier lines in [.ch] files.
Using this command line:
$ git grep -n 'SPDX-License-Identifier: ' -- '*.[ch]' | \ grep -v ':1:' | perl move_spdx.pland
$ cat move_spdx.pl while (<>) { /^([^:]+):([^:]+):(.*)/; my ($file, $line, $spdx) = ($1, $2, $3); $spdx =~ s/^\s*\/?\*\s*//; $spdx =~ s/\s*\*\/\s*$//; if ($file =~ /\.h$/) { $spdx = "/* $spdx */"; } else { $spdx = "// $spdx"; } open(FH, '<', $file) or die $!; my @lines = <FH>; close FH; open(FH, '>', $file) or die $!; print FH "$spdx\n"; my $count = 0; foreach (@lines) { $count++; next if ($count == $line); next if ($count == $line - 1 && $_ =~ /^\s*\*\s*$/); next if ($count == $line + 1 && $_ =~ /^\s*\*\s*$/); print FH "$_"; } close FH; }
Quoted 5 lines
Quoted 1 line
which gives this diff for today's -next
Nice script!
I did some changes on it
In time: I'm enclosing the modified script. just run it directly with:
perl ./move_spdx.pl
and it will move the SPDX headers where pertinent.
Thanks,
Mauro
---
#!/usr/bin/perl
@file_arr = qx(git grep -n 'SPDX-License-Identifier: ' | grep -v ':1:');
foreach (@file_arr) {
/^([^:]+):([^:]+):(.*)/;
my ($file, $line, $spdx) = ($1, $2, $3);
next if ($file =~ m,(COPYING|LICENSES/|sha1-armv4-large.S),);
next if ($line > 10);
$spdx =~ s/^\s*\/?\*\s*//;
$spdx =~ s/\s*\*\/\s*$//;
$spdx = $1 if m/(SPDX-License-Identifier:.*)/;
$is_script = 0;
if ($file =~ /\.(h|dts|dtsi|S)$/) {
$spdx = "/* $spdx */";
} elsif ($file =~ /\.(c)$/) {
$spdx = "// $spdx";
} elsif ($file =~ /\.(rst)$/) {
$spdx = ".. $spdx";
} elsif ($file =~ /\.(py|pl|sh)$/ || !$file =~ /\./) {
$is_script = 1;
$spdx = "# $spdx";
} else {
next;
}
open(FH, '<', $file) or die $!;
my @lines = <FH>;
close FH;
open(FH, '>', $file) or die $!;
my $count = 0;
my $print_spdx = 1;
foreach (@lines) {
$count++;
if ($print_spdx) {
if ($count == 1 && (/:orphan:/ || /^#\!/)) {
print FH "$_";
next;
}
if ($count <= 2 && /^[ \t\f]*#.*?coding[:=][ \t]*([-_.a-zA-Z0-9]+)/) {
print FH "$_";
next;
}
print FH "$spdx\n";
$print_spdx = 0;
}
next if ($count == $line);
next if ($count == $line - 1 && $_ =~ /^\s*\*\s*$/);
next if ($count == $line + 1 && $_ =~ /^\s*\*\s*$/);
next if ($count == $line - 1 && $_ =~ /^$/);
print FH "$_";
}
close FH;
}Re: [PATCH] docs: license-rules.txt: cover SPDX headers on Python scripts
In reply to Mauro Carvalho ChehabQuoted 4 lines · Mauro Carvalho Chehab
I did some changes on it, plus one change at the pedantic mode of
scripts/spdxcheck.py, and placed the corresponding patches at:https://git.linuxtv.org/mchehab/experimental.git/log/?h=spdx_pedantic
Overall seems very nice, thanks.
Couple nits.
Some of the scripts and py files move the author
block into a description or add unnecessary blank
comments. These may use some manual fixups.
For instance:
tools/perf/tests/shell/record+probe_libc_inet_pton.sh +1 -2
@@ -1,4 +1,5 @@ #!/bin/sh +# SPDX-License-Identifier: GPL-2.0 # probe libc's inet_pton & backtrace it with ping # Installs a probe on libc's inet_pton function, that will use uprobes,
@@ -6,8 +7,6 @@ # with the a backtrace 3 levels deep, check that it is what we expect. # This needs no debuginfo package, all is done using the libc ELF symtab # and the CFI info in the binaries. - -# SPDX-License-Identifier: GPL-2.0 # Arnaldo Carvalho de Melo <[email protected]>, 2017 . $(dirname $0)/lib/probe.sh
and
tools/testing/selftests/bpf/tcp_client.py +1 -1
@@ -1,7 +1,7 @@ #!/usr/bin/env python3 -# # SPDX-License-Identifier: GPL-2.0 # +#
Quoted 2 lines
what's the "very first line" where a
SPDX header tag should be on a man page?
Beats me.
This says man pages are documents,
https://spdx.org/rdf/ontology/spdx-2-0-rev-7/individuals/usageType_document___85292652.html
Re: [PATCH] docs: license-rules.txt: cover SPDX headers on Python scripts
Em Fri, 06 Sep 2019 05:20:30 -0700
Joe Perches <[email protected]> escreveu:
Quoted 6 lines · Mauro Carvalho Chehab
Quoted 4 lines
I did some changes on it, plus one change at the pedantic mode of
scripts/spdxcheck.py, and placed the corresponding patches at:https://git.linuxtv.org/mchehab/experimental.git/log/?h=spdx_pedantic
Quoted 7 lines
Overall seems very nice, thanks.
Couple nits.
Some of the scripts and py files move the author
block into a description or add unnecessary blank
comments. These may use some manual fixups.
True. I noticed that too. I suspect that fixing this automatically would make the script too complex.
Anyway, the point is: who will apply it? Linus? Each maintainer?
I can apply it to the media subsystem (after applying the patches I have already doing the same), but I don't intend myself to apply it to the other subsystems.
Quoted 8 lines
Quoted 2 lines
what's the "very first line" where a
SPDX header tag should be on a man page?Beats me.
This says man pages are documents,
https://spdx.org/rdf/ontology/spdx-2-0-rev-7/individuals/usageType_document___85292652.html
Yes. I mean, I suspect that a troff file should have a ".TH" at its first line. So, SPDX header should start at the second line.
Thanks,
Mauro
Re: [PATCH] docs: license-rules.txt: cover SPDX headers on Python scripts
Quoted 13 lines · Mauro Carvalho Chehab
Em Fri, 06 Sep 2019 05:20:30 -0700
Joe Perches <[email protected]> escreveu:Quoted 10 lines · Mauro Carvalho Chehab
Quoted 4 lines
I did some changes on it, plus one change at the pedantic mode of
scripts/spdxcheck.py, and placed the corresponding patches at:https://git.linuxtv.org/mchehab/experimental.git/log/?h=spdx_pedantic
Overall seems very nice, thanks.
Couple nits.
Quoted 8 lines
Quoted 3 lines
Some of the scripts and py files move the author
block into a description or add unnecessary blank
comments. These may use some manual fixups.True. I noticed that too. I suspect that fixing this automatically would make the script too complex.
Anyway, the point is: who will apply it? Linus? Each maintainer?
I have been advocating for a treewide scripted mechanism for awhile.
https://lore.kernel.org/lkml/[email protected]/
Re: [PATCH] docs: license-rules.txt: cover SPDX headers on Python scripts
In reply to Mauro Carvalho ChehabQuoted 4 lines · Mauro Carvalho Chehab
I did some changes on it, plus one change at the pedantic mode of
scripts/spdxcheck.py, and placed the corresponding patches at:https://git.linuxtv.org/mchehab/experimental.git/log/?h=spdx_pedantic
Your script needs a modification of this line:
$spdx = $1 if m/(SPDX-License-Identifier:.*)/;
This is on $_ and not $spdx.
This line needs to be:
$spdx = $1 if $spdx =~ m/(SPDX-License-Identifier:.*)/;
Otherwise the script produces:
---
tools/perf/util/rlimit.h +1 -1
@@ -1,6 +1,6 @@ +/* SPDX-License-Identifier: LGPL-2.1 */ */#ifndef __PERF_RLIMIT_H_#define __PERF_RLIMIT_H_ -/* SPDX-License-Identifier: LGPL-2.1 */ void rlimit__bump_memlock (void );#endif // __PERF_RLIMIT_H_
Re: [PATCH] docs: license-rules.txt: cover SPDX headers on Python scripts
Em Fri, 06 Sep 2019 10:33:42 -0700
Joe Perches <[email protected]> escreveu:
Quoted 7 lines · Mauro Carvalho Chehab
Quoted 4 lines
I did some changes on it, plus one change at the pedantic mode of
scripts/spdxcheck.py, and placed the corresponding patches at:https://git.linuxtv.org/mchehab/experimental.git/log/?h=spdx_pedantic
Your script needs a modification of this line:
It is yours script, I just made a few improvements for it to also catch scripts.
Quoted 7 lines
$spdx = $1 if m/(SPDX-License-Identifier:.*)/;This is on $_ and not $spdx.
This line needs to be:
$spdx = $1 if $spdx =~ m/(SPDX-License-Identifier:.*)/;
Gah, true!
It also doesn't get the case where SPDX-License-Identifier: is followed by a tab, and fixed an issue when detecting files without any extension.
The enclosed script does a better job.
I changed the output of it on my testing branch:
https://git.linuxtv.org/mchehab/experimental.git/log/?h=spdx_pedantic
The only thing that it doesn't change is an issue with an asm code, with uses "@" for comments.
As this is a single file, better to do it manually:
https://git.linuxtv.org/mchehab/experimental.git/commit/?h=spdx_pedantic&id=f1b7b2169ae2c8d8ab80a5997ebef9aa03a42d30
Thanks,
Mauro
---
#!/usr/bin/perl
@file_arr = qx(git grep -nE 'SPDX-License-Identifier:\\s' | grep -v ':1:');
foreach (@file_arr) {
/^([^:]+):([^:]+):(.*)/;
my ($file, $line, $spdx) = ($1, $2, $3);
next if ($file =~ m,(COPYING|LICENSES/|sha1-armv4-large.S),);
next if ($line > 10);
$spdx =~ s/^\s*\/?\*\s*//;
$spdx =~ s/\s*\*\/\s*$//;
$spdx = $1 if $spdx =~ m/(SPDX-License-Identifier:.*)/;
$spdx =~ s/(SPDX-License-Identifier:)\s+/$1 /;
if ($file =~ /\.(h|dts|dtsi|S)$/) {
$spdx = "/* $spdx */";
} elsif ($file =~ /\.(c)$/) {
$spdx = "// $spdx";
} elsif ($file =~ /\.(rst)$/) {
$spdx = ".. $spdx";
} elsif ($file =~ /\.(py|pl|sh|tc)$/ || !($file =~ /\./)) {
$spdx = "# $spdx";
} else {
next;
}
open(FH, '<', $file) or die $!;
my @lines = <FH>;
close FH;
open(FH, '>', $file) or die $!;
my $count = 0;
my $print_spdx = 1;
foreach (@lines) {
$count++;
if ($print_spdx) {
if ($count == 1 && (/:orphan:/ || /^#\!/)) {
print FH "$_";
next;
}
if ($count <= 2 && /^[ \t\f]*#.*?coding[:=][ \t]*([-_.a-zA-Z0-9]+)/) {
print FH "$_";
next;
}
print FH "$spdx\n";
$print_spdx = 0;
}
next if ($count == $line);
next if ($count == $line - 1 && $_ =~ /^\s*\*\s*$/);
next if ($count == $line + 1 && $_ =~ /^\s*\*\s*$/);
next if ($count == $line - 1 && $_ =~ /^$/);
print FH "$_";
}
close FH;
}Re: [PATCH] docs: license-rules.txt: cover SPDX headers on Python scripts
Quoted 7 lines · Mauro Carvalho Chehab
Em Fri, 06 Sep 2019 10:33:42 -0700
Joe Perches <[email protected]> escreveu:Quoted 4 lines · Mauro Carvalho Chehab
Quoted 3 lines
I did some changes on it, plus one change at the pedantic mode of
scripts/spdxcheck.py, and placed the corresponding patches at:
Quoted 6 lines
Quoted 3 lines
Your script needs a modification of this line:
It is yours script, I just made a few improvements for it to also catch scripts.
Not really, my script worked only on .[ch] files to avoid making the script more complicated and more prone to the inevitable unintended defect which I manage to introduce more often than I should.
btw:
I already submitted a separate patch for the arm/arm64 .dts and .dtsi files.
https://lore.kernel.org/linux-arm-kernel/[email protected]/
cheers, Joe
RFC PATCH 1/1 tools: Add SPDX license to man pages
In reply to Mauro Carvalho ChehabQuoted 1 line · Mauro Carvalho Chehab
Warning: SPDX header for file
tools/thermal/tmon/tmon.8is at line 2
[]
Quoted 2 lines
The last one is interesting... what's the "very first line" where a SPDX header tag should be on a man page?
just fyi:
It looks like .man pages could use a comment form
using '.\"' like this example on the first line:
$ head -5 tools/power/x86/x86_energy_perf_policy/x86_energy_perf_policy.8 .\" This page Copyright (C) 2010 - 2015 Len Brown <[email protected]> .\" Distributed under the GPL, Copyleft 1994. .TH X86_ENERGY_PERF_POLICY 8 .SH NAME x86_energy_perf_policy \- Manage Energy vs. Performance Policy via x86 Model Specific Registers
So maybe:
--- tools/power/acpi/man/acpidump.8 | 1 + tools/power/cpupower/man/cpupower-frequency-info.1 | 1 + tools/power/cpupower/man/cpupower-frequency-set.1 | 1 + tools/power/cpupower/man/cpupower-idle-info.1 | 1 + tools/power/cpupower/man/cpupower-idle-set.1 | 1 + tools/power/cpupower/man/cpupower-info.1 | 1 + tools/power/cpupower/man/cpupower-monitor.1 | 1 + tools/power/cpupower/man/cpupower-set.1 | 1 + tools/power/cpupower/man/cpupower.1 | 1 + tools/power/pm-graph/bootgraph.8 | 1 + tools/power/pm-graph/sleepgraph.8 | 1 + tools/power/x86/turbostat/turbostat.8 | 1 + tools/power/x86/x86_energy_perf_policy/x86_energy_perf_policy.8 | 1 + tools/thermal/tmon/tmon.8 | 1 + tools/usb/usbip/doc/usbip.8 | 1 + tools/usb/usbip/doc/usbipd.8 | 1 + 16 files changed, 16 insertions(+)
tools/power/acpi/man/acpidump.8 +1 -0
@@ -1,3 +1,4 @@ +.\" SPDX-License-Identifier: GPL-2.0-only .TH ACPIDUMP 8 .SH NAME acpidump \- dump a system's ACPI tables to an ASCII file
tools/power/cpupower/man/cpupower-frequency-info.1 +1 -0
@@ -1,3 +1,4 @@ +.\" SPDX-License-Identifier: GPL-2.0-only .TH "CPUPOWER\-FREQUENCY\-INFO" "1" "0.1" "" "cpupower Manual" .SH "NAME" .LP
tools/power/cpupower/man/cpupower-frequency-set.1 +1 -0
@@ -1,3 +1,4 @@ +.\" SPDX-License-Identifier: GPL-2.0-only .TH "CPUPOWER\-FREQUENCY\-SET" "1" "0.1" "" "cpupower Manual" .SH "NAME" .LP
tools/power/cpupower/man/cpupower-idle-info.1 +1 -0
@@ -1,3 +1,4 @@ +.\" SPDX-License-Identifier: GPL-2.0-only .TH "CPUPOWER-IDLE-INFO" "1" "0.1" "" "cpupower Manual" .SH "NAME" .LP
tools/power/cpupower/man/cpupower-idle-set.1 +1 -0
@@ -1,3 +1,4 @@ +.\" SPDX-License-Identifier: GPL-2.0-only .TH "CPUPOWER-IDLE-SET" "1" "0.1" "" "cpupower Manual" .SH "NAME" .LP
tools/power/cpupower/man/cpupower-info.1 +1 -0
@@ -1,3 +1,4 @@ +.\" SPDX-License-Identifier: GPL-2.0-only .TH CPUPOWER\-INFO "1" "22/02/2011" "" "cpupower Manual" .SH NAME cpupower\-info \- Shows processor power related kernel or hardware configurations
tools/power/cpupower/man/cpupower-monitor.1 +1 -0
@@ -1,3 +1,4 @@ +.\" SPDX-License-Identifier: GPL-2.0-only .TH CPUPOWER\-MONITOR "1" "22/02/2011" "" "cpupower Manual" .SH NAME cpupower\-monitor \- Report processor frequency and idle statistics
tools/power/cpupower/man/cpupower-set.1 +1 -0
@@ -1,3 +1,4 @@ +.\" SPDX-License-Identifier: GPL-2.0-only .TH CPUPOWER\-SET "1" "22/02/2011" "" "cpupower Manual" .SH NAME cpupower\-set \- Set processor power related kernel or hardware configurations
tools/power/cpupower/man/cpupower.1 +1 -0
@@ -1,3 +1,4 @@ +.\" SPDX-License-Identifier: GPL-2.0-only .TH CPUPOWER "1" "07/03/2011" "" "cpupower Manual" .SH NAME cpupower \- Shows and sets processor power related values
tools/power/pm-graph/bootgraph.8 +1 -0
@@ -1,3 +1,4 @@ +.\" SPDX-License-Identifier: GPL-2.0-only .TH BOOTGRAPH 8 .SH NAME bootgraph \- Kernel boot timing analysis
tools/power/pm-graph/sleepgraph.8 +1 -0
@@ -1,3 +1,4 @@ +.\" SPDX-License-Identifier: GPL-2.0-only .TH SLEEPGRAPH 8 .SH NAME sleepgraph \- Suspend/Resume timing analysis
tools/power/x86/turbostat/turbostat.8 +1 -0
@@ -1,3 +1,4 @@ +.\" SPDX-License-Identifier: GPL-2.0-only .TH TURBOSTAT 8 .SH NAME turbostat \- Report processor frequency and idle statistics
tools/power/x86/x86_energy_perf_policy/x86_energy_perf_policy.8 +1 -0
@@ -1,3 +1,4 @@ +.\" SPDX-License-Identifier: GPL-2.0-only .\" This page Copyright (C) 2010 - 2015 Len Brown <[email protected]> .\" Distributed under the GPL, Copyleft 1994. .TH X86_ENERGY_PERF_POLICY 8
tools/thermal/tmon/tmon.8 +1 -0
@@ -1,3 +1,4 @@ +.\" SPDX-License-Identifier: GPL-2.0-only .TH TMON 8 # SPDX-License-Identifier: GPL-2.0 .SH NAME
tools/usb/usbip/doc/usbip.8 +1 -0
@@ -1,3 +1,4 @@ +.\" SPDX-License-Identifier: GPL-2.0-only .TH USBIP "8" "February 2009" "usbip" "System Administration Utilities" .SH NAME usbip \- manage USB/IP devices
tools/usb/usbip/doc/usbipd.8 +1 -0
@@ -1,3 +1,4 @@ +.\" SPDX-License-Identifier: GPL-2.0-only .TH USBIP "8" "February 2009" "usbip" "System Administration Utilities" .SH NAME usbipd \- USB/IP server daemon
Re: [RFC PATCH] tools: Add SPDX license to man pages
Em Fri, 06 Sep 2019 11:12:58 -0700
Joe Perches <[email protected]> escreveu:
Quoted 29 lines · Mauro Carvalho Chehab
Quoted 1 line
Warning: SPDX header for file
tools/thermal/tmon/tmon.8is at line 2[]
Quoted 2 lines
The last one is interesting... what's the "very first line" where a SPDX header tag should be on a man page?
just fyi:
It looks like .man pages could use a comment form
using '.\"' like this example on the first line:$ head -5 tools/power/x86/x86_energy_perf_policy/x86_energy_perf_policy.8 .\" This page Copyright (C) 2010 - 2015 Len Brown <[email protected]> .\" Distributed under the GPL, Copyleft 1994. .TH X86_ENERGY_PERF_POLICY 8 .SH NAME x86_energy_perf_policy \- Manage Energy vs. Performance Policy via x86 Model Specific RegistersSo maybe:
--- tools/power/acpi/man/acpidump.8 | 1 + tools/power/cpupower/man/cpupower-frequency-info.1 | 1 + tools/power/cpupower/man/cpupower-frequency-set.1 | 1 + tools/power/cpupower/man/cpupower-idle-info.1 | 1 + tools/power/cpupower/man/cpupower-idle-set.1 | 1 + tools/power/cpupower/man/cpupower-info.1 | 1 + tools/power/cpupower/man/cpupower-monitor.1 | 1 + tools/power/cpupower/man/cpupower-set.1 | 1 + tools/power/cpupower/man/cpupower.1 | 1 +
Quoted 8 lines
tools/power/pm-graph/bootgraph.8 | 1 + tools/power/pm-graph/sleepgraph.8 | 1 + tools/power/x86/turbostat/turbostat.8 | 1 + tools/power/x86/x86_energy_perf_policy/x86_energy_perf_policy.8 | 1 + tools/thermal/tmon/tmon.8 | 1 + tools/usb/usbip/doc/usbip.8 | 1 + tools/usb/usbip/doc/usbipd.8 | 1 + 16 files changed, 16 insertions(+)
Makes sense. I would also patch license-rules.txt with something like:
Documentation/process/license-rules.rst +7 -6
@@ -76,12 +76,13 @@ License identifier syntax The SPDX license identifier is added in form of a comment. The comment style depends on the file type:: - C source: // SPDX-License-Identifier: <SPDX License Expression> - C header: /* SPDX-License-Identifier: <SPDX License Expression> */ - ASM: /* SPDX-License-Identifier: <SPDX License Expression> */ - scripts: # SPDX-License-Identifier: <SPDX License Expression> - .rst: .. SPDX-License-Identifier: <SPDX License Expression> - .dts{i}: // SPDX-License-Identifier: <SPDX License Expression> + C source: // SPDX-License-Identifier: <SPDX License Expression> + C header: /* SPDX-License-Identifier: <SPDX License Expression> */ + ASM: /* SPDX-License-Identifier: <SPDX License Expression> */ + scripts: # SPDX-License-Identifier: <SPDX License Expression> + .rst: .. SPDX-License-Identifier: <SPDX License Expression> + .dts{i}: // SPDX-License-Identifier: <SPDX License Expression> + man pages: .\" SPDX-License-Identifier: <SPDX License Expression> If a specific tool cannot handle the standard comment style, then the appropriate comment mechanism which the tool accepts shall be used. This
tools/thermal/tmon/tmon.8 line 4
Quoted 9 lines
tools/thermal/tmon/tmon.8 +1
-0@@ -1,3 +1,4 @@ +.\" SPDX-License-Identifier: GPL-2.0-only .TH TMON 8 # SPDX-License-Identifier: GPL-2.0 .SH NAME
Hmm... here, you should probably keep the same license as defined at the existing tag (GPL-2.0) and remove the comment one.
Thanks,
Mauro
Jonathan Corbet
maintainerRe: [PATCH] docs: license-rules.txt: cover SPDX headers on Python scripts
In reply to Mauro Carvalho ChehabQuoted 8 lines · On Thu, 5 Sep 2019 06:23:13 -0300 Mauro Carvalho Chehab…
Python's PEP-263 [1] dictates that an script that needs to default to UTF-8 encoding has to follow this rule:
'Python will default to ASCII as standard encoding if no other
encoding hints are given.To define a source code encoding, a magic comment must be placed into the source files either as first or second line in the file'
So this is only Python 2, right? Python 3 is UTF8 by default. Given that Python 2 is EOL in January, is this something we should be concerned about? Or should we instead be making sure that all the Python we have in-tree works properly with Python 3 and be done with it?
Thanks,
jon
Greg Kroah-Hartman
maintainerRe: [PATCH] docs: license-rules.txt: cover SPDX headers on Python scripts
Quoted 9 lines · Jonathan Corbet
Quoted 6 lines · On Thu, 5 Sep 2019 06:23:13 -0300 Mauro Carvalho Chehab…
Python's PEP-263 [1] dictates that an script that needs to default to UTF-8 encoding has to follow this rule:
'Python will default to ASCII as standard encoding if no other
encoding hints are given.
Quoted 7 lines
Quoted 2 lines
To define a source code encoding, a magic comment must be placed into the source files either as first or second line in the file'
So this is only Python 2, right? Python 3 is UTF8 by default. Given that Python 2 is EOL in January, is this something we should be concerned about? Or should we instead be making sure that all the Python we have in-tree works properly with Python 3 and be done with it?
I recommend just using python 3 everywhere and be done with it as there are already many distros that default to that already.
thanks,
greg k-h
Re: [PATCH] docs: license-rules.txt: cover SPDX headers on Python scripts
Em Thu, 5 Sep 2019 16:17:23 +0200
Greg Kroah-Hartman <[email protected]> escreveu:
Quoted 7 lines · Jonathan Corbet
Quoted 6 lines
Quoted 3 lines · On Thu, 5 Sep 2019 06:23:13 -0300 Mauro Carvalho Chehab…
Python's PEP-263 [1] dictates that an script that needs to default to UTF-8 encoding has to follow this rule:
Quoted 7 lines
Quoted 7 lines
Quoted 5 lines
'Python will default to ASCII as standard encoding if no other
encoding hints are given.To define a source code encoding, a magic comment must be placed into the source files either as first or second line in the file'
So this is only Python 2, right?
Well, Debian 10 (buster) was launched this year, and still comes with python2 (with is the default):
$ ls -la /usr/bin/python lrwxrwxrwx 1 root root 7 Mar 4 2019 /usr/bin/python -> python2
I think Debian devs will keep it maintained for a while, as this is a LTS distro.
Quoted 7 lines
Quoted 4 lines
Python 3 is UTF8 by default. Given that
Python 2 is EOL in January, is this something we should be concerned about? Or should we instead be making sure that all the Python we have in-tree works properly with Python 3 and be done with it?I recommend just using python 3 everywhere and be done with it as there are already many distros that default to that already.
Then we need to change the scripts, as they're currently pointing to /usr/bin/python instead of /usr/bin/python3. At least on the distros I use myself, this doesn't point to /etc/alternates. Instead, it is just an alias to python2.
Thanks,
Mauro
Re: [PATCH] docs: license-rules.txt: cover SPDX headers on Python scripts
In reply to Greg Kroah-HartmanAm 05.09.19 um 16:17 schrieb Greg Kroah-Hartman:
Quoted 13 lines · Jonathan Corbet
Quoted 12 lines
Quoted 8 lines · On Thu, 5 Sep 2019 06:23:13 -0300 Mauro Carvalho Chehab…
Python's PEP-263 [1] dictates that an script that needs to default to UTF-8 encoding has to follow this rule:
'Python will default to ASCII as standard encoding if no other
encoding hints are given.To define a source code encoding, a magic comment must be placed into the source files either as first or second line in the file'
Quoted 7 lines
Quoted 4 lines
So this is only Python 2, right? Python 3 is UTF8 by default. Given that Python 2 is EOL in January, is this something we should be concerned about? Or should we instead be making sure that all the Python we have in-tree works properly with Python 3 and be done with it?
I recommend just using python 3 everywhere and be done with it as there are already many distros that default to that already.
As far as I know: many distros have installed py3 and py2 interpreter by default. Mostly for internal purpose the distros use the py3 but the 'python' command is default binded to a py2 interpreter.
About Linux distros and python2 & python3 read:
https://www.python.org/dev/peps/pep-0394/
In short: command 'python' mostly refers to py2 interpreters as long as py2 is supported, later the distros will remove the python2 stack. So it depends on the distro and your alternatives(8) setup. The common rules for distros are:
https://www.python.org/dev/peps/pep-0394/#for-python-runtime-distributors
and what debian says:
https://debian-python.readthedocs.io/en/latest/debian-policy.html#versions
IMO we can't predict what the python command will call py2 or py3 interpreter. And we scould not fergett that not all (build hosts) are using up to date
At least I have to say that it is always recommended to use a virtualenv build up using requirements.txt and option
May we can and add option "-p python3" to:
https://www.kernel.org/doc/html/latest/doc-guide/sphinx.html?highlight=virtualenv#sphinx-install
$ virtualenv -p python3 sphinx_1.7.9 $ . sphinx_1.7.9/bin/activate (sphinx_1.7.9) $ pip install -r Documentation/sphinx/requirements.txt
BTW: I always recomend to use (support) up-to-date py-packages, but we had this discussion already.
-- Markus --
Re: [PATCH] docs: license-rules.txt: cover SPDX headers on Python scripts
In reply to Jonathan CorbetEm Thu, 5 Sep 2019 06:57:01 -0600
Jonathan Corbet <[email protected]> escreveu:
Quoted 9 lines
Quoted 6 lines · On Thu, 5 Sep 2019 06:23:13 -0300 Mauro Carvalho Chehab…
Python's PEP-263 [1] dictates that an script that needs to default to UTF-8 encoding has to follow this rule:
'Python will default to ASCII as standard encoding if no other
encoding hints are given.
Quoted 7 lines
Quoted 2 lines
To define a source code encoding, a magic comment must be placed into the source files either as first or second line in the file'
So this is only Python 2, right? Python 3 is UTF8 by default. Given that Python 2 is EOL in January, is this something we should be concerned about? Or should we instead be making sure that all the Python we have in-tree works properly with Python 3 and be done with it?
I don't think we can count that python 3 uses utf-8 per default.
I strongly suspect that, if one uses a Python3 version < 3.7, it will still default to ASCII.
On a quick look, the new UTF-8 mode was added on PEP-540:
https://www.python.org/dev/peps/pep-0540/
Such change happened at Python 3.7.
Yet, according with PEP, it defaults to off, unless when using POSIX locale.
Thanks,
Mauro
Jonathan Corbet
maintainerRe: [PATCH] docs: license-rules.txt: cover SPDX headers on Python scripts
Quoted 10 lines · On Thu, 5 Sep 2019 16:28:10 -0300 Mauro Carvalho Chehab…
I don't think we can count that python 3 uses utf-8 per default.
I strongly suspect that, if one uses a Python3 version < 3.7, it will still default to ASCII.
On a quick look, the new UTF-8 mode was added on PEP-540:
https://www.python.org/dev/peps/pep-0540/Such change happened at Python 3.7.
That PEP is to override the locale and use utf8 unconditionally. It says, with regard to the pre-PEP state:
UTF-8 is also the default encoding of Python scripts, XML and JSON file formats.
Unicode was the reason for much of the Python 3 pain; it seems unlikely that many installations are defaulting to ASCII anyway...?
jon
Re: [PATCH] docs: license-rules.txt: cover SPDX headers on Python scripts
Em Thu, 5 Sep 2019 13:40:08 -0600
Jonathan Corbet <[email protected]> escreveu:
Quoted 14 lines
Quoted 10 lines · On Thu, 5 Sep 2019 16:28:10 -0300 Mauro Carvalho Chehab…
I don't think we can count that python 3 uses utf-8 per default.
I strongly suspect that, if one uses a Python3 version < 3.7, it will still default to ASCII.
On a quick look, the new UTF-8 mode was added on PEP-540:
https://www.python.org/dev/peps/pep-0540/Such change happened at Python 3.7.
Quoted 8 lines
That PEP is to override the locale and use utf8 unconditionally. It says, with regard to the pre-PEP state:
UTF-8 is also the default encoding of Python scripts, XML and JSON file formats.
Unicode was the reason for much of the Python 3 pain; it seems unlikely that many installations are defaulting to ASCII anyway...?
Yeah, but I remember that UTF-8 handling changed a few times during python 3 releases. I didn't really tracked what happened, as I don't usually program in Python. So, I'm actually relying on what I can find about that.
Looking at Python 3.0 release[1], it says:
"In many cases, but not all, the system default is UTF-8; you should never count on this default."
[1] https://docs.python.org/3.0/whatsnew/3.0.html
So, at least on early Python 3 releases, the default may not be UTF-8.
I don't know about you, but, from time to time, people complain about UTF-8 chars when I'm handling patches (last time was on a patch series for Kernel 5.3 by a core dev in Australia, with was unable to apply a patch from me with had some UTF-8 chars).
So, I'm pretty sure that some devs don't set the locale to UTF8 even those days.
Thanks,
Mauro
Re: [PATCH] docs: license-rules.txt: cover SPDX headers on Python scripts
In practice the python needs "-*- coding: utf-8 -*- to be in one of the first two lines. The SPDX tag in practice has to be in one of the first 15 lines:
ap.add_argument('-m', '--maxlines', type=int, default=15,
help='Maximum number of lines to scan in a file. Default 15')
IMO, all we need to patch is the documentation from:
"""The SPDX license identifier in kernel files shall be added at the first
possible line in a file which can contain a comment. """
to something like ..
"""The SPDX license identifier in kernel files shall be added at the first 15
lines in a file which can contain a comments. """
Often when it comes to encodings people are tend to mix up things. Below you find some comments of mine in the hope to clarify encoding mess:
TL;DR
Am 05.09.19 um 22:07 schrieb Mauro Carvalho Chehab:
Quoted 25 lines
Em Thu, 5 Sep 2019 13:40:08 -0600
Jonathan Corbet <[email protected]> escreveu:Quoted 22 lines
Quoted 10 lines · On Thu, 5 Sep 2019 16:28:10 -0300 Mauro Carvalho Chehab…
I don't think we can count that python 3 uses utf-8 per default.
I strongly suspect that, if one uses a Python3 version < 3.7, it will still default to ASCII.
On a quick look, the new UTF-8 mode was added on PEP-540:
https://www.python.org/dev/peps/pep-0540/Such change happened at Python 3.7.
That PEP is to override the locale and use utf8 unconditionally. It says, with regard to the pre-PEP state:
UTF-8 is also the default encoding of Python scripts, XML and JSON file formats.
Unicode was the reason for much of the Python 3 pain; it seems unlikely that many installations are defaulting to ASCII anyway...?
Don't mix unicode and utf-8.
What has changed in python 3 compared to python 2 is the internal representation of the string type (which has nothing to with the encoding of files!).
Python2 type str() -- results in a "byte literal"
https://docs.python.org/2.7/library/functions.html#str
Python2 type unicode() -- results in a "unicode literal"
https://docs.python.org/2.7/library/functions.html#unicode
Python3 type str() -- results in a unicode literal
https://docs.python.org/3/library/stdtypes.html#text-sequence-type-str
Python3 unicode() -- this type is not defined, was replaced by str()
Python3 byte() -- results in a byte literal (what str() was in py2)
https://docs.python.org/3/library/stdtypes.html#bytes
This is mostly a pain when your source works with byte-streams and you have to switch py2 to py3. But this has nothing to do with the encoding of source files and how the encoding is tagged in a file. And what the default encoding of a source file is when such tags are omitted.
First lets have a look at the default encoding of py source:
Python will default to ASCII as standard encoding if no other encoding hints are given.
from https://www.python.org/dev/peps/pep-0263/#defining-the-encoding
And my addition: what is correct for py2. In py3 we have UTF-8
PEP 3120: The default source encoding is now UTF-8.
from https://docs.python.org/3.0/whatsnew/3.0.html#text-vs-data-instead-of-unicode-vs-8-bit
Quoted 10 lines
Yeah, but I remember that UTF-8 handling changed a few times during python 3 releases. I didn't really tracked what happened, as I don't usually program in Python. So, I'm actually relying on what I can find about that.
Looking at Python 3.0 release[1], it says:
"In many cases, but not all, the system default is UTF-8; you should never count on this default."
Quoted 9 lines
[1] https://docs.python.org/3.0/whatsnew/3.0.html
So, at least on early Python 3 releases, the default may not be UTF-8.
I don't know about you, but, from time to time, people complain about UTF-8 chars when I'm handling patches (last time was on a patch series for Kernel 5.3 by a core dev in Australia, with was unable to apply a patch from me with had some UTF-8 chars).
Don't mix the output of a text file which is read by the standard open() function in py2/py3 and the source file encoding used by the interpreter for reading the source file itself. To complete your citation:
In many cases, but not all, the system default is UTF-8; you should never count on this default. Any application reading or writing more than pure ASCII text should probably have a way to override the encoding.
This means your application has to know the encoding of a stream/file. E.g. we handle the output from of the external Perl script scripts/kernel-docs by encoding the byte stream from proc-call's stdout into utf-8:
out, err = codecs.decode(out, 'utf-8'), codecs.decode(err, 'utf-8')
see patch https://github.com/torvalds/linux/commit/86c0f046a8b0c23fca65f77333c233a06c25ef9a
Again, this is talking about application development and has nothing to do with the encoding of the source files.
Quoted 2 lines
So, I'm pretty sure that some devs don't set the locale to UTF8 even those days.
The LANG environment influence only the default encoding of streams like stdout and does not change the default encoding for source code files.
To clarify by example, create a test123.py file and save it as !! UTF-8 !!.
import sys, locale
print("system's default encoding: " + sys.getdefaultencoding()) print("sys.stdout's encoding: " + sys.stdout.encoding) print("locale's prefered encoding: " + locale.getpreferredencoding()) text = "Encoding ist Scheiße"
try:
print("::" + text) except UnicodeEncodeError as exc:
print("appl had a UnicodeEncodeError exception: %s" % exc)
Probe encoding of the source file and run some tests:
$ file test123.py test123.py: Python script, UTF-8 Unicode text executable
Lets see how it is stored::
$ hexdump -C test123.py | grep Schei 000000e0 6e 67 20 69 73 74 20 53 63 68 65 69 c3 9f 65 22 |ng ist Schei..e"|
The 'ß' is a two byte char 0xc39f in UTF-8 and the unicode code-point is U+00DF.
Since we encoded the file in utf-8 and python2 excepts ASCII as default we will get a SyntaxError::
$ python2 test123.py File "test123.py", line 6 SyntaxError: Non-ASCII character '\xc3' in file test123.py on line 6, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details
The only way to fix it is to use a magic comment (# -*- coding: utf-8 -*-) Py3 expects UTF-8 encoded source as default, see PEP-3120 vs PEP-0263. And we got what excepted:
$ python3 test123.py system's default encoding: utf-8 sys.stdout's encoding: UTF-8 locale's prefered encoding: UTF-8 ::Encoding ist Scheiße
OK, now lets see what happens when locale (LANG) is changed:
$ LANG=POSIX python3 test123.py system's default encoding: utf-8 sys.stdout's encoding: ANSI_X3.4-1968 locale's prefered encoding: ANSI_X3.4-1968 application print throws UnicodeEncodeError: 'ascii' codec can't encode character '\xdf' in position 21: ordinal not in range(128)
The interpreter has no problem to read the source file, because the py3 systems's default encoding stays in UTF-8 .. only the print application throws a UnicodeEncodeError when it prints the internal unicode (with non ASCII char in) to a stdout which encodes now ASCII (aka ANSI_X3.4-1968).
Next lets try ISO-8859-1
LANG=en_US.ISO-8859-1 python3 test123.py
system's default encoding: utf-8
sys.stdout's encoding: ISO-8859-1
locale's prefered encoding: ISO-8859-1
::Encoding ist Schei�e
Again; The interpreter has no problem to read the UTF-8 source file (no SyntaxError). Only the application works not as expected...
The German 'ß' was correctly read by the interpreter and converted to the internal unicode representation '\u00DF'. When it is written to stdout (print) it is correctly encoded from unicode to ISO-8859-1, but why do we get a '�'? Because the my X-terminal still uses UTF-8 even when I change the LANG. Lets use liut(1) and everything is fine:
LANG=en_US.ISO-8859-1 luit -encoding ISO-8859-1 python3 test123.py system's default encoding: utf-8
sys.stdout's encoding: ISO-8859-1
locale's prefered encoding: ISO-8859-1
::Encoding ist Scheiße
So much more to say about encoding, we haven't talked about all the pitfalls e.g. with filename encoding or the encoding of used editors ;)
-- Markus --
Quoted 6 lines · Mauro Carvalho Chehab
I'll accept
this patch and keep such rule in mind for next SPDX changes.Anyway, with regards to script, we need to change the rules in order to allow adding SPDX for python scripts, as otherwise the addition of SPDX headers may cause regressions.
Not really.
$ git grep -n '^# SPDX-License-Identifier' -- '*.py' | wc -l
62
$ git grep -n '^# SPDX-License-Identifier' -- '*.py' | \
cut -f2 -d: | sort | uniq -c
32 1
27 2
3 3
$ git grep -n '^# SPDX-License-Identifier' -- '*.py' | \
cut -f1 -d: | xargs ./scripts/spdxcheck.py --verboseLicense files: 14 Exception files: 2
License IDs 19
Exception IDs 2
Files checked: 62 Lines checked: 95 Files with SPDX: 62 Files with errors: 0
Mauro Carvalho Chehab
maintainerEm Thu, 05 Sep 2019 02:28:05 -0700
Joe Perches <[email protected]> escreveu:
Quoted 22 lines · Mauro Carvalho Chehab
Quoted 6 lines
I'll accept
this patch and keep such rule in mind for next SPDX changes.Anyway, with regards to script, we need to change the rules in order to allow adding SPDX for python scripts, as otherwise the addition of SPDX headers may cause regressions.
Not really.
$ git grep -n '^# SPDX-License-Identifier' -- '*.py' | wc -l 62 $ git grep -n '^# SPDX-License-Identifier' -- '*.py' | \ cut -f2 -d: | sort | uniq -c 32 1 27 2 3 3 $ git grep -n '^# SPDX-License-Identifier' -- '*.py' | \ cut -f1 -d: | xargs ./scripts/spdxcheck.py --verboseLicense files: 14 Exception files: 2
Quoted 7 lines
License IDs 19
Exception IDs 2Files checked: 62 Lines checked: 95 Files with SPDX: 62 Files with errors: 0
Not quite sure what you're meant with the above, but:
1) this won't cover all python scripts, as there are some without .py extension:
$ git grep -lE "\#\!.*python"|grep -v \.py$ drivers/staging/greybus/tools/lbtest scripts/bloat-o-meter scripts/diffconfig scripts/show_delta tools/hv/lsvmbus tools/kvm/kvm_stat/kvm_stat
2) we have already some files that are violating PEP-263 due to SPDX headers. On a quick look at the results of:
$ git grep -lE "^\#.*coding" $(git grep -lE "\#\!.*python") Documentation/sphinx/kernel_include.py Documentation/sphinx/rstFlatTable.py tools/perf/python/tracepoint.py tools/perf/python/twatch.py tools/power/x86/intel_pstate_tracer/intel_pstate_tracer.py
Those three files already have such problem:
tools/perf/python/tracepoint.py tools/perf/python/twatch.py tools/power/x86/intel_pstate_tracer/intel_pstate_tracer.py
On those scripts, the coding line is not at the right place, and will be silently ignored by python, causing them to crash with UTF-8 encoding chars, if any.
And the other two doesn't have a SPDX header file. Adding a SPDX header there would violate the "up to the second line" rule.
Thanks,
Mauro