Skip to contentSkip to conversation

utils.py: lockfile(): Catch ENAMETOOLONG

PATCH New Mark Hatle 1 participant 1 message Nov 13, 2021

lore
Share & tools
lore

Mark Hatle

author
#0 lore raw

PATCH 1/1 utils.py: lockfile(): Catch ENAMETOOLONG

From: Mark Hatle <[email protected]>

When the filename was too long, the system would loop forever causing a hang. Instead we need to just drop out, as we can't correct a filename that is too long.

---
 lib/bb/utils.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/bb/utils.py +1 -1
index 7063491..0343b08 100644
@@ -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 == errno.EACCES or e.errno == errno.ENAMETOOLONG:
                 logger.error("Unable to acquire lock '%s', %s",
                              e.strerror, name)
                 sys.exit(1)
Signature · 1 line
1.8.3.1