[PATCH v2] devtools: fix SPDX tag check
Thomas Monjalon
thomas at monjalon.net
Thu Apr 30 15:15:09 CEST 2026
If a file has no SPDX tag and is not filtered out by no_license_list,
there will be an error when using its path containing a slash
in the sed command delimited with slashes.
It could be fixed by using another character as sed command delimiter.
The chosen fix is to use grep instead of sed.
Fixes: b99a3b8aa989 ("license: standardize SPDX tag")
Cc: stable at dpdk.org
Reported-by: David Marchand <david.marchand at redhat.com>
Suggested-by: Marat Khalili <marat.khalili at huawei.com>
Signed-off-by: Thomas Monjalon <thomas at monjalon.net>
---
v1: replace / with |
v2: use grep instead of sed (Marat's suggestion)
---
devtools/check-spdx-tag.sh | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/devtools/check-spdx-tag.sh b/devtools/check-spdx-tag.sh
index 2390941c74..41fc1fe01d 100755
--- a/devtools/check-spdx-tag.sh
+++ b/devtools/check-spdx-tag.sh
@@ -39,10 +39,8 @@ check_spdx() {
fi
files_without_spdx=$(cat $tmpfile)
- git grep -LE '(/\*|#|;|\.\.) *SPDX-License-Identifier: [A-Z(]' -- $no_license_list > $tmpfile
- for file in $files_without_spdx ; do
- sed -i "/^$file$/d" $tmpfile
- done
+ git grep -LE '(/\*|#|;|\.\.) *SPDX-License-Identifier: [A-Z(]' -- $no_license_list |
+ grep -vF "$files_without_spdx" > $tmpfile
warnings=$(($warnings + $(wc -l < $tmpfile)))
$quiet || cat $tmpfile
--
2.53.0
More information about the stable
mailing list