Skip to contentSkip to conversation

[1.46][PATCH 0/2] Patch review

bitbake Steve Sakoman 1 participant 3 messages Nov 19, 2022

lore
Share & tools
lore
#0 lore raw

Please review this set of patches for dunfell/1.46 and have comments back by end of day Tuesday.

Passed a-full on autobuilder:

https://autobuilder.yoctoproject.org/typhoon/#/builders/83/builds/4512

The following changes since commit 8ea8e443005ad92f4ad264d9abd9e90e33fb5c17:

tests/fetch: Allow handling of a file:// url within a submodule (2022-10-27 16:38:59 +0100)

are available in the Git repository at:

https://git.openembedded.org/bitbake-contrib stable/1.46-nut
http://cgit.openembedded.org/bitbake-contrib/log/?h=stable/1.46-nut

Richard Purdie (2):
utils: Handle lockfile filenames that are too long for filesystems
utils: Fix lockfile path length issues

 lib/bb/utils.py | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
Signature · 1 line
2.25.1
#1 lore raw

[bitbake][dunfell][1.46][PATCH 1/2] utils: Handle lockfile filenames that are too long for filesystems

From: Richard Purdie <[email protected]>

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.

(cherry picked from commit 63baf3440b16e41ac6601de21ced94a94bdf1509)
---
 lib/bb/utils.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
lib/bb/utils.py +5 -1
index 6592eb00..210e535f 100644
@@ -461,6 +461,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)
 
@@ -497,7 +501,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)
Signature · 1 line
2.25.1
#2 lore raw

[bitbake][dunfell][1.46][PATCH 2/2] utils: Fix lockfile path length issues

In reply to Steve Sakoman

From: Richard Purdie <[email protected]>

If the path to bitbake.lock is in a deep directory, bitbake will hang. The reason was that the max file length limiting code (to 255 chars) was including the directory name and it should only act on the filename within the directory. Fix it to just use the base filename.

[YOCTO #14766]

(cherry picked from commit 89d70e7b71eecfe06592202f326e566c579ba01d)
---
 lib/bb/utils.py | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
lib/bb/utils.py +6 -3
index 210e535f..82602466 100644
@@ -461,13 +461,16 @@ 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
+    basename = os.path.basename(name)
+    if len(basename) > 255:
+        root, ext = os.path.splitext(basename)
+        basename = root[:255 - len(ext)] + ext
 
     dirname = os.path.dirname(name)
     mkdirhier(dirname)
 
+    name = os.path.join(dirname, basename)
+
     if not os.access(dirname, os.W_OK):
         logger.error("Unable to acquire lock '%s', directory is not writable",
                      name)
Signature · 1 line
2.25.1