summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2022-03-23 14:48:08 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-03-24 17:45:23 +0000
commit89d70e7b71eecfe06592202f326e566c579ba01d (patch)
tree00ff1039053b3f1e5b4bdecfb910fc9a069fb85a
parent93395559c9dda734a3dec9ffd9bb2156a71a2c17 (diff)
downloadbitbake-89d70e7b71eecfe06592202f326e566c579ba01d.tar.gz
utils: Fix lockfile path length issues
If the path to bitbake.lock is in a deep directory, bitbake will hang. The reason was that the max file length limiting code (to 255 chars) was including the directory name and it should only act on the filename within the directory. Fix it to just use the base filename. [YOCTO #14766] Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--lib/bb/utils.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/bb/utils.py b/lib/bb/utils.py
index fcaeb9916..d11da978d 100644
--- a/lib/bb/utils.py
+++ b/lib/bb/utils.py
@@ -453,13 +453,16 @@ def lockfile(name, shared=False, retry=True, block=False):
consider the possibility of sending a signal to the process to break
out - at which point you want block=True rather than retry=True.
"""
- if len(name) > 255:
- root, ext = os.path.splitext(name)
- name = root[:255 - len(ext)] + ext
+ basename = os.path.basename(name)
+ if len(basename) > 255:
+ root, ext = os.path.splitext(basename)
+ basename = root[:255 - len(ext)] + ext
dirname = os.path.dirname(name)
mkdirhier(dirname)
+ name = os.path.join(dirname, basename)
+
if not os.access(dirname, os.W_OK):
logger.error("Unable to acquire lock '%s', directory is not writable",
name)