pynfs: fix nfs4server.py TypeError problem
Subsystems (2)
PATCH 1/1 pynfs: fix nfs4server.py TypeError problem
without this patch, we will always get follow error:
'''
[root@rhel-9-latest nfs4.1]# python3 ./nfs4server.py -r -v --is_ds --exports=ds_exports --port=12345 Mounting (4, 0) on '/config'
Traceback (most recent call last):
File "/usr/src/pynfs/nfs4.1/./nfs4server.py", line 2115, in <module>
S = NFS4Server(port=opts.port,
File "/usr/src/pynfs/nfs4.1/./nfs4server.py", line 577, in __init__
self.mount(ConfigFS(self), path="/config")
File "/usr/src/pynfs/nfs4.1/./nfs4server.py", line 620, in mount
for comp in nfs4lib.path_components(path):
File "/usr/src/pynfs/nfs4.1/nfs4lib.py", line 552, in path_components
for c in path.split(b'/'):
TypeError: must be str or None, not bytes
'''
--- nfs4.1/nfs4lib.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
nfs4.1/nfs4lib.py +1 -1
@@ -549,7 +549,7 @@ def parse_nfs_url(url): def path_components(path, use_dots=True): """Convert a string '/a/b/c' into an array ['a', 'b', 'c']""" out = [] - for c in path.split(b'/'): + for c in path.split('/'): if c == b'': pass elif use_dots and c == b'.':
Signature · 1 line
2.51.0
Quoted 26 lines · Jianhong Yin
without this patch, we will always get follow error:
'''
[root@rhel-9-latest nfs4.1]# python3 ./nfs4server.py -r -v --is_ds --exports=ds_exports --port=12345 Mounting (4, 0) on '/config'
Traceback (most recent call last):
File "/usr/src/pynfs/nfs4.1/./nfs4server.py", line 2115, in <module>
S = NFS4Server(port=opts.port,
File "/usr/src/pynfs/nfs4.1/./nfs4server.py", line 577, in__init__
self.mount(ConfigFS(self), path="/config")
File "/usr/src/pynfs/nfs4.1/./nfs4server.py", line 620, in mount
for comp innfs4lib.path_components(path):
File "/usr/src/pynfs/nfs4.1/nfs4lib.py", line 552, inpath_componentsfor c in path.split(b'/'):TypeError: must be str or None, not bytes
'''Signed-off-by Jianhong Yin <[email protected]>--- nfs4.1/nfs4lib.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)nfs4.1/nfs4lib.py +0
-0
nfs4.1/nfs4lib.py def parse_nfs_url(url): · line 555
Quoted 8 lines
nfs4.1/nfs4lib.py +1
-1@@ -549,7 +549,7 @@ def parse_nfs_url(url): def path_components(path, use_dots=True): """Convert a string '/a/b/c' into an array ['a', 'b', 'c']""" out = [] - for c in path.split(b'/'): + for c in path.split('/'): if c == b'': pass elif use_dots and c == b'.':
Looks reasonable:
Quoted 38 lines · Jeff Layton
Quoted 26 lines · Jianhong Yin
without this patch, we will always get follow error:
'''
[root@rhel-9-latest nfs4.1]# python3 ./nfs4server.py -r -v --is_ds --exports=ds_exports --port=12345 Mounting (4, 0) on '/config'
Traceback (most recent call last):File "/usr/src/pynfs/nfs4.1/./nfs4server.py", line 2115, in <module> S = NFS4Server(port=opts.port, File "/usr/src/pynfs/nfs4.1/./nfs4server.py", line 577, in __init__ self.mount(ConfigFS(self), path="/config") File "/usr/src/pynfs/nfs4.1/./nfs4server.py", line 620, in mount for comp in nfs4lib.path_components(path): File "/usr/src/pynfs/nfs4.1/nfs4lib.py", line 552, in path_components for c in path.split(b'/'):TypeError: must be str or None, not bytes
'''Signed-off-by Jianhong Yin <[email protected]>--- nfs4.1/nfs4lib.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)nfs4.1/nfs4lib.py +0
-0nfs4.1/nfs4lib.py def parse_nfs_url(url): · line 555
Quoted 8 lines
nfs4.1/nfs4lib.py +1
-1@@ -549,7 +549,7 @@ def parse_nfs_url(url): def path_components(path, use_dots=True): """Convert a string '/a/b/c' into an array ['a', 'b', 'c']""" out = [] - for c in path.split(b'/'): + for c in path.split('/'): if c == b'': pass elif use_dots and c == b'.':Looks reasonable:
Quoted 1 line
Reviewed-by Jeff Layton <[email protected]>
Thank you both.
I have a little backlog of pynfs fixes to apply, which I'll get to next week.
cheers,
c.
Quoted 40 lines · Calum Mackay
Quoted 38 lines · Jeff Layton
Quoted 26 lines · Jianhong Yin
without this patch, we will always get follow error:
'''
[root@rhel-9-latest nfs4.1]# python3 ./nfs4server.py -r -v --is_ds --exports=ds_exports --port=12345 Mounting (4, 0) on '/config'
Traceback (most recent call last):File "/usr/src/pynfs/nfs4.1/./nfs4server.py", line 2115, in <module> S = NFS4Server(port=opts.port, File "/usr/src/pynfs/nfs4.1/./nfs4server.py", line 577, in __init__ self.mount(ConfigFS(self), path="/config") File "/usr/src/pynfs/nfs4.1/./nfs4server.py", line 620, in mount for comp in nfs4lib.path_components(path): File "/usr/src/pynfs/nfs4.1/nfs4lib.py", line 552, in path_components for c in path.split(b'/'):TypeError: must be str or None, not bytes
'''Signed-off-by Jianhong Yin <[email protected]>--- nfs4.1/nfs4lib.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)nfs4.1/nfs4lib.py +0
-0nfs4.1/nfs4lib.py def parse_nfs_url(url): · line 555
Quoted 8 lines
nfs4.1/nfs4lib.py +1
-1@@ -549,7 +549,7 @@ def parse_nfs_url(url): def path_components(path, use_dots=True): """Convert a string '/a/b/c' into an array ['a', 'b', 'c']""" out = [] - for c in path.split(b'/'): + for c in path.split('/'): if c == b'': pass elif use_dots and c == b'.':Looks reasonable:
Quoted 6 lines
Quoted 1 line
Reviewed-by Jeff Layton <[email protected]>Thank you both.
I have a little backlog of pynfs fixes to apply, which I'll get to next week.
Great! Looking forward to the update next week; and will test it and provide feedback.
BTW: Now nfs4server.py mds start process still have lots of fail, like:
'''
File "/usr/src/pynfs/nfs4.1/xdrdef/nfs4_pack.py", line 4534, inpack_nfs_resop4
self.pack_EXCHANGE_ID4res(data.opexchange_id)
File "/usr/src/pynfs/nfs4.1/xdrdef/nfs4_pack.py", line 2665, inpack_EXCHANGE_ID4res
self.pack_EXCHANGE_ID4resok(data.eir_resok4)
File "/usr/src/pynfs/nfs4.1/xdrdef/nfs4_pack.py", line 2649, inpack_EXCHANGE_ID4resok
self.pack_opaque(to_str(data.eir_server_scope))
File "/usr/local/lib/python3.9/site-packages/xdrlib3/__init__.py",
line 121, in pack_string
self.pack_fstring(n, s)
File "/usr/local/lib/python3.9/site-packages/xdrlib3/__init__.py",
line 113, in pack_fstring
data = data + (n - len(data)) * b"\0"
TypeError: can only concatenate str (not "bytes") to str '''
seems we need adding some type converting in xdrgen.py? (I'm not sure)
Thanks!
Jianhong
Quoted 5 lines
cheers,
c.