diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2021-11-18 13:48:04 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2021-11-21 11:05:51 +0000 |
commit | 273b124bf6acd77b074fde2421be331721a68c11 (patch) | |
tree | de4446c300ff992ea92a35f263fb1a188b5b07c5 /bitbake | |
parent | a3b12619baa95ee5687ccc8898b4c3eca1fb6669 (diff) | |
download | poky-273b124bf6acd77b074fde2421be331721a68c11.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: 63baf3440b16e41ac6601de21ced94a94bdf1509)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r-- | bitbake/lib/bb/utils.py | 6 |
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) |