2021-08-06 07:33:19

by [email protected]

[permalink] [raw]
Subject: [PATCH 2/2] nfstest: python3: run python3 explicitly on client

In CentOS8 like distros, python is still linked to python2,
the the following occrus:

# ./nfstest_delegation --nfsversion=4 -e /nfsroot --server \
192.168.220.118 --client 192.168.220.104 \
--trcdelay 10 --runtest recall03

FAIL: Traceback (most recent call last):
File "./nfstest_delegation", line 987, in recall_deleg_test
self.get_deleg_remote()
File "./nfstest_delegation", line 469, in get_deleg_remote
fdko = self.rexecobj.run(os.open, self.clientobj.abspath(self.files[0]), os.O_RDONLY)
File "/root/nfstest/nfstest/rexec.py", line 426, in run
return self._send_cmd("run", *kwts, **kwds)
File "/root/nfstest/nfstest/rexec.py", line 350, in _send_cmd
return self.results()
File "/root/nfstest/nfstest/rexec.py", line 395, in results
res = self.conn.recv()
File "/usr/lib64/python3.6/multiprocessing/connection.py", line 254, in recv
buf = self._recv_bytes()
File "/usr/lib64/python3.6/multiprocessing/connection.py", line 411, in _recv_bytes
buf = self._recv(4)
File "/usr/lib64/python3.6/multiprocessing/connection.py", line 387, in _recv
raise EOFError
EOFError

Traceback (most recent call last):
File "<string>", line 1, in <module>
File "<string>", line 91, in <module>
File "<string>", line 39, in start
ValueError: unsupported pickle protocol: 3

Python3 uses pickle to do object serializations in protocl 3,
but pickle in python2 doesn't support the protocol.

Fix it by running python3 explicitly on client.

Signed-off-by: Su Yue <[email protected]>
---
nfstest/rexec.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/nfstest/rexec.py b/nfstest/rexec.py
index 51586c5..5c206e6 100644
--- a/nfstest/rexec.py
+++ b/nfstest/rexec.py
@@ -276,7 +276,7 @@ class Rexec(BaseObj):
# Execute minimal python script to execute the source code
# given in standard input
pysrc = "import sys; exec(sys.stdin.read(%d))" % len(server_code)
- cmdlist = ["python", "-c", repr(pysrc)]
+ cmdlist = ["python3", "-c", repr(pysrc)]

if sudo:
cmdlist.insert(0, "sudo")
--
2.30.1 (Apple Git-130)