[CRIU] [PATCH] crit: Fix casts for fixed and sfixed types
Pavel Emelyanov
xemul at parallels.com
Wed Dec 9 06:41:20 PST 2015
The native pb engine doesn't accept types other than int or long:
...
File "/root/src/criu/pycriu/images/pb2dict.py", line 264, in dict2pb
pb_val.append(_dict2pb_cast(field, v))
File "/usr/lib/python2.7/site-packages/google/protobuf/internal/containers.py", line 111, in append
self._type_checker.CheckValue(value)
File "/usr/lib/python2.7/site-packages/google/protobuf/internal/type_checkers.py", line 104, in CheckValue
raise TypeError(message)
TypeError: 1.1258999068426252e+16 has type <type 'float'>, but expected one of: (<type 'int'>, <type 'long'>)
In particular, this is seen when encoding back so_filter field from
inetsk image.
Signed-off-by: Pavel Emelyanov <xemul at parallels.com>
---
pycriu/images/pb2dict.py | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/pycriu/images/pb2dict.py b/pycriu/images/pb2dict.py
index 2f975e0..57e6dc6 100644
--- a/pycriu/images/pb2dict.py
+++ b/pycriu/images/pb2dict.py
@@ -24,12 +24,10 @@ import os
_basic_cast = {
- FD.TYPE_DOUBLE : float,
- FD.TYPE_FLOAT : float,
- FD.TYPE_FIXED64 : float,
- FD.TYPE_FIXED32 : float,
- FD.TYPE_SFIXED64 : float,
- FD.TYPE_SFIXED32 : float,
+ FD.TYPE_FIXED64 : long,
+ FD.TYPE_FIXED32 : int,
+ FD.TYPE_SFIXED64 : long,
+ FD.TYPE_SFIXED32 : int,
FD.TYPE_INT64 : long,
FD.TYPE_UINT64 : long,
--
1.9.3
More information about the CRIU
mailing list