[PATCH 2/2] scripts: Fix reading list of files in mock-noinline.py

Michal Privoznik via Devel posted 2 patches 7 months, 3 weeks ago
[PATCH 2/2] scripts: Fix reading list of files in mock-noinline.py
Posted by Michal Privoznik via Devel 7 months, 3 weeks ago
From: Michal Privoznik <mprivozn@redhat.com>

The mock-noinline.py script is fed list of files through its
stdin, each file on its own line. Unfortunately, the way the
script is written does nothing as the trailing newline character
prevents any .endswith() match. Strip each line of white spaces.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
 scripts/mock-noinline.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/scripts/mock-noinline.py b/scripts/mock-noinline.py
index ec617bbc2b..77a5ca23e2 100755
--- a/scripts/mock-noinline.py
+++ b/scripts/mock-noinline.py
@@ -63,7 +63,8 @@ def scan_overrides(filename):
                     mocked[name] = "%s:%d" % (filename, lineno)
 
 
-for filename in sys.stdin.readlines():
+for filename in sys.stdin:
+    filename = filename.rstrip()
     if filename.endswith(".h"):
         scan_annotations(filename)
     elif filename.endswith("mock.c"):
-- 
2.49.0
Re: [PATCH 2/2] scripts: Fix reading list of files in mock-noinline.py
Posted by Daniel P. Berrangé via Devel 7 months, 3 weeks ago
On Mon, Apr 28, 2025 at 01:47:50PM +0200, Michal Privoznik via Devel wrote:
> From: Michal Privoznik <mprivozn@redhat.com>
> 
> The mock-noinline.py script is fed list of files through its
> stdin, each file on its own line. Unfortunately, the way the
> script is written does nothing as the trailing newline character
> prevents any .endswith() match. Strip each line of white spaces.
> 
> Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
> ---
>  scripts/mock-noinline.py | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>



With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|