diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2021-12-03 22:25:46 +0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2021-12-05 12:36:51 +0000 |
commit | 7edd2be25fdf72187738fc551235df0f24e918bb (patch) | |
tree | f817e4298c451b2b21ecfe6d57c51929bb7b270e | |
parent | 69a7c158251a69b4e0b42bbdd7060845cee01b51 (diff) | |
download | poky-7edd2be25fdf72187738fc551235df0f24e918bb.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: 315599b5b3ca0f1c797555db2460081681b6c945)
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.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/bitbake/lib/bb/utils.py b/bitbake/lib/bb/utils.py index b282d09abf..40b5006fe3 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) |