Skip to contentSkip to conversation

server: Fix crash when checking lock file

PATCH New Joshua Watt 1 participant 1 message May 31, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 server: Fix crash when checking lock file

Fixes a crash when the server process attempts to check the PID of the lock file that resulted because an integer (os.getpid()) was attempting to be concatenated to a string

---
 bitbake/lib/bb/server/process.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
bitbake/lib/bb/server/process.py +1 -1
index db417c84280..7616ef53c89 100644
@@ -375,7 +375,7 @@ class ProcessServer():
                 lock = bb.utils.lockfile(lockfile, shared=False, retry=False, block=False)
                 if not lock:
                     newlockcontents = get_lock_contents(lockfile)
-                    if not newlockcontents[0].startswith([os.getpid() + "\n", os.getpid() + " "]):
+                    if not newlockcontents[0].startswith([f"{os.getpid()}\n", f"{os.getpid()} "]):
                         # A new server was started, the lockfile contents changed, we can exit
                         serverlog("Lockfile now contains different contents, exiting: " + str(newlockcontents))
                         return
Signature · 1 line
2.33.0