[PATCH 18/24] pynfs: python3 support plan: fix 'TypeError: must be str, not bytes'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: "Jianhong.Yin" <yin-jianhong@xxxxxxx>

Signed-off-by: Jianhong Yin <yin-jianhong@xxxxxxx>
---
 nfs4.0/lib/rpc/rpcsec/sec_auth_sys.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/nfs4.0/lib/rpc/rpcsec/sec_auth_sys.py b/nfs4.0/lib/rpc/rpcsec/sec_auth_sys.py
index 778d379..5b7fe33 100644
--- a/nfs4.0/lib/rpc/rpcsec/sec_auth_sys.py
+++ b/nfs4.0/lib/rpc/rpcsec/sec_auth_sys.py
@@ -13,7 +13,10 @@ class SecAuthSys(SecFlavor):
         try:
             p = Packer()
             p.pack_int(stamp)
-            p.pack_string(machinename)
+            try:    # for python2
+                p.pack_string(machinename)
+            except: # for python3
+                p.pack_string(bytes(machinename, 'utf-8'))
             p.pack_uint(uid)
             p.pack_uint(gid)
             p.pack_array(gids, p.pack_uint)
-- 
2.17.1

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux