summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2021-11-18 13:48:04 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-11-22 23:26:15 +0000
commit0711fd83cdc230d04144cda37a786b6470a78f37 (patch)
treea9d36d5f9cc834051f2a7cf0868a040746040e4f /bitbake
parentb7420c15b3c3262b1a6d3d080ba60b454c6782c2 (diff)
downloadpoky-0711fd83cdc230d04144cda37a786b6470a78f37.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: 30d42ef030d03e11322b6b05ea7bbb64ab3d6f21) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit 63baf3440b16e41ac6601de21ced94a94bdf1509) Signed-off-by: Steve Sakoman <steve@sakoman.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-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 6592eb00dd..210e535f05 100644
--- a/bitbake/lib/bb/utils.py
+++ b/bitbake/lib/bb/utils.py
@@ -461,6 +461,10 @@ def lockfile(name, shared=False, retry=True, block=False):
461 consider the possibility of sending a signal to the process to break 461 consider the possibility of sending a signal to the process to break
462 out - at which point you want block=True rather than retry=True. 462 out - at which point you want block=True rather than retry=True.
463 """ 463 """
464 if len(name) > 255:
465 root, ext = os.path.splitext(name)
466 name = root[:255 - len(ext)] + ext
467
464 dirname = os.path.dirname(name) 468 dirname = os.path.dirname(name)
465 mkdirhier(dirname) 469 mkdirhier(dirname)
466 470
@@ -497,7 +501,7 @@ def lockfile(name, shared=False, retry=True, block=False):
497 return lf 501 return lf
498 lf.close() 502 lf.close()
499 except OSError as e: 503 except OSError as e:
500 if e.errno == errno.EACCES: 504 if e.errno == errno.EACCES or e.errno == errno.ENAMETOOLONG:
501 logger.error("Unable to acquire lock '%s', %s", 505 logger.error("Unable to acquire lock '%s', %s",
502 e.strerror, name) 506 e.strerror, name)
503 sys.exit(1) 507 sys.exit(1)