All of lore.kernel.org
 help / color / mirror / Atom feed
* [1.40][PATCH 1/2] utils: Fix movefile() exception handling with python3
@ 2019-09-04  7:36 Martin Jansa
  2019-09-04  7:37 ` [1.40][PATCH 2/2] fetch2: show warning when renaming the archive with bad checksum failed Martin Jansa
  0 siblings, 1 reply; 2+ messages in thread
From: Martin Jansa @ 2019-09-04  7:36 UTC (permalink / raw)
  To: bitbake-devel

From: Martin Jansa <martin.jansa@gmail.com>

* with python3 this fails with:
  File: 'bitbake/lib/bb/utils.py', lineno: 799, function: movefile
       0795:        try:
       0796:            os.rename(src, destpath)
       0797:            renamefailed = 0
       0798:        except Exception as e:
   *** 0799:            if e[0] != errno.EXDEV:
       0800:                # Some random error.
       0801:                print("movefile: Failed to move", src, "to", dest, e)
       0802:                return None
       0803:            # Invalid cross-device-link 'bind' mounted or actually Cross-Device
  Exception: TypeError: 'OSError' object is not subscriptable

Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
 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 215c18cf..f5bd816c 100644
--- a/lib/bb/utils.py
+++ b/lib/bb/utils.py
@@ -796,7 +796,7 @@ def movefile(src, dest, newmtime = None, sstat = None):
             os.rename(src, destpath)
             renamefailed = 0
         except Exception as e:
-            if e[0] != errno.EXDEV:
+            if e.errno != errno.EXDEV:
                 # Some random error.
                 print("movefile: Failed to move", src, "to", dest, e)
                 return None
-- 
2.17.1



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

end of thread, other threads:[~2019-09-04  7:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-04  7:36 [1.40][PATCH 1/2] utils: Fix movefile() exception handling with python3 Martin Jansa
2019-09-04  7:37 ` [1.40][PATCH 2/2] fetch2: show warning when renaming the archive with bad checksum failed Martin Jansa

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.