In my test environments (Fedora 35 and Debian 10.10 on AMD 2970WX),
running the convert-variable-renames.py rename script was resulting
in empty files instead of updated ones.  From inspection, the new
files are never flushed/closed before moving them into place, which
seems inherently racy.  Adding an explicit close to flush the modified
contents out before moving into place fixes the issue for me.

Signed-off-by: Scott Murray <[email protected]>
---
 scripts/contrib/convert-variable-renames.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/scripts/contrib/convert-variable-renames.py 
b/scripts/contrib/convert-variable-renames.py
index fca59ca9e1..ed012610db 100755
--- a/scripts/contrib/convert-variable-renames.py
+++ b/scripts/contrib/convert-variable-renames.py
@@ -84,6 +84,7 @@ def processfile(fn):
                         if re.search(check_word, line, re.IGNORECASE):
                             print("%s needs further work at line %s since it 
contains %s"% (fn, lineno, check_word))
                     new_file.write(line)
+            new_file.close()
             if modified:
                 print("*** Modified file '%s'" % (fn))
                 shutil.copymode(fn, abs_path)
-- 
2.35.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#162124): 
https://lists.openembedded.org/g/openembedded-core/message/162124
Mute This Topic: https://lists.openembedded.org/mt/89310790/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to