All of lore.kernel.org
 help / color / mirror / Atom feed
* [1.50][PATCH 0/1] Review request
@ 2021-12-03 14:25 Anuj Mittal
  2021-12-03 14:25 ` [1.50][PATCH 1/1] utils: Handle lockfile filenames that are too long for filesystems Anuj Mittal
  0 siblings, 1 reply; 2+ messages in thread
From: Anuj Mittal @ 2021-12-03 14:25 UTC (permalink / raw)
  To: bitbake-devel

Please review and merge these changes. No problems seen while testing on
autobuilder.

Thanks,

Anuj

The following changes since commit b7c60b97fd225ca23e648e8635a9f30e7e2591a5:

  cooker: Fix task-depends.dot for multiconfig targets (2021-11-24 10:08:02 +0000)

are available in the Git repository at:

  git://push.openembedded.org/bitbake-contrib stable/1.50-next

Richard Purdie (1):
  utils: Handle lockfile filenames that are too long for filesystems

 lib/bb/utils.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

-- 
2.33.1



^ permalink raw reply	[flat|nested] 2+ messages in thread

* [1.50][PATCH 1/1] utils: Handle lockfile filenames that are too long for filesystems
  2021-12-03 14:25 [1.50][PATCH 0/1] Review request Anuj Mittal
@ 2021-12-03 14:25 ` Anuj Mittal
  0 siblings, 0 replies; 2+ messages in thread
From: Anuj Mittal @ 2021-12-03 14:25 UTC (permalink / raw)
  To: bitbake-devel

From: Richard Purdie <richard.purdie@linuxfoundation.org>

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.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit 63baf3440b16e41ac6601de21ced94a94bdf1509)
Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
---
 lib/bb/utils.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lib/bb/utils.py b/lib/bb/utils.py
index b282d09a..40b5006f 100644
--- a/lib/bb/utils.py
+++ b/lib/bb/utils.py
@@ -451,6 +451,10 @@ 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
+
     dirname = os.path.dirname(name)
     mkdirhier(dirname)
 
@@ -487,7 +491,7 @@ def lockfile(name, shared=False, retry=True, block=False):
                     return lf
             lf.close()
         except OSError as e:
-            if e.errno == errno.EACCES:
+            if e.errno == errno.EACCES or e.errno == errno.ENAMETOOLONG:
                 logger.error("Unable to acquire lock '%s', %s",
                              e.strerror, name)
                 sys.exit(1)
-- 
2.33.1



^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-12-03 14:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-12-03 14:25 [1.50][PATCH 0/1] Review request Anuj Mittal
2021-12-03 14:25 ` [1.50][PATCH 1/1] utils: Handle lockfile filenames that are too long for filesystems Anuj Mittal

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.