[kirkstone,2.0,17/18] cache: correctly handle file names containing colons

Message ID 11460a5b887762b946eb11e847c1ce70f83f74f7.1652205806.git.steve@sakoman.com
State Accepted, archived
Commit e14ed7dd866334ab40cd335d9c006e5d7b447abd
Headers show
Series [kirkstone,2.0,01/18] providers: use local variable for packages_dynamic pattern | expand

Commit Message

Steve Sakoman May 10, 2022, 6:05 p.m. UTC
From: Roland Hieber <rhi@pengutronix.de>

File names containing colons cause split() to return a list with more
than two elements, which will lead to a stack trace ending in:

    ValueError: too many values to unpack (expected 2)

Split only once at the last colon, thereby making sure that only two
elements are returned.

Signed-off-by: Roland Hieber <rhi@pengutronix.de>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit a70a7376a8708bde07959deb5d5842d7f84ee5f8)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
---
 lib/bb/cache.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch

diff --git a/lib/bb/cache.py b/lib/bb/cache.py
index fcb15796..92e9a3ce 100644
--- a/lib/bb/cache.py
+++ b/lib/bb/cache.py
@@ -619,7 +619,7 @@  class Cache(NoCache):
                 for f in flist:
                     if not f:
                         continue
-                    f, exist = f.split(":")
+                    f, exist = f.rsplit(":", 1)
                     if (exist == "True" and not os.path.exists(f)) or (exist == "False" and os.path.exists(f)):
                         self.logger.debug2("%s's file checksum list file %s changed",
                                              fn, f)