bitbake-devel.lists.openembedded.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Raise when filename of lockfile is too long to avoid infinite loop
@ 2021-10-31 19:59 Manuel Leonhardt
  2021-10-31 20:11 ` Manuel Leonhardt
  0 siblings, 1 reply; 2+ messages in thread
From: Manuel Leonhardt @ 2021-10-31 19:59 UTC (permalink / raw)
  To: bitbake-devel; +Cc: Manuel Leonhardt


[-- Attachment #1.1: Type: text/plain, Size: 2343 bytes --]

When a filename is passed to bb.utils.lockfile, which is longer than
the filesystem can handle (usually more than 255 characters), an
OSError with errno ENAMETOOLONG is thrown. Previously, this was not
handled, which resulted in the function being trapped in an infinite
loop.

This situation can happen easily when sharing an sstate cache with
SSTATE_MIRROR via HTTP/S. The function generate_sstatefn in
sstate.bbclass tries to reduce sstate filenames to less than 255
characters, however this function does not honor the ".lock" suffix
added to the sstate file's name when it's downloaded from a http mirror
in the pstaging_fetch function. Consequently, when the filename of the
sstate file has more than 250 characters and ".lock" is added to the
file's name the above described ENAMETOOLONG error is thrown, which
causes populate tasks to hang indefinitely.

Signed-off-by: Manuel Leonhardt <mleonhardt@arri.de>
---
 lib/bb/utils.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/bb/utils.py b/lib/bb/utils.py
index 70634910..d3b8d8ce 100644
--- a/lib/bb/utils.py
+++ b/lib/bb/utils.py
@@ -487,7 +487,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 in (errno.EACCES, errno.ENAMETOOLONG):
                 logger.error("Unable to acquire lock '%s', %s",
                              e.strerror, name)
                 sys.exit(1)
--
2.33.1


_______________________________________________________
Manuel
Leonhardt
Softwareentwickler
​
ARRI
Arnold & Richter Cine Technik GmbH & Co. Betriebs KG
Herbert-Bayer-Str. 10,
80807
München
www.arri.com

+49 89 3809-1719
MLeonhardt@arri.de

​
Get all the latest information from www.arri.com, Facebook, Twitter, Instagram and YouTube.

Arnold & Richter Cine Technik GmbH & Co. Betriebs KG
Sitz: München - Registergericht: Amtsgericht München - Handelsregisternummer: HRA 57918
Persönlich haftender Gesellschafter: Arnold & Richter Cine Technik GmbH
Sitz: München - Registergericht: Amtsgericht München - Handelsregisternummer: HRB 54477
Geschäftsführer: Dr. Michael Neuhäuser; Stephan Schenk; Walter Trauninger; Markus Zeiler

​

[-- Attachment #1.2: Type: text/html, Size: 11045 bytes --]

[-- Attachment #2: image392099.png --]
[-- Type: image/png, Size: 528 bytes --]

[-- Attachment #3: image685150.png --]
[-- Type: image/png, Size: 824 bytes --]

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

* Re: [PATCH] Raise when filename of lockfile is too long to avoid infinite loop
  2021-10-31 19:59 [PATCH] Raise when filename of lockfile is too long to avoid infinite loop Manuel Leonhardt
@ 2021-10-31 20:11 ` Manuel Leonhardt
  0 siblings, 0 replies; 2+ messages in thread
From: Manuel Leonhardt @ 2021-10-31 20:11 UTC (permalink / raw)
  To: bitbake-devel

[-- Attachment #1: Type: text/plain, Size: 402 bytes --]

This will only fix the error handling with long filenames. However, future changes might consider changing the control flow here, i.e., fail on all OSErrors except for those cases intended for the mode of operation.

See also https://lists.openembedded.org/g/openembedded-core/message/157691, where generate_sstatefn in sstate.bbclass is adapted to consider the .lock suffix when shorten filenames.

[-- Attachment #2: Type: text/html, Size: 522 bytes --]

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

end of thread, other threads:[~2021-10-31 20:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-31 19:59 [PATCH] Raise when filename of lockfile is too long to avoid infinite loop Manuel Leonhardt
2021-10-31 20:11 ` Manuel Leonhardt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).