[PATCH] syntax-check: Only prohibit empty first lines in non-empty files

Martin Kletzander posted 1 patch 2 years, 9 months ago
Test syntax-check failed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/03be57befd07aabc9f07824eaaa76b6883ac6e68.1623753750.git.mkletzan@redhat.com
build-aux/syntax-check.mk | 5 +++--
src/esx/README            | 1 -
2 files changed, 3 insertions(+), 3 deletions(-)
[PATCH] syntax-check: Only prohibit empty first lines in non-empty files
Posted by Martin Kletzander 2 years, 9 months ago
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
---
 build-aux/syntax-check.mk | 5 +++--
 src/esx/README            | 1 -
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/build-aux/syntax-check.mk b/build-aux/syntax-check.mk
index 1037d10cd279..eda89f40add3 100644
--- a/build-aux/syntax-check.mk
+++ b/build-aux/syntax-check.mk
@@ -978,7 +978,8 @@ sc_require_locale_h:
 
 sc_prohibit_empty_first_line:
 	@$(VC_LIST_EXCEPT) | xargs awk 'BEGIN { fail=0; } \
-	FNR == 1 { if ($$0 == "") { print FILENAME ":1:"; fail=1; } } \
+	FNR == 1 { maybe_fail = $$0 == ""; } \
+	FNR == 2 { if (maybe_fail == 1) { print FILENAME ":1:"; fail=1; } } \
 	END { if (fail == 1) { \
 	  print "$(ME): Prohibited empty first line" > "/dev/stderr"; \
 	} exit fail; }'
@@ -1835,7 +1836,7 @@ exclude_file_name_regexp--sc_prohibit_mixed_case_abbreviations = \
   ^src/(vbox/vbox_CAPI.*.h|esx/esx_vi.(c|h)|esx/esx_storage_backend_iscsi.c)$$
 
 exclude_file_name_regexp--sc_prohibit_empty_first_line = \
-  ^(src/esx/README|tests/(vmwarever|virhostcpu|vircaps2xml)data/.*)$$
+  ^tests/vmwareverdata/fusion-5.0.3.txt$$
 
 exclude_file_name_regexp--sc_prohibit_useless_translation = \
   ^tests/virpolkittest.c
diff --git a/src/esx/README b/src/esx/README
index 372227cc9c76..cc52d9e3282a 100644
--- a/src/esx/README
+++ b/src/esx/README
@@ -1,4 +1,3 @@
-
 Some links to relevant documentation
 ====================================
 
-- 
2.31.1

Re: [PATCH] syntax-check: Only prohibit empty first lines in non-empty files
Posted by Jano Tomko 2 years, 9 months ago
On 6/15/21 12:42 PM, Martin Kletzander wrote:
> Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
> ---
>  build-aux/syntax-check.mk | 5 +++--
>  src/esx/README            | 1 -
>  2 files changed, 3 insertions(+), 3 deletions(-)

Reviewed-by: Ján Tomko <jtomko@redhat.com>

Jano