summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2021-11-22 16:36:47 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2021-11-24 10:08:23 +0000
commitc4f08fc43da0658fadd585790736c47a18228f5c (patch)
tree072957794433b45ec453573a55b4173261002f93
parent243758b8f4c086781a42766c7c0a4b8146d506aa (diff)
downloadpoky-c4f08fc43da0658fadd585790736c47a18228f5c.tar.gz
bitbake: utils: Handle lockfile filenames that are too long for filesystems
The fetcher mirror code can go crazy creating lock filenames which exceed the filesystem limits. When this happens, the code will loop/hang. Handle the filename too long exception correctly but also truncate lockfile lengths to under 256 since the worst case situation is lockfile overlap and lack of parallelism. (Bitbake rev: 64498ecb094b7911d10b07c098d5a966e79f95b3) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit 63baf3440b16e41ac6601de21ced94a94bdf1509) Signed-off-by: Anuj Mittal <anuj.mittal@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--bitbake/lib/bb/utils.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/bitbake/lib/bb/utils.py b/bitbake/lib/bb/utils.py
index 70634910f7..d890ea832e 100644
--- a/bitbake/lib/bb/utils.py
+++ b/bitbake/lib/bb/utils.py
@@ -451,6 +451,10 @@ def lockfile(name, shared=False, retry=True, block=False):
451 consider the possibility of sending a signal to the process to break 451 consider the possibility of sending a signal to the process to break
452 out - at which point you want block=True rather than retry=True. 452 out - at which point you want block=True rather than retry=True.
453 """ 453 """
454 if len(name) > 255:
455 root, ext = os.path.splitext(name)
456 name = root[:255 - len(ext)] + ext
457
454 dirname = os.path.dirname(name) 458 dirname = os.path.dirname(name)
455 mkdirhier(dirname) 459 mkdirhier(dirname)
456 460
@@ -487,7 +491,7 @@ def lockfile(name, shared=False, retry=True, block=False):
487 return lf 491 return lf
488 lf.close() 492 lf.close()
489 except OSError as e: 493 except OSError as e:
490 if e.errno == errno.EACCES: 494 if e.errno == errno.EACCES or e.errno == errno.ENAMETOOLONG:
491 logger.error("Unable to acquire lock '%s', %s", 495 logger.error("Unable to acquire lock '%s', %s",
492 e.strerror, name) 496 e.strerror, name)
493 sys.exit(1) 497 sys.exit(1)