From patchwork Tue Jul 24 07:33:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jianhong Yin X-Patchwork-Id: 10541397 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9D53717FD for ; Tue, 24 Jul 2018 07:34:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 71C8328759 for ; Tue, 24 Jul 2018 07:34:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6532828761; Tue, 24 Jul 2018 07:34:04 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A74CE28759 for ; Tue, 24 Jul 2018 07:33:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388401AbeGXIjF (ORCPT ); Tue, 24 Jul 2018 04:39:05 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:60396 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2388387AbeGXIjF (ORCPT ); Tue, 24 Jul 2018 04:39:05 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 540DC401EF17; Tue, 24 Jul 2018 07:33:50 +0000 (UTC) Received: from dhcp-12-115.nay.redhat.com (unknown [10.66.12.115]) by smtp.corp.redhat.com (Postfix) with ESMTP id 34010178B7; Tue, 24 Jul 2018 07:33:46 +0000 (UTC) From: jiyin@redhat.com To: bfields@redhat.com Cc: linux-nfs@vger.kernel.org, "Jianhong.Yin" Subject: [PATCH 01/24] pynfs: python3 support plan: print -> print() Date: Tue, 24 Jul 2018 15:33:19 +0800 Message-Id: <20180724073342.5738-1-jiyin@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Tue, 24 Jul 2018 07:33:50 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Tue, 24 Jul 2018 07:33:50 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'jiyin@redhat.com' RCPT:'' Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: "Jianhong.Yin" '/print / {:lop /[^\\]$/! {N; b lop}; s/print /print(/; s/$/)/; }' Signed-off-by: Jianhong Yin --- nfs4.0/lib/rpc/rpc.py | 56 +++---- nfs4.0/lib/rpc/rpcsec/sec_auth_gss.py | 8 +- nfs4.0/nfs4acl.py | 2 +- nfs4.0/nfs4client.py | 14 +- nfs4.0/nfs4lib.py | 18 +-- nfs4.0/nfs4server.py | 168 ++++++++++----------- nfs4.0/nfs4state.py | 32 ++-- nfs4.0/servertests/environment.py | 14 +- nfs4.0/servertests/st_delegation.py | 6 +- nfs4.0/servertests/st_fslocations.py | 22 +-- nfs4.0/servertests/st_getattr.py | 10 +- nfs4.0/servertests/st_reboot.py | 2 +- nfs4.0/testserver.py | 30 ++-- nfs4.1/block.py | 8 +- nfs4.1/client41tests/ct_reboot.py | 10 +- nfs4.1/client41tests/environment.py | 4 +- nfs4.1/config.py | 10 +- nfs4.1/errorparser.py | 2 +- nfs4.1/locking.py | 6 +- nfs4.1/nfs4lib.py | 6 +- nfs4.1/nfs4proxy.py | 2 +- nfs4.1/nfs4server.py | 14 +- nfs4.1/server41tests/environment.py | 8 +- nfs4.1/server41tests/st_block.py | 24 +-- nfs4.1/server41tests/st_create_session.py | 6 +- nfs4.1/server41tests/st_debug.py | 10 +- nfs4.1/server41tests/st_destroy_session.py | 2 +- nfs4.1/server41tests/st_exchange_id.py | 4 +- nfs4.1/server41tests/st_getdevicelist.py | 14 +- nfs4.1/server41tests/st_secinfo_no_name.py | 2 +- nfs4.1/setup.py | 6 +- nfs4.1/testclient.py | 30 ++-- nfs4.1/testmod.py | 29 ++-- nfs4.1/testserver.py | 30 ++-- rpc/rpc.py | 4 +- setup.py | 4 +- showresults.py | 3 +- xdr/xdrgen.py | 34 ++--- 38 files changed, 329 insertions(+), 325 deletions(-) diff --git a/nfs4.0/lib/rpc/rpc.py b/nfs4.0/lib/rpc/rpc.py index 5ef2e3e..48e3093 100644 --- a/nfs4.0/lib/rpc/rpc.py +++ b/nfs4.0/lib/rpc/rpc.py @@ -1,6 +1,6 @@ # rpc.py - based on RFC 1831 # -# Requires python 2.3 +# Requires python 2.7 # # Written by Fred Isaman # Copyright (C) 2004 University of Michigan, Center for @@ -230,7 +230,7 @@ class RPCClient(object): if why[0] == errno.EADDRINUSE: port += 1 else: - print "Could not use low port" + print("Could not use low port") return def getsocket(self): @@ -326,13 +326,13 @@ class RPCClient(object): header, cred = self.get_call_header(xid, program, version, procedure) data = self.security.secure_data(data, cred) try: - if self.debug: print "send %i" % xid + if self.debug: print("send %i" % xid) self.socket.send_record(header + data) except socket.timeout: raise except socket.error, e: - print "Got error:", e - if self.debug: print "resend", xid + print("Got error:", e) + if self.debug: print("resend", xid) try: self.reconnect().send_record(header + data) except socket.error: @@ -346,7 +346,7 @@ class RPCClient(object): # If xid not on list, return error. # Listen until get reply with given xid. Cache others received # on list. Return error if get one not on list. - if self.debug: print "listen", xid + if self.debug: print("listen", xid) list = self.get_outstanding_xids() if xid not in list: raise @@ -361,8 +361,8 @@ class RPCClient(object): except socket.timeout: raise except socket.error, e: - print "Got error:", e - if self.debug: print "relisten", xid + print("Got error:", e) + if self.debug: print("relisten", xid) try: s = self.reconnect() s.send_record(list[xid].header + list[xid].data) @@ -472,21 +472,21 @@ class Server(object): def run(self, debug=0): while 1: - if debug: print "%s: Calling poll" % self.name + if debug: print("%s: Calling poll" % self.name) res = self.p.poll() - if debug: print "%s: %s" % (self.name, res) + if debug: print("%s: %s" % (self.name, res)) for fd, event in res: if debug: - print "%s: Handling fd=%i, event=%x" % \ - (self.name, fd, event) + print("%s: Handling fd=%i, event=%x" % \ + (self.name, fd, event)) if event & select.POLLHUP: self.event_hup(fd) elif event & select.POLLNVAL: - if debug: print "%s: POLLNVAL for fd=%i" % (self.name, fd) + if debug: print("%s: POLLNVAL for fd=%i" % (self.name, fd)) self.p.unregister(fd) elif event & ~(select.POLLIN | select.POLLOUT): - print "%s: ERROR: event %i for fd %i" % \ - (self.name, event, fd) + print("%s: ERROR: event %i for fd %i" % \ + (self.name, event, fd)) self.event_error(fd) else: if event & select.POLLOUT: @@ -534,9 +534,9 @@ class RPCServer(Server): csock, caddr = self.s.accept() csock.setblocking(0) if debug: - print "SERVER: got connection from %s, " \ + print("SERVER: got connection from %s, " \ "assigned to fd=%i" % \ - (csock.getpeername(), csock.fileno()) + (csock.getpeername(), csock.fileno())) self.p.register(csock, _readmask) cfd = csock.fileno() self.readbufs[cfd] = '' @@ -550,7 +550,7 @@ class RPCServer(Server): Also responds to command codes sent as encoded integers """ - if debug: print "SERVER: In read event for %i" % fd + if debug: print("SERVER: In read event for %i" % fd) self.readbufs[fd] += data loop = True while loop: @@ -566,7 +566,7 @@ class RPCServer(Server): if self.readbufs[fd]: loop = True # We've received data past last if last: - if debug: print "SERVER: Received record from %i" % fd + if debug: print("SERVER: Received record from %i" % fd) recv_data = ''.join(self.packetbufs[fd]) self.packetbufs[fd] = [] if len(recv_data) == 4: @@ -579,14 +579,14 @@ class RPCServer(Server): self.p.register(fd, _bothmask) def event_write(self, fd, chunksize=2048, debug=0): - if debug: print "SERVER: In write event for %i" % fd + if debug: print("SERVER: In write event for %i" % fd) if self.writebufs[fd]: - if debug: print " writing from writebuf" + if debug: print(" writing from writebuf") count = self.sockets[fd].send(self.writebufs[fd]) self.writebufs[fd] = self.writebufs[fd][count:] # check if done? elif self.recordbufs[fd]: - if debug: print " writing from recordbuf" + if debug: print(" writing from recordbuf") data = self.recordbufs[fd][0] chunk = data[:chunksize] if len(data) > chunksize: @@ -601,12 +601,12 @@ class RPCServer(Server): count = self.sockets[fd].send(self.writebufs[fd]) self.writebufs[fd] = self.writebufs[fd][count:] else: - if debug: print " done writing" + if debug: print(" done writing") self.p.register(fd, _readmask) def event_command(self, cfd, comm, debug=0): if debug: - print "SERVER: command = %i, cfd = %i" % (comm, cfd) + print("SERVER: command = %i, cfd = %i" % (comm, cfd)) if comm == 0: # Turn off server self.compute_reply = lambda x: None return '\0'*4 @@ -616,7 +616,7 @@ class RPCServer(Server): def event_close(self, fd, debug=0): if debug: - print "SERVER: closing %i" % fd + print("SERVER: closing %i" % fd) self.event_error(fd) def event_error(self, fd): @@ -636,16 +636,16 @@ class RPCServer(Server): try: recv_msg = self.rpcunpacker.unpack_rpc_msg() except xdrlib.Error, e: - print "XDRError", e + print("XDRError", e) return if recv_msg.body.mtype != CALL: - print "Received a REPLY, expected a CALL" + print("Received a REPLY, expected a CALL") return # Check for reasons to deny the call call = recv_msg.body.cbody cred = call.cred flavor = cred.flavor - #print call + #print(call) reply_stat = MSG_ACCEPTED areply = rreply = None proc_response = '' diff --git a/nfs4.0/lib/rpc/rpcsec/sec_auth_gss.py b/nfs4.0/lib/rpc/rpcsec/sec_auth_gss.py index 314924b..2c68875 100644 --- a/nfs4.0/lib/rpc/rpcsec/sec_auth_gss.py +++ b/nfs4.0/lib/rpc/rpcsec/sec_auth_gss.py @@ -204,7 +204,7 @@ class SecAuthGss(SecFlavor): p.done() d = gssapi.acceptSecContext(token, body.handle) if d["major"] == GSS_S_COMPLETE: - print "SUCCESS!" + print("SUCCESS!") class C(object): pass out = C() @@ -223,11 +223,11 @@ class SecAuthGss(SecFlavor): else: out = hint_string(d) if out is not None: - print out + print(out) return rpc.GARBAGE_ARGS, '' else: # Stub - print "Unable to handle gss_proc==%i" % body.gss_proc + print("Unable to handle gss_proc==%i" % body.gss_proc) return rpc.GARBAGE_ARGS, '' def make_verf(self, data): """Verifier sent with each RPC call @@ -374,7 +374,7 @@ class SecAuthGss(SecFlavor): p.reset() p.pack_uint(cred.seq_num) d = gssapi.verifyMIC(self.gss_context, p.get_buffer(), rverf.body) - #print "Verify(%i):"%cred.seq_num, show_major(d['major']), show_minor(d['minor']) + #print("Verify(%i):"%cred.seq_num, show_major(d['major']), show_minor(d['minor'])) else: pass diff --git a/nfs4.0/nfs4acl.py b/nfs4.0/nfs4acl.py index 8ae32e2..91a0316 100644 --- a/nfs4.0/nfs4acl.py +++ b/nfs4.0/nfs4acl.py @@ -214,6 +214,6 @@ def printableacl(acl): for ace in acl: out += "\n" % \ (type_str[ace.type], ace.flag, ace.access_mask, ace.who) - #print "leaving printableacl with out = %s" % out + #print("leaving printableacl with out = %s" % out) return out diff --git a/nfs4.0/nfs4client.py b/nfs4.0/nfs4client.py index 90c8d2c..5916dcc 100755 --- a/nfs4.0/nfs4client.py +++ b/nfs4.0/nfs4client.py @@ -9,8 +9,8 @@ # import sys -if sys.hexversion < 0x02030000: - print "Requires python 2.3 or higher" +if sys.hexversion < 0x02070000: + print("Requires python 2.7 or higher") sys.exit(1) import os # Allow to be run stright from package root @@ -22,7 +22,7 @@ import readline try: import readline except ImportError: - print "Module readline not available." + print("Module readline not available.") #else: # import rlcompleter # readline.parse_and_bind("tab: complete") @@ -75,11 +75,11 @@ class PyShell(code.InteractiveConsole): return self.locals[attr] else: return getattr(inst, attr) - #print "\nCalled complete(%s, %i)" % (text, state) + #print("\nCalled complete(%s, %i)" % (text, state)) if text.startswith('.'): # XXX TODO - handle array indexing line = readline.get_line_buffer() - # print "Line: ", repr(line) + # print("Line: ", repr(line)) return None vars = text.split('.') base = vars[:-1] @@ -88,7 +88,7 @@ class PyShell(code.InteractiveConsole): try: inst = eval('.'.join(base), self.locals) except: - print "\nFAIL" + print("\nFAIL") traceback.print_exc() return None else: @@ -125,7 +125,7 @@ class PyShell(code.InteractiveConsole): def main(server): c = PyShell(server) c.interact("Try COMPOUND([PUTROOTFH()])") - print "Goodbye!" + print("Goodbye!") if __name__ == "__main__": main(sys.argv[1]) diff --git a/nfs4.0/nfs4lib.py b/nfs4.0/nfs4lib.py index 600bce0..a0fdce1 100644 --- a/nfs4.0/nfs4lib.py +++ b/nfs4.0/nfs4lib.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # nfs4lib.py - NFS4 library for Python # -# Requires python 2.3 +# Requires python 2.7 # # Written by Fred Isaman # Copyright (C) 2004 University of Michigan, Center for @@ -199,7 +199,7 @@ class CBServer(rpc.RPCServer): rpc.RPCServer.run(self) def handle_0(self, data, cred): - #print "*****CB received NULL******" + #print("*****CB received NULL******") if data != '': return rpc.GARBAGE_ARGS, '' else: @@ -207,7 +207,7 @@ class CBServer(rpc.RPCServer): def handle_1(self, data, cred): """Deal with CB_COMPOUND""" - print "*****CB received COMPOUND******" + print("*****CB received COMPOUND******") self.nfs4unpacker.reset(data) ok, results, tag = self.O_CB_Compound() try: @@ -245,7 +245,7 @@ class CBServer(rpc.RPCServer): # FIXME def O_CB_GetAttr(self, op, cbid): - print "******* CB_Getattr *******" + print("******* CB_Getattr *******") self.opcounts[OP_CB_GETATTR] += 1 if not self.curr_fh: return self.simple_status(NFS4ERR_NOFILEHANDLE) @@ -254,7 +254,7 @@ class CBServer(rpc.RPCServer): # FIXME def O_CB_Recall(self, op, cbid): - print "******* CB_Recall (id=%i)********" % cbid + print("******* CB_Recall (id=%i)********" % cbid) self.opcounts[OP_CB_RECALL] += 1 if self.recall_funct.get(cbid, None) is not None: res = self.recall_funct[cbid](self.client, op, cbid) @@ -301,7 +301,7 @@ class NFS4Client(rpc.RPCClient): self.cb_control.connect(('127.0.0.1', self.cb_server.port)) break except socket.error: - print "Waiting for Callback server to start" + print("Waiting for Callback server to start") def cb_command(self, comm): self.cb_control.sendall('\x80\x00\x00\x04\x00\x00\x00%s' % chr(comm)) @@ -327,7 +327,7 @@ class NFS4Client(rpc.RPCClient): minorversion=minorversion) if SHOW_TRAFFIC: print - print compoundargs + print(compoundargs) p = self.nfs4packer un_p = self.nfs4unpacker p.reset() @@ -336,7 +336,7 @@ class NFS4Client(rpc.RPCClient): un_p.reset(res) res = un_p.unpack_COMPOUND4res() if SHOW_TRAFFIC: - print res + print(res) un_p.done() # Do some error checking @@ -688,7 +688,7 @@ class NFS4Client(rpc.RPCClient): #expect = attrs.keys() #expect.sort() #if attrlist != expect: - # print "WARNING: OPENresok.attrset mismatches requested attrs" + # print("WARNING: OPENresok.attrset mismatches requested attrs") fhandle = res.resarray[-1].switch.switch.object stateid = res.resarray[-2].switch.switch.stateid rflags = res.resarray[-2].switch.switch.rflags diff --git a/nfs4.0/nfs4server.py b/nfs4.0/nfs4server.py index 37c1528..d5aea34 100755 --- a/nfs4.0/nfs4server.py +++ b/nfs4.0/nfs4server.py @@ -16,8 +16,8 @@ except: pass import sys -if sys.hexversion < 0x02030000: - print "Requires python 2.3 or higher" +if sys.hexversion < 0x02070000: + print("Requires python 2.7 or higher") sys.exit(1) import os # Allow to be run stright from package root @@ -107,15 +107,15 @@ class NFS4Server(rpc.RPCServer): def handle_0(self, data, cred): print - print "******** TCP RPC NULL CALL ********" - print " flavor = %i" % cred.flavor + print("******** TCP RPC NULL CALL ********") + print(" flavor = %i" % cred.flavor) if cred.flavor == rpc.RPCSEC_GSS: gss = self.security[cred.flavor] body = gss.read_cred(cred.body) if body.gss_proc: return gss.handle_proc(body, data) if data != '': - print " ERROR - unexpected data" + print(" ERROR - unexpected data") return rpc.GARBAGE_ARGS, '' else: return rpc.SUCCESS, '' @@ -123,12 +123,12 @@ class NFS4Server(rpc.RPCServer): def handle_1(self, data, cred): self.nfs4unpacker.reset(data) print - print "********** TCP RPC CALL ***********" + print("********** TCP RPC CALL ***********") ok, results, tag = self.O_Compound() try: self.nfs4unpacker.done() except XDRError: - print repr(self.nfs4unpacker.get_buffer()) + print(repr(self.nfs4unpacker.get_buffer())) raise return rpc.GARBAGE_ARGS, '' @@ -166,11 +166,11 @@ class NFS4Server(rpc.RPCServer): cmp4args = self.nfs4unpacker.unpack_COMPOUND4args() tag = cmp4args.tag except: # [XDRError, StandardError]: - #print "ERROR" + #print("ERROR") #raise return NFS4ERR_BADXDR, [], tag - print "TCP NFSv4 COMPOUND call, tag: %s, n_ops: %d" % \ - (repr(tag), len(cmp4args.argarray)) + print("TCP NFSv4 COMPOUND call, tag: %s, n_ops: %d" % \ + (repr(tag), len(cmp4args.argarray))) if cmp4args.minorversion <> 0: return NFS4ERR_MINOR_VERS_MISMATCH, [], tag if not verify_utf8(tag): @@ -180,26 +180,26 @@ class NFS4Server(rpc.RPCServer): ok = NFS4_OK for op in cmp4args.argarray: opname = nfs_opnum4.get(op.argop, 'op_illegal') - print "*** %s (%d) ***" % (opname, op.argop) + print("*** %s (%d) ***" % (opname, op.argop)) ok, result = getattr(self, opname.lower())(op) results += [ result ] if ok <> NFS4_OK: - print " ! error %s" % nfsstat4[ok] + print(" ! error %s" % nfsstat4[ok]) break - print "Replying. Status %s (%d)" % (nfsstat4[ok], ok) + print("Replying. Status %s (%d)" % (nfsstat4[ok], ok)) return (ok, results, tag) # FIXME def op_access(self, op): - print " CURRENT FILEHANDLE: %s" % self.curr_fh - print " REQUESTED ACCESS: %s" % access2string(op.opaccess.access) + print(" CURRENT FILEHANDLE: %s" % self.curr_fh) + print(" REQUESTED ACCESS: %s" % access2string(op.opaccess.access)) if not self.curr_fh: return simple_error(NFS4ERR_NOFILEHANDLE) all = ACCESS4_READ | ACCESS4_LOOKUP | ACCESS4_MODIFY | \ ACCESS4_EXTEND | ACCESS4_DELETE | ACCESS4_EXECUTE all = ~all if op.opaccess.access & all > 0: - print "!!!! Received invalid ACCESS bits in op.opaccess.access" + print("!!!! Received invalid ACCESS bits in op.opaccess.access") return simple_error(NFS4ERR_INVAL) a4_supported = self.curr_fh.supported_access() # according to page 140 of 3530, we only return the supported @@ -207,25 +207,25 @@ class NFS4Server(rpc.RPCServer): a4_supported = op.opaccess.access & a4_supported a4_access = self.curr_fh.evaluate_access() a4_access = op.opaccess.access & a4_access # bitwise and - print " RESULT SUPPORTED: %s" % access2string(a4_supported) - print " RESULT ACCESS: %s" % access2string(a4_access) + print(" RESULT SUPPORTED: %s" % access2string(a4_supported)) + print(" RESULT ACCESS: %s" % access2string(a4_access)) a4resok = ACCESS4resok(a4_supported, a4_access) return simple_error(NFS4_OK, a4resok) def op_close(self, op): - print " CURRENT FILEHANDLE: %s" % repr(self.curr_fh) - print " SEQID: %i" % op.opclose.seqid + print(" CURRENT FILEHANDLE: %s" % repr(self.curr_fh)) + print(" SEQID: %i" % op.opclose.seqid) stateid = op.opclose.open_stateid try: replay = self.state.check_seqid(stateid, op.opclose.seqid) if replay: self.curr_fh, args = self.check_replay(op, replay) - print "Replay args = %s"%str(args) + print("Replay args = %s"%str(args)) return simple_error(*args) # Note must cache response, so need to call raise instead of return if not self.curr_fh: raise NFS4Error(NFS4ERR_NOFILEHANDLE) - print " CLOSE fh", self.curr_fh.handle + print(" CLOSE fh", self.curr_fh.handle) self.state.close(stateid) except NFS4Error, e: self.state.advance_seqid(stateid, op, (e.code,)) @@ -238,7 +238,7 @@ class NFS4Server(rpc.RPCServer): # Note: since currently using ram based fs, we lie here (and in write) # and pretend all operations are FILE_SYNC4 def op_commit(self, op): - print " CURRENT FILEHANDLE: %s" % repr(self.curr_fh) + print(" CURRENT FILEHANDLE: %s" % repr(self.curr_fh)) if not self.curr_fh: return simple_error(NFS4ERR_NOFILEHANDLE) if self.curr_fh.get_type() == NF4DIR: @@ -251,7 +251,7 @@ class NFS4Server(rpc.RPCServer): return simple_error(NFS4_OK, c4resok) def op_create(self, op): - print " CURRENT FILEHANDLE: %s" % repr(self.curr_fh) + print(" CURRENT FILEHANDLE: %s" % repr(self.curr_fh)) if not self.curr_fh: return simple_error(NFS4ERR_NOFILEHANDLE) e = verify_name(op.opcreate.objname) @@ -265,7 +265,7 @@ class NFS4Server(rpc.RPCServer): try: old_cinfo = self.curr_fh.fattr4_change attrs = op.opcreate.createattrs - print attrs + print(attrs) attrset = self.curr_fh.create(op.opcreate.objname, op.opcreate.objtype, attrs) new_cinfo = self.curr_fh.fattr4_change self.curr_fh = self.curr_fh.lookup(op.opcreate.objname) @@ -284,7 +284,7 @@ class NFS4Server(rpc.RPCServer): return simple_error(NFS4ERR_NOTSUPP) def op_getattr(self, op): - print " ATTRMASK: %s" % [nfs4lib.get_attr_name(bit) for bit in nfs4lib.bitmap2list(op.opgetattr.attr_request)] + print(" ATTRMASK: %s" % [nfs4lib.get_attr_name(bit) for bit in nfs4lib.bitmap2list(op.opgetattr.attr_request)]) try: if not self.curr_fh: return simple_error(NFS4ERR_NOFILEHANDLE) @@ -298,15 +298,15 @@ class NFS4Server(rpc.RPCServer): def op_getfh(self, op): if not self.curr_fh: return simple_error(NFS4ERR_NOFILEHANDLE) - print " FILEHANDLE %s" % self.curr_fh.handle + print(" FILEHANDLE %s" % self.curr_fh.handle) # XXX BUG - fhcache not set on getattr or readdir(getattr) self.fhcache[self.curr_fh.handle] = self.curr_fh confirmres = GETFH4resok(str(self.curr_fh.handle)) return simple_error(NFS4_OK, confirmres) def op_link(self, op): - print " CURRENT FILEHANDLE %s" % repr(self.curr_fh) - print " SOURCE OBJECT %s" % op.oplink.newname + print(" CURRENT FILEHANDLE %s" % repr(self.curr_fh)) + print(" SOURCE OBJECT %s" % op.oplink.newname) if self.curr_fh is None or self.saved_fh is None: return simple_error(NFS4ERR_NOFILEHANDLE) if self.curr_fh.get_type() != NF4DIR: @@ -325,7 +325,7 @@ class NFS4Server(rpc.RPCServer): return simple_error(NFS4_OK, l4resok) def op_lock(self, op): - print " CURRENT FILEHANDLE %s" % repr(self.curr_fh) + print(" CURRENT FILEHANDLE %s" % repr(self.curr_fh)) try: replay = None if op.oplock.locker.new_lock_owner: @@ -364,7 +364,7 @@ class NFS4Server(rpc.RPCServer): return simple_error(NFS4_OK, l4resok) def op_lockt(self, op): - print " CURRENT FILEHANDLE %s" % repr(self.curr_fh) + print(" CURRENT FILEHANDLE %s" % repr(self.curr_fh)) if not self.curr_fh: return simple_error(NFS4ERR_NOFILEHANDLE) @@ -381,7 +381,7 @@ class NFS4Server(rpc.RPCServer): return simple_error(NFS4_OK) def op_locku(self, op): - print " CURRENT FILEHANDLE %s" % repr(self.curr_fh) + print(" CURRENT FILEHANDLE %s" % repr(self.curr_fh)) stateid = op.oplocku.lock_stateid try: replay = self.state.check_seqid(stateid, op.oplocku.seqid) @@ -400,8 +400,8 @@ class NFS4Server(rpc.RPCServer): return simple_error(NFS4_OK, sid) def op_lookup(self, op): - print " CURRENT FILEHANDLE %s" % repr(self.curr_fh) - print " REQUESTED OBJECT %s" % op.oplookup.objname + print(" CURRENT FILEHANDLE %s" % repr(self.curr_fh)) + print(" REQUESTED OBJECT %s" % op.oplookup.objname) if not self.curr_fh: return simple_error(NFS4ERR_NOFILEHANDLE) @@ -418,19 +418,19 @@ class NFS4Server(rpc.RPCServer): return simple_error(NFS4_OK) def op_lookupp(self, op): - print " CURRENT FILEHANDLE %s" % repr(self.curr_fh) + print(" CURRENT FILEHANDLE %s" % repr(self.curr_fh)) if not self.curr_fh: return simple_error(NFS4ERR_NOFILEHANDLE) if self.curr_fh.get_type() != NF4DIR: return simple_error(NFS4ERR_NOTDIR) self.curr_fh = self.curr_fh.do_lookupp() - print " PARENT FILEHANDLE %s" % repr(self.curr_fh) + print(" PARENT FILEHANDLE %s" % repr(self.curr_fh)) if self.curr_fh is None: return simple_error(NFS4ERR_NOENT) return simple_error(NFS4_OK) def op_nverify(self, op): - print " CURRENT FILEHANDLE: %s" % repr(self.curr_fh) + print(" CURRENT FILEHANDLE: %s" % repr(self.curr_fh)) if not self.curr_fh: return simple_error(NFS4ERR_NOFILEHANDLE) try: @@ -446,11 +446,11 @@ class NFS4Server(rpc.RPCServer): return simple_error(NFS4_OK) def op_open(self, op): - print " CURRENT FILEHANDLE: %s" % repr(self.curr_fh) - print " SEQID: %i" % op.opopen.seqid + print(" CURRENT FILEHANDLE: %s" % repr(self.curr_fh)) + print(" SEQID: %i" % op.opopen.seqid) owner = op.opopen.owner - print " CLIENTID: %d" % owner.clientid - print " OWNER: '%s'" % repr(owner.owner) + print(" CLIENTID: %d" % owner.clientid) + print(" OWNER: '%s'" % repr(owner.owner)) try: if not self.state.confirmed.exists(c=owner.clientid): if self.state.unconfirmed.exists(c=owner.clientid): @@ -471,14 +471,14 @@ class NFS4Server(rpc.RPCServer): if self.curr_fh.get_type() != NF4DIR: raise NFS4Error(NFS4ERR_NOTDIR) filename = op.opopen.claim.file - print " FILE %s" % filename + print(" FILE %s" % filename) e = verify_name(filename) if e: raise NFS4Error(e) # At this point we know it is CLAIM_NULL with valid filename and cfh attrset = 0L ci_old = self.curr_fh.fattr4_change if op.opopen.openhow.opentype == OPEN4_CREATE: - print " CREATING FILE." + print(" CREATING FILE.") type_reg = createtype4(NF4REG) existing = self.curr_fh.lookup(filename) if existing is not None: @@ -511,7 +511,7 @@ class NFS4Server(rpc.RPCServer): attrset = self.curr_fh.create(filename, type_reg, attrs) existing = self.curr_fh.lookup(filename) else: - print " OPENING EXISTING FILE." + print(" OPENING EXISTING FILE.") existing = self.curr_fh.lookup(filename) if existing is None: raise NFS4Error(NFS4ERR_NOENT) @@ -525,7 +525,7 @@ class NFS4Server(rpc.RPCServer): sid, flags = self.state.open(existing, owner, op.opopen.share_access, op.opopen.share_deny) except NFS4Error, e: - print "Open error" + print("Open error") self.state.advance_seqid(owner, op, (e.code,)) return simple_error(e.code) ci_new = self.curr_fh.fattr4_change @@ -539,12 +539,12 @@ class NFS4Server(rpc.RPCServer): # FIXME: actually open the attr directory, change the filehandle def op_openattr(self, op): - print " CURRENT FILEHANDLE: %s" % repr(self.curr_fh) + print(" CURRENT FILEHANDLE: %s" % repr(self.curr_fh)) return simple_error(NFS4ERR_NOTSUPP) def op_open_confirm(self, op): - print " CURRENT FILEHANDLE: %s" % repr(self.curr_fh) - print " SEQID: %i" % op.opopen_confirm.seqid + print(" CURRENT FILEHANDLE: %s" % repr(self.curr_fh)) + print(" SEQID: %i" % op.opopen_confirm.seqid) stateid = op.opopen_confirm.open_stateid try: replay = self.state.check_seqid(stateid, op.opopen_confirm.seqid, @@ -568,7 +568,7 @@ class NFS4Server(rpc.RPCServer): return simple_error(NFS4_OK, oc4resok) def op_open_downgrade(self, op): - print " CURRENT FILEHANDLE: %s" % repr(self.curr_fh) + print(" CURRENT FILEHANDLE: %s" % repr(self.curr_fh)) stateid = op.opopen_downgrade.open_stateid try: replay = self.state.check_seqid(stateid, op.opopen_downgrade.seqid) @@ -591,7 +591,7 @@ class NFS4Server(rpc.RPCServer): return simple_error(NFS4_OK, od4resok) def op_putfh(self, op): - print " FILEHANDLE '%s'" % repr(op.opputfh.object) + print(" FILEHANDLE '%s'" % repr(op.opputfh.object)) # check access! if not self.fhcache.has_key(op.opputfh.object): return simple_error(NFS4ERR_BADHANDLE) @@ -599,22 +599,22 @@ class NFS4Server(rpc.RPCServer): return simple_error(NFS4_OK) def op_putpubfh(self, op): - print " NEW FILEHANDLE %s" % repr(self.curr_fh) + print(" NEW FILEHANDLE %s" % repr(self.curr_fh)) if self.pubfh is None: return simple_error(NFS4ERR_NOTSUPP) self.curr_fh = self.pubfh return simple_error(NFS4_OK) def op_putrootfh(self, op): - print " NEW FILEHANDLE %s" % repr(self.curr_fh) + print(" NEW FILEHANDLE %s" % repr(self.curr_fh)) self.curr_fh = self.rootfh return simple_error(NFS4_OK) def op_read(self, op): offset = op.opread.offset count = op.opread.count - print " CURRENT FILEHANDLE %s" % repr(self.curr_fh) - print " OFFSET: %d COUNT %d" % (offset, count) + print(" CURRENT FILEHANDLE %s" % repr(self.curr_fh)) + print(" OFFSET: %d COUNT %d" % (offset, count)) if not self.curr_fh: return simple_error(NFS4ERR_NOFILEHANDLE) if self.curr_fh.get_type() == NF4DIR: @@ -625,7 +625,7 @@ class NFS4Server(rpc.RPCServer): self.state.check_read(self.curr_fh, op.opread.stateid, offset, count) read_data = self.curr_fh.read(offset, count) - print " READ DATA: len=%i" % len(read_data) + print(" READ DATA: len=%i" % len(read_data)) except NFS4Error, e: return simple_error(e.code) if len(read_data) < count: @@ -637,10 +637,10 @@ class NFS4Server(rpc.RPCServer): def op_readdir(self, op): # We ignore dircount hint - print " CURRENT FILEHANDLE %s" % repr(self.curr_fh) - print " COOKIEVERF: %s, %s" % ( repr(op.opreaddir.cookieverf), repr(op.opreaddir.cookie)) - print " DIRCOUNT: %d MAXCOUNT: %d" % ( op.opreaddir.dircount, op.opreaddir.maxcount) - print " ATTRMASK: %s" % [nfs4lib.get_attr_name(bit) for bit in nfs4lib.bitmap2list(op.opreaddir.attr_request)] + print(" CURRENT FILEHANDLE %s" % repr(self.curr_fh)) + print(" COOKIEVERF: %s, %s" % ( repr(op.opreaddir.cookieverf), repr(op.opreaddir.cookie))) + print(" DIRCOUNT: %d MAXCOUNT: %d" % ( op.opreaddir.dircount, op.opreaddir.maxcount)) + print(" ATTRMASK: %s" % [nfs4lib.get_attr_name(bit) for bit in nfs4lib.bitmap2list(op.opreaddir.attr_request)]) if not self.curr_fh: return simple_error(NFS4ERR_NOFILEHANDLE) if self.curr_fh.get_type() != NF4DIR: @@ -699,19 +699,19 @@ class NFS4Server(rpc.RPCServer): return simple_error(NFS4_OK, rdresok) def op_readlink(self, op): - print " CURRENT FILEHANDLE: %s" % repr(self.curr_fh) + print(" CURRENT FILEHANDLE: %s" % repr(self.curr_fh)) if not self.curr_fh: return simple_error(NFS4ERR_NOFILEHANDLE) if self.curr_fh.get_type() != NF4LNK: return simple_error(NFS4ERR_INVAL) link_text = self.curr_fh.read_link() - print " LINK_TEXT: %s" % link_text + print(" LINK_TEXT: %s" % link_text) rl4resok = READLINK4resok(link_text) return simple_error(NFS4_OK, rl4resok) def op_remove(self, op): - print " CURRENT FILEHANDLE: %s" % repr(self.curr_fh) - print " TARGET: %s" % op.opremove.target + print(" CURRENT FILEHANDLE: %s" % repr(self.curr_fh)) + print(" TARGET: %s" % op.opremove.target) #XXX: CHECK ACCESS if self.curr_fh is None: return simple_error(NFS4ERR_NOFILEHANDLE) @@ -732,10 +732,10 @@ class NFS4Server(rpc.RPCServer): return simple_error(NFS4_OK, r4resok) def op_rename(self, op): - print " SAVED FILEHANDLE: %s" % repr(self.saved_fh) # old dir - print " CURRENT FILEHANDLE: %s" % repr(self.curr_fh) # new dir - print " OLD NAME: %s" % op.oprename.oldname - print " NEW NAME: %s" % op.oprename.newname + print(" SAVED FILEHANDLE: %s" % repr(self.saved_fh) # old dir) + print(" CURRENT FILEHANDLE: %s" % repr(self.curr_fh) # new dir) + print(" OLD NAME: %s" % op.oprename.oldname) + print(" NEW NAME: %s" % op.oprename.newname) if self.curr_fh is None or self.saved_fh is None: return simple_error(NFS4ERR_NOFILEHANDLE) oldname = op.oprename.oldname @@ -782,14 +782,14 @@ class NFS4Server(rpc.RPCServer): return simple_error(NFS4_OK) def op_restorefh(self, op): - print " SAVED FILEHANDLE: %s" % repr(self.saved_fh) + print(" SAVED FILEHANDLE: %s" % repr(self.saved_fh)) if not self.saved_fh: return simple_error(NFS4ERR_RESTOREFH) self.curr_fh = self.saved_fh return simple_error(NFS4_OK) def op_savefh(self, op): - print " CURRENT FILEHANDLE: %s" % repr(self.curr_fh) + print(" CURRENT FILEHANDLE: %s" % repr(self.curr_fh)) if not self.curr_fh: return simple_error(NFS4ERR_NOFILEHANDLE) self.saved_fh = self.curr_fh @@ -798,7 +798,7 @@ class NFS4Server(rpc.RPCServer): # FIXME: no idea how to set up NFS4_OK conditions; actually get sec information def op_secinfo(self, op): # STUB - print " CURRENT FILEHANDLE: %s" % repr(self.curr_fh) + print(" CURRENT FILEHANDLE: %s" % repr(self.curr_fh)) if not self.curr_fh: return simple_error(NFS4ERR_NOFILEHANDLE) if self.curr_fh.get_type() != NF4DIR: @@ -809,8 +809,8 @@ class NFS4Server(rpc.RPCServer): return simple_error(NFS4_OK, resok) def op_setattr(self, op): - print " CURRENT FILEHANDLE: %s" % repr(self.curr_fh) - print op.opsetattr.obj_attributes + print(" CURRENT FILEHANDLE: %s" % repr(self.curr_fh)) + print(op.opsetattr.obj_attributes) if not self.curr_fh: return simple_error(NFS4ERR_NOFILEHANDLE, 0L) try: @@ -835,7 +835,7 @@ class NFS4Server(rpc.RPCServer): return simple_error(NFS4_OK, attrset) def op_setclientid(self, op): - print " ID: %s" % ( op.opsetclientid.client.id) + print(" ID: %s" % ( op.opsetclientid.client.id)) x = op.opsetclientid.client.id v = op.opsetclientid.client.verifier k = (op.opsetclientid.callback, op.opsetclientid.callback_ident) @@ -860,7 +860,7 @@ class NFS4Server(rpc.RPCServer): # This should never happen return simple_error(NFS4ERR_INVAL) s = self.nextverf() - print " VERIFIER: %s" % repr(s) + print(" VERIFIER: %s" % repr(s)) self.state.unconfirmed.add(v,x,c,k,s,p) resok = SETCLIENTID4resok(c, s) return simple_error(NFS4_OK, resok) @@ -869,7 +869,7 @@ class NFS4Server(rpc.RPCServer): c = op.opsetclientid_confirm.clientid s = op.opsetclientid_confirm.setclientid_confirm p = "Stub" # Principal - print " ARGS, clientid %s, verifier %s" % (c, printverf(s)) + print(" ARGS, clientid %s, verifier %s" % (c, printverf(s))) # NOTE this makes the assumption that only one entry can match c=c entry = self.state.confirmed.find(c=c) entry2 = self.state.unconfirmed.find(c=c) @@ -900,7 +900,7 @@ class NFS4Server(rpc.RPCServer): return simple_error(NFS4_OK) def op_verify(self, op): - print " CURRENT FILEHANDLE %s" % repr(self.curr_fh) + print(" CURRENT FILEHANDLE %s" % repr(self.curr_fh)) if not self.curr_fh: return simple_error(NFS4ERR_NOFILEHANDLE) try: @@ -920,21 +920,21 @@ class NFS4Server(rpc.RPCServer): def op_write(self, op): offset = op.opwrite.offset data = op.opwrite.data - print " CURRENT FILEHANDLE %s" % repr(self.curr_fh) - print " OFFSET: %d COUNT %d" % (offset, len(data)) - print " STATEID { seqid: %s other: %s}" % (repr(op.opwrite.stateid.seqid), repr(op.opwrite.stateid.other)) + print(" CURRENT FILEHANDLE %s" % repr(self.curr_fh)) + print(" OFFSET: %d COUNT %d" % (offset, len(data))) + print(" STATEID { seqid: %s other: %s}" % (repr(op.opwrite.stateid.seqid), repr(op.opwrite.stateid.other))) if not self.curr_fh: return simple_error(NFS4ERR_NOFILEHANDLE) if self.curr_fh.get_type() == NF4DIR: return simple_error(NFS4ERR_ISDIR) if self.curr_fh.get_type() != NF4REG: return simple_error(NFS4ERR_INVAL) - #print " DATA: %s" % op.opwrite.data + #print(" DATA: %s" % op.opwrite.data) try: self.state.check_write(self.curr_fh, op.opwrite.stateid, offset, len(data)) count = self.curr_fh.write(offset, data) - print " wrote %i bytes" % count + print(" wrote %i bytes" % count) except NFS4Error, e: return simple_error(e.code) w4resok = WRITE4resok(count, FILE_SYNC4, self.state.write_verifier) @@ -956,10 +956,10 @@ def startup(host, port): raise #server.register() except: - print "!! unable to register with portmap" + print("!! unable to register with portmap") pass - print "Python NFSv4 Server, (c) CITI, Regents of the University of Michigan" - print "Starting Server, root handle: %s" % rootfh + print("Python NFSv4 Server, (c) CITI, Regents of the University of Michigan") + print("Starting Server, root handle: %s" % rootfh ) server.run() try: server.unregister() diff --git a/nfs4.0/nfs4state.py b/nfs4.0/nfs4state.py index d32da29..fb3fd5c 100755 --- a/nfs4.0/nfs4state.py +++ b/nfs4.0/nfs4state.py @@ -244,14 +244,14 @@ class NFSServerState: See RFC 3530 sec 8.1.5 """ # This is getting too complicated. Should split off creation - #print " check_seqid: Entered" + #print(" check_seqid: Entered") if isinstance(obj, stateid4): mustexist = True try: info = self.__getinfo(obj, allownew=not mustexist) except ValueError, e: if mustexist: raise - #print " check_seqid: %s" % info + #print(" check_seqid: %s" % info) if info is None: # A reserved stateid raise NFS4Error(NFS4ERR_BAD_STATEID) @@ -267,9 +267,9 @@ class NFSServerState: info.lastseqid = mod32(-1) return lastseq = info.lastseqid - #print " check_seqid: new: %s, last: %s" % (seqid, lastseq) + #print(" check_seqid: new: %s, last: %s" % (seqid, lastseq)) if lastseq == seqid: - print " ***REPLAY*** " + print(" ***REPLAY*** ") return info.cached_response if not info.confirmed and not open_confirm: # RFC 3530 sec 14.2.18 @@ -294,7 +294,7 @@ class NFSServerState: # FIXME - does this behave correctly for reserved stateids? return info.cached_response = (cfh, args, op) - #print " advance_seqid - went from: %s" % info.lastseqid + #print(" advance_seqid - went from: %s" % info.lastseqid) if args[0] not in [NFS4ERR_STALE_CLIENTID, NFS4ERR_STALE_STATEID, NFS4ERR_BAD_STATEID, NFS4ERR_BAD_SEQID, NFS4ERR_BADXDR, NFS4ERR_RESOURCE, @@ -303,7 +303,7 @@ class NFSServerState: info.lastseqid = 0 else: info.lastseqid = mod32(info.lastseqid + 1) - #print " advance_seqid - to: %s" % info.lastseqid + #print(" advance_seqid - to: %s" % info.lastseqid) def confirm(self, fh, stateid): """Confirm an open""" @@ -352,7 +352,7 @@ class NFSServerState: raise NFS4Error(NFS4ERR_BAD_STATEID) info = self.state[id].owner fh = self.__getfh(id) - #print "Close fh from id", fh.handle + #print("Close fh from id", fh.handle) # Remove locks from file and deal with associated lockowners for lockinfo in info.lockowners: if fh.handle in lockinfo.files: @@ -412,7 +412,7 @@ class NFSServerState: except KeyError: if not allownew: raise ValueError, "File %s not open for %s" % (fh.name, info) - #print "Creating new id %i for fh %s" % (self.next_id, fh.handle) + #print("Creating new id %i for fh %s" % (self.next_id, fh.handle)) id = info.files[fh.handle] = self.next_id self.next_id += 1 self.state[id] = self.StateIDInfo(fh, info) @@ -434,7 +434,7 @@ class NFSServerState: info = ownerdict[owner.clientid][owner.owner] except KeyError: if not allownew: raise ValueError, "Unknown owner %s" % str(owner) - #print "Creating new info" + #print("Creating new info") info = self.OwnerInfo(owner) if owner.clientid in ownerdict: ownerdict[owner.clientid][owner.owner] = info @@ -853,14 +853,14 @@ class NFSFileState: list[i].type == list[i-1].type: list[i-1].end = list[i].end del list[i] - print list + print(list) def removeposixlock(self, list, type, start, end): """Removes lock from sorted list, splitting existing locks as necessary """ self.__removerange(list, start, end) list.sort() - print list + print(list) def __removerange(self, list, start, end): """Removes locks in given range, shrinking locks that half-overlap""" @@ -1171,9 +1171,9 @@ class VirtualHandle(NFSFileHandle): try: nfs4acl.maps_to_posix(acl) except nfs4acl.ACLError, e: - print "*"*50 - print e - print "*"*50 + print("*"*50) + print(e) + print("*"*50) raise NFS4Error(NFS4ERR_INVAL) self.fattr4_acl = acl self.fattr4_mode = nfs4acl.acl2mode(acl) @@ -1257,7 +1257,7 @@ class VirtualHandle(NFSFileHandle): # FRED - Note this currently does nothing - # - and should do nothing if link count is positive if self.fattr4_numlinks > 0: return - #print "destructing: %s" % repr(self) + #print("destructing: %s" % repr(self)) if self.fattr4_type == NF4DIR: for subfile in self.dirent.values(): subfile.destruct() @@ -1324,7 +1324,7 @@ class VirtualHandle(NFSFileHandle): self.fattr4_change += 1 try: self.file.seek(offset) except MemoryError: - print "MemError, offset=%s, count=%s" % (str(offset), str(len(data))) + print("MemError, offset=%s, count=%s" % (str(offset), str(len(data)))) raise self.file.write(data) self.file.seek(0, 2) # Seek to eof diff --git a/nfs4.0/servertests/environment.py b/nfs4.0/servertests/environment.py index 4f37d0f..a848ed4 100644 --- a/nfs4.0/servertests/environment.py +++ b/nfs4.0/servertests/environment.py @@ -1,7 +1,7 @@ # # environment.py # -# Requires python 2.3 +# Requires python 2.7 # # Written by Fred Isaman # Copyright (C) 2004 University of Michigan, Center for @@ -183,7 +183,7 @@ class Environment(testmod.Environment): path = tree + [name[type]] res = c.create_obj(path, type) if res.status != NFS4_OK: - print "WARNING - could not create /%s" % '/'.join(path) + print("WARNING - could not create /%s" % '/'.join(path)) c.init_connection() fh, stateid = c.create_confirm('maketree', tree + ['file'], deny=OPEN4_SHARE_DENY_NONE) @@ -209,18 +209,18 @@ class Environment(testmod.Environment): def sleep(self, sec, msg=''): """Sleep for given seconds""" - print "Sleeping for %g seconds:" % sec, msg + print("Sleeping for %g seconds:" % sec, msg) time.sleep(sec) - print "Woke up" + print("Woke up") def serverhelper(self, args): """Perform a special operation on the server side (such as rebooting the server)""" if self.opts.serverhelper is None: - print "Manual operation required on server:" - print args + " and hit ENTER when done" + print("Manual operation required on server:") + print(args + " and hit ENTER when done") sys.stdin.readline() - print "Continuing with test" + print("Continuing with test") else: cmd = self.opts.serverhelper if self.opts.serverhelperarg: diff --git a/nfs4.0/servertests/st_delegation.py b/nfs4.0/servertests/st_delegation.py index bc4effa..a2bce04 100644 --- a/nfs4.0/servertests/st_delegation.py +++ b/nfs4.0/servertests/st_delegation.py @@ -22,7 +22,7 @@ class _handle_error(object): try: self.c.compound(ops) except Exception, e: - print "CALLBACK error in _recall:", e + print("CALLBACK error in _recall:", e) pass _lock.release() @@ -34,7 +34,7 @@ def _recall(c, thisop, cbid): try: res = c.compound(ops) except Exception, e: - print "CALLBACK error in _recall:", e + print("CALLBACK error in _recall:", e) res = None _lock.release() if res is not None and res.status != NFS4_OK: @@ -260,7 +260,7 @@ def testManyReaddeleg(t, env, funct=_recall, response=NFS4_OK): cbids.append(c.cbid) if not cbids: t.pass_warn("Could not get any read delegations") - print "Got %i out of %i read delegations" % (len(cbids), count) + print("Got %i out of %i read delegations" % (len(cbids), count)) # Cause them to be recalled fh2, stateid2 = _cause_recall(t, env) miss_count = 0 diff --git a/nfs4.0/servertests/st_fslocations.py b/nfs4.0/servertests/st_fslocations.py index 102db52..442d5a2 100644 --- a/nfs4.0/servertests/st_fslocations.py +++ b/nfs4.0/servertests/st_fslocations.py @@ -20,7 +20,7 @@ def testReference(t, env): res = c.compound(ops) check(res, NFS4ERR_MOVED, "GETFH of path indicated by --usespecial") locs = c.do_getattr(FATTR4_FS_LOCATIONS, path) - print "After NFS4ERR_MOVED, GETATTR(fs_locations) = %s" % locs + print("After NFS4ERR_MOVED, GETATTR(fs_locations) = %s" % locs) def testReference2(t, env): """FSLOCATION test of referral node @@ -33,7 +33,7 @@ def testReference2(t, env): c = env.c1 path = env.opts.usespecial locs = c.do_getattr(FATTR4_FS_LOCATIONS, path) - print "After NFS4ERR_MOVED, GETATTR(fs_locations) = %s" % locs + print("After NFS4ERR_MOVED, GETATTR(fs_locations) = %s" % locs) def testReference3(t, env): """FSLOCATION test of referral node @@ -46,7 +46,7 @@ def testReference3(t, env): c = env.c1 path = env.opts.usespecial locs = c.do_getattr(FATTR4_FS_LOCATIONS, c.homedir) - print "After NFS4ERR_MOVED, GETATTR(fs_locations) = %s" % locs + print("After NFS4ERR_MOVED, GETATTR(fs_locations) = %s" % locs) def testAttr1a(t, env): """GETATTR with attributes should return _MOVED @@ -104,10 +104,10 @@ def testAttr2b(t, env): attrlist = [FATTR4_SIZE, FATTR4_FILEHANDLE, FATTR4_RDATTR_ERROR, FATTR4_FSID] entries = c.do_readdir(path, attr_request=attrlist) moved = [e for e in entries if e.attrdict[FATTR4_RDATTR_ERROR] == NFS4ERR_MOVED] - print "RDATTR==MOVED for:", [e.name for e in moved] + print("RDATTR==MOVED for:", [e.name for e in moved]) for e in moved: if len(e.attrdict) != 2: - print e.attrdict + print(e.attrdict) t.fail("Expected 2 attrs returned for file %s, got %i" % (e.name, len(e.attrdict))) def testAttr3a(t, env): @@ -137,7 +137,7 @@ def testAttr3b(t, env): entries = c.do_readdir(path, attr_request=attrlist) moved = [e for e in entries if e.name == env.opts.usespecial[-1]][0] if len(moved.attrdict) != 3: - print moved.attrdict + print(moved.attrdict) t.fail("Expected 3 attrs returned for file %s, got %i" % (moved.name, len(moved.attrdict))) def testAttr4a(t, env): @@ -150,7 +150,7 @@ def testAttr4a(t, env): path = env.opts.usespecial attrlist = [FATTR4_SIZE, FATTR4_FILEHANDLE, FATTR4_RDATTR_ERROR, FATTR4_FSID, FATTR4_FS_LOCATIONS] d = c.do_getattrdict(path, attrlist) - print d + print(d) if len(d) != 3: t.fail("Expected 3 attrs returned, got %i" % len(d)) @@ -167,10 +167,10 @@ def testAttr4b(t, env): attrlist = [FATTR4_SIZE, FATTR4_FILEHANDLE, FATTR4_RDATTR_ERROR, FATTR4_FSID, FATTR4_FS_LOCATIONS] entries = c.do_readdir(path, attr_request=attrlist) moved = [e for e in entries if e.attrdict[FATTR4_RDATTR_ERROR] == NFS4ERR_MOVED] - print "RDATTR==MOVED for:", [e.name for e in moved] + print("RDATTR==MOVED for:", [e.name for e in moved]) for e in moved: if len(e.attrdict) != 3: - print e.attrdict + print(e.attrdict) t.fail("Expected 3 attrs returned for file %s, got %i" % (e.name, len(e.attrdict))) def testAttr5a(t, env): @@ -183,7 +183,7 @@ def testAttr5a(t, env): path = env.opts.usespecial attrlist = [FATTR4_SIZE, FATTR4_FILEHANDLE, FATTR4_FSID, FATTR4_FS_LOCATIONS] d = c.do_getattrdict(path, attrlist) - print d + print(d) if len(d) != 2: t.fail("Expected 3 attrs returned, got %i" % len(d)) @@ -201,6 +201,6 @@ def testAttr5b(t, env): entries = c.do_readdir(path, attr_request=attrlist) moved = [e for e in entries if e.name == env.opts.usespecial[-1]][0] if len(moved.attrdict) != 2: - print moved.attrdict + print(moved.attrdict) t.fail("Expected 2 attrs returned for file %s, got %i" % (moved.name, len(moved.attrdict))) diff --git a/nfs4.0/servertests/st_getattr.py b/nfs4.0/servertests/st_getattr.py index eeffa77..500542d 100644 --- a/nfs4.0/servertests/st_getattr.py +++ b/nfs4.0/servertests/st_getattr.py @@ -486,7 +486,7 @@ def testFSLocations(t, env): check(res, [NFS4_OK, NFS4ERR_ATTRNOTSUPP], "GETATTR(fs_locations)") if res.status == NFS4ERR_ATTRNOTSUPP: t.fail_support("fs_locations not a supported attribute") - # print res.resarray[-1].obj_attributes + # print(res.resarray[-1].obj_attributes) def testLotsofGetattrsFile(t, env): """Send lots of getattrs @@ -517,7 +517,7 @@ def testOwnerName(t, env): check(res, [NFS4_OK, NFS4ERR_ATTRNOTSUPP], "GETATTR(owner)") if res.status == NFS4ERR_ATTRNOTSUPP: t.fail_support("owner not a supported attribute") - # print res.resarray[-1].obj_attributes + # print(res.resarray[-1].obj_attributes) #################################################### @@ -541,9 +541,9 @@ def testOwnerName(t, env): res = self.ncl.do_ops(ops) self.assert_OK(res) print - print "From Getattr / - ", res.resarray[-3].obj_attributes + print("From Getattr / - ", res.resarray[-3].obj_attributes) print - print "From Getattr /unix - ", res.resarray[-1].obj_attributes + print("From Getattr /unix - ", res.resarray[-1].obj_attributes) ops = [op.putrootfh()] attrmask = nfs4lib.list2bitmap(request) @@ -561,6 +561,6 @@ def testOwnerName(t, env): if not entry.nextentry: self.fail("Could not find mountpoint /unix") entry = entry.nextentry[0] - print "From Readdir / - ", entry.attrs + print("From Readdir / - ", entry.attrs) diff --git a/nfs4.0/servertests/st_reboot.py b/nfs4.0/servertests/st_reboot.py index ecfc61f..33c3a4a 100644 --- a/nfs4.0/servertests/st_reboot.py +++ b/nfs4.0/servertests/st_reboot.py @@ -217,7 +217,7 @@ def testRootSquash(t, env): oldname = oldowner.split('@')[0] if oldname == 'root': t.fail_support("No root squashing detected") - print "Detected root squashing: root -> %s" % oldname + print("Detected root squashing: root -> %s" % oldname) # Wait for grace period to have *just* expired _waitForReboot(c, env) diff --git a/nfs4.0/testserver.py b/nfs4.0/testserver.py index 9af7703..c049a5a 100755 --- a/nfs4.0/testserver.py +++ b/nfs4.0/testserver.py @@ -27,7 +27,7 @@ import sys if sys.hexversion < 0x02050000: - print "Requires python 2.5 or higher" + print("Requires python 2.5 or higher") sys.exit(1) import os # Allow to be run stright from package root @@ -217,16 +217,16 @@ def printflags(list): command_names = [s.lower()[3:].replace('_', '') \ for s in nfs_opnum4.values()] list.sort() - # First print command names + # First print(command names) print for s in list: if s in command_names: - print s + print(s) # Then everything else print for s in list: if s not in command_names: - print s + print(s) def main(): nfail = -1 @@ -251,14 +251,14 @@ def main(): codes = cdict.keys() codes.sort() for c in codes: - print c + print(c) sys.exit(0) if opt.showcodesflags: codes = cdict.keys() codes.sort() for c in codes: - print c, "FLAGS:", ', '.join(cdict[c].flags_list) + print(c, "FLAGS:", ', '.join(cdict[c].flags_list)) sys.exit(0) # Grab server info and set defaults @@ -285,14 +285,14 @@ def main(): for attr in dir(opt): if attr.startswith('use') and attr != "usefh": path = getattr(opt, attr) - #print attr, path + #print(attr, path) if path is None: path = opt.path + ['tree', attr[3:]] else: # FIXME - have funct that checks path validity if path[0] != '/': p.error("Need to use absolute path for --%s" % attr) - # print path + # print(path) if path[-1] == '/' and attr != 'usedir': p.error("Can't use dir for --%s" %attr) try: @@ -337,21 +337,21 @@ def main(): # Place tests in desired order tests.sort() # FIXME - add options for random sort - # Run the tests and save/print results + # Run the tests and save/print(results) try: env = environment.Environment(opt) env.init() except socket.gaierror, e: if e.args[0] == -2: - print "Unknown server '%s'" % opt.server - print sys.exc_info()[1] + print("Unknown server '%s'" % opt.server) + print(sys.exc_info()[1]) sys.exit(1) except Exception, e: - print "Initialization failed, no tests run." + print("Initialization failed, no tests run.") if not opt.maketree: - print "Perhaps you need to use the --maketree option" + print("Perhaps you need to use the --maketree option") raise - print sys.exc_info()[1] + print(sys.exc_info()[1]) sys.exit(1) if opt.outfile is not None: fd = file(opt.outfile, 'w') @@ -371,7 +371,7 @@ def main(): fail = True nfail = testmod.printresults(tests, opt) if fail: - print "\nWARNING: could not clean testdir due to:\n%s\n" % str(e) + print("\nWARNING: could not clean testdir due to:\n%s\n" % str(e)) if opt.xmlout is not None: testmod.xml_printresults(tests, opt.xmlout) diff --git a/nfs4.1/block.py b/nfs4.1/block.py index f37bd9b..5ce5ccb 100644 --- a/nfs4.1/block.py +++ b/nfs4.1/block.py @@ -159,7 +159,7 @@ class Simple(Volume): return pnfs_block_volume4(PNFS_BLOCK_VOLUME_SIMPLE, bv_simple_info=info) def resolve(self, i): - # print "resolve(%i) %r" % (i, self) + # print("resolve(%i) %r" % (i, self)) if i < 0 or i >= self._size: raise ValueError("Asked for %i of %i" % (i, self._size)) return (self, i) @@ -186,8 +186,8 @@ class Slice(Volume): return pnfs_block_volume4(PNFS_BLOCK_VOLUME_SLICE, bv_slice_info=info) def resolve(self, i): - # print "resolve(%i) %r" % (i, self) - # print self.start, self._size, self.length + # print("resolve(%i) %r" % (i, self)) + # print(self.start, self._size, self.length) if i < 0 or i >= self._size: raise ValueError("Asked for %i of %i" % (i, self._size)) return self.volumes[0].resolve(self.start + i) @@ -212,7 +212,7 @@ class Concat(Volume): return "Concat %i of %r" % (self.id, [v.id for v in self.volumes]) def resolve(self, i): - # print "resolve(%i) %r" % (i, self) + # print("resolve(%i) %r" % (i, self)) if i < 0 or i >= self._size: raise ValueError("Asked for %i of %i" % (i, self._size)) sum = 0 diff --git a/nfs4.1/client41tests/ct_reboot.py b/nfs4.1/client41tests/ct_reboot.py index a5d54a1..3bd241b 100644 --- a/nfs4.1/client41tests/ct_reboot.py +++ b/nfs4.1/client41tests/ct_reboot.py @@ -204,12 +204,12 @@ def testTwoValueSetupOrCleanup(t, env): echo "Messagetype value value" > $CONFIG/ops/ """ - #print 'env.opts.useparams ', env.opts.useparams + #print('env.opts.useparams ', env.opts.useparams) if len(env.opts.useparams) != 4: - print 'TWO_VALUE_SETUP_OR_CLEANUP requires ' - print 'testclient.py --useparams' - print 'Example: --useparams=sequence:ERROR:NFS4ERR_SEQ_MISORDERED:50 ' - print 'which returns NFS4ERR_SEQ_MISORDERED every 50th sequence op' + print('TWO_VALUE_SETUP_OR_CLEANUP requires ') + print('testclient.py --useparams') + print('Example: --useparams=sequence:ERROR:NFS4ERR_SEQ_MISORDERED:50 ') + print('which returns NFS4ERR_SEQ_MISORDERED every 50th sequence op') fail("Bad Input to test") operation = env.opts.useparams[0] diff --git a/nfs4.1/client41tests/environment.py b/nfs4.1/client41tests/environment.py index 262c812..6b48d12 100644 --- a/nfs4.1/client41tests/environment.py +++ b/nfs4.1/client41tests/environment.py @@ -1,7 +1,7 @@ # # environment.py # -# Requires python 2.3 +# Requires python 2.7 # # Written by Fred Isaman # Copyright (C) 2004 University of Michigan, Center for @@ -144,7 +144,7 @@ class Environment(testmod.Environment): path = os.path.join(self.root, "config", "ops", opname) fd = open(path, "w") fd.write(data) - print "wait for leasetime: ", lease[1], "seconds" + print("wait for leasetime: ", lease[1], "seconds") fd.close() time.sleep(int(lease[1])) diff --git a/nfs4.1/config.py b/nfs4.1/config.py index 4747f73..1dbb2ac 100644 --- a/nfs4.1/config.py +++ b/nfs4.1/config.py @@ -49,23 +49,23 @@ def _opline(value): message-type of error has this form: "ERROR NFS4ERR_code ceiling" new message types and more values can be added """ - print '**************** OPLINE typevalue ', type(value) + print('**************** OPLINE typevalue ', type(value)) if type(value) is str: l = value.strip().split() elif type(value) is list: l = value else: - print ' OPLINE type ', type(value) + print(' OPLINE type ', type(value)) raise TypeError, 'Only type list or str accepted' if l[0] == "ERROR": if not len(l) == 3: - print ' OPLINE length ', len + print(' OPLINE length ', len) raise ValueError("ERROR messages only accepts 3 entries") - print 'OPLINE len ', len(l) + print('OPLINE len ', len(l)) value = [l[0], _statcode(l[1]), int(l[2])] else: raise ValueError("Only message-type ERROR accepted") - print '**************** OPLINE return ', value + print('**************** OPLINE return ', value) return value ################################################### diff --git a/nfs4.1/errorparser.py b/nfs4.1/errorparser.py index 3de2052..328fe8d 100755 --- a/nfs4.1/errorparser.py +++ b/nfs4.1/errorparser.py @@ -112,7 +112,7 @@ class ErrorParser(): except IndexError: # function functions = Errors() func = getattr(functions, random.choice(err.function)) - print func + print(func) if callable(func): func(opname, arg, env) diff --git a/nfs4.1/locking.py b/nfs4.1/locking.py index 7330bbc..1dc428f 100644 --- a/nfs4.1/locking.py +++ b/nfs4.1/locking.py @@ -32,7 +32,7 @@ def _collect_acq_data(suffix=""): def _deco(acquire): def wrapper(self): suf = ("" if not suffix else "_%s" % suffix) - print "ACQUIRE%s tried for lock %s" % (suf.upper(), self.name) + print("ACQUIRE%s tried for lock %s" % (suf.upper(), self.name)) t = threading.currentThread() try: t.locks[self.name] = "waiting%s" % suf @@ -40,7 +40,7 @@ def _collect_acq_data(suffix=""): t.locks = {self.name: "waiting%s" % suf} acquire(self) t.locks[self.name] = "holding%s" % suf - print "ACQUIRE%s succeeded for lock %s" % (suf.upper(), self.name) + print("ACQUIRE%s succeeded for lock %s" % (suf.upper(), self.name)) return wrapper return _deco @@ -49,7 +49,7 @@ def _collect_rel_data(suffix=""): def _deco(release): def wrapper(self, *args, **kwargs): suf = ("" if not suffix else "_%s" % suffix) - print "RELEASE%s lock %s" % (suf.upper(), self.name) + print("RELEASE%s lock %s" % (suf.upper(), self.name)) t = threading.currentThread() t.locks[self.name] = "released%s" % suf release(self, *args, **kwargs) diff --git a/nfs4.1/nfs4lib.py b/nfs4.1/nfs4lib.py index 02352e1..96752c2 100644 --- a/nfs4.1/nfs4lib.py +++ b/nfs4.1/nfs4lib.py @@ -208,7 +208,7 @@ class FancyNFS4Packer(NFS4Packer): """Change simple list of entry4 into strange chain structure""" out = [] for e in data.entries[::-1]: - # print "handle", e + # print("handle", e) # This reverses the direction of the list, so start with reversed out = [xdrdef.nfs4_type.entry4(e.cookie, e.name, e.attrs, out)] # Must not modify original data structure @@ -297,10 +297,10 @@ def bitmap2list(bitmap): def printhex(str, pretty=True): """Print string as hex digits""" if pretty: - print "".join(["%02x " % ord(c) for c in str]) + print("".join(["%02x " % ord(c) for c in str])) else: # Can copy/paste this string - print "".join(["\\x%02x" % ord(c) for c in str]) + print("".join(["\\x%02x" % ord(c) for c in str])) def str_xor(a, b): """xor two string which represent binary data""" diff --git a/nfs4.1/nfs4proxy.py b/nfs4.1/nfs4proxy.py index 58c26cb..efb6744 100755 --- a/nfs4.1/nfs4proxy.py +++ b/nfs4.1/nfs4proxy.py @@ -69,7 +69,7 @@ class NFS4Proxy(rpc.Server): while True: try: server_address = (self.dserver, self.dport) - print server_address + print(server_address) pipe = self.connect(server_address) except: traceback.print_exc(file=sys.stdout) diff --git a/nfs4.1/nfs4server.py b/nfs4.1/nfs4server.py index 7ca4d92..8856a82 100755 --- a/nfs4.1/nfs4server.py +++ b/nfs4.1/nfs4server.py @@ -521,7 +521,7 @@ class SummaryOutput: print_summary_line = True if summary_line != self._last or role != self._last_role: if self._last and self._repeat_count: - print " (repeated %u times)" % self._repeat_count + print(" (repeated %u times)" % self._repeat_count) self._last = summary_line self._repeat_count = 0 else: @@ -530,11 +530,11 @@ class SummaryOutput: if self._last_role != role: print - print role + print(role) self._last_role = role if print_summary_line: - print summary_line + print(summary_line) ################################################## @@ -613,7 +613,7 @@ class NFS4Server(rpc.Server): Note that order matters, since the mount hides anything beneath it. """ - print "Mounting %r on %r" % (fs.fsid, path) + print("Mounting %r on %r" % (fs.fsid, path)) # Find directory object on which to mount fs dir = self.root principal = nfs4lib.NFS4Principal("root", system=True) @@ -1964,14 +1964,14 @@ class NFS4Server(rpc.Server): calls.append(call) if arg.dir & xdrdef.sctrl_const.DIR_REPLY: replies.append(reply) - #print calls - #print replies + #print(calls) + #print(replies) grabres = xdrdef.sctrl_type.GRABres(calls, replies) return xdrdef.sctrl_const.CTRLSTAT_OK, \ xdrdef.sctrl_type.resdata_t(arg.ctrlop, grab = grabres) def ctrl_illegal(self, arg): - #print "ILLEGAL" + #print("ILLEGAL") return xdrdef.sctrl_const.CTRLSTAT_ILLEGAL, xdrdef.sctrl_type.resdata_t(arg.ctrlop) def op_setclientid(self, arg, env): diff --git a/nfs4.1/server41tests/environment.py b/nfs4.1/server41tests/environment.py index a910a69..1a837ee 100644 --- a/nfs4.1/server41tests/environment.py +++ b/nfs4.1/server41tests/environment.py @@ -1,7 +1,7 @@ # # environment.py # -# Requires python 2.3 +# Requires python 2.7 # # Written by Fred Isaman # Copyright (C) 2004 University of Michigan, Center for @@ -225,10 +225,10 @@ class Environment(testmod.Environment): """Perform a special operation on the server side (such as rebooting the server)""" if self.opts.serverhelper is None: - print "Manual operation required on server:" - print args + " and hit ENTER when done" + print("Manual operation required on server:") + print(args + " and hit ENTER when done") sys.stdin.readline() - print "Continuing with test" + print("Continuing with test") else: cmd = self.opts.serverhelper if self.opts.serverhelperarg: diff --git a/nfs4.1/server41tests/st_block.py b/nfs4.1/server41tests/st_block.py index bf968f9..2041de3 100644 --- a/nfs4.1/server41tests/st_block.py +++ b/nfs4.1/server41tests/st_block.py @@ -22,14 +22,14 @@ def testStateid1(t, env): # Get layout 1 fh = res.resarray[-1].object open_stateid = res.resarray[-2].stateid - print open_stateid + print(open_stateid) ops = [op.putfh(fh), op.layoutget(False, LAYOUT4_BLOCK_VOLUME, LAYOUTIOMODE4_RW, 0, 8192, 8192, open_stateid, 0xffff)] res = sess.compound(ops) check(res) lo_stateid = res.resarray[-1].logr_stateid - print lo_stateid + print(lo_stateid) if lo_stateid.seqid != 1: # From draft23 12.5.2 "The first successful LAYOUTGET processed by # the server using a non-layout stateid as an argument MUST have the @@ -43,7 +43,7 @@ def testStateid1(t, env): res = sess.compound(ops) check(res) lo_stateid = res.resarray[-1].logr_stateid - print lo_stateid + print(lo_stateid) if lo_stateid.seqid != i + 2: # From draft23 12.5.3 "After the layout stateid is established, # the server increments by one the value of the "seqid" in each @@ -63,7 +63,7 @@ def testStateid2(t, env): # Get layout 1 fh = res.resarray[-1].object open_stateid = res.resarray[-2].stateid - print open_stateid + print(open_stateid) ops = [op.putfh(fh), op.layoutget(False, LAYOUT4_BLOCK_VOLUME, LAYOUTIOMODE4_RW, 0, 8192, 8192, open_stateid, 0xffff)] @@ -71,7 +71,7 @@ def testStateid2(t, env): check(res) # Get layout 2 lo_stateid1 = res.resarray[-1].logr_stateid - print lo_stateid1 + print(lo_stateid1) ops = [op.putfh(fh), op.layoutget(False, LAYOUT4_BLOCK_VOLUME, LAYOUTIOMODE4_RW, 8192, 8192, 8192, lo_stateid1, 0xffff)] @@ -79,14 +79,14 @@ def testStateid2(t, env): check(res) # Get layout 3 (merge of prior two) lo_stateid2 = res.resarray[-1].logr_stateid - print lo_stateid2 + print(lo_stateid2) ops = [op.putfh(fh), op.layoutget(False, LAYOUT4_BLOCK_VOLUME, LAYOUTIOMODE4_RW, 0, 2*8192, 2*8192, lo_stateid2, 0xffff)] res = sess.compound(ops) check(res) lo_stateid3 = res.resarray[-1].logr_stateid - print lo_stateid3 + print(lo_stateid3) # lo_stateid3.seqid = 3 # BUG - work around emc problem # Parse opaque to get info for commit # STUB not very general @@ -122,7 +122,7 @@ def testEmptyCommit(t, env): # Get layout 1 fh = res.resarray[-1].object open_stateid = res.resarray[-2].stateid - print open_stateid + print(open_stateid) ops = [op.putfh(fh), op.layoutget(False, LAYOUT4_BLOCK_VOLUME, LAYOUTIOMODE4_RW, 0, 8192, 8192, open_stateid, 0xffff)] @@ -130,14 +130,14 @@ def testEmptyCommit(t, env): check(res) # Get layout 2 lo_stateid1 = res.resarray[-1].logr_stateid - print lo_stateid1 + print(lo_stateid1) ops = [op.putfh(fh), op.layoutget(False, LAYOUT4_BLOCK_VOLUME, LAYOUTIOMODE4_RW, 8192, 8192, 8192, lo_stateid1, 0xffff)] res = sess.compound(ops) check(res) lo_stateid2 = res.resarray[-1].logr_stateid - print lo_stateid2 + print(lo_stateid2) # Parse opaque to get info for commit # STUB not very general layout = res.resarray[-1].logr_layout[-1] @@ -183,7 +183,7 @@ def testSplitCommit(t, env): # Get layout 1 fh = res.resarray[-1].object open_stateid = res.resarray[-2].stateid - print open_stateid + print(open_stateid) ops = [op.putfh(fh), op.layoutget(False, LAYOUT4_BLOCK_VOLUME, LAYOUTIOMODE4_RW, 0, 2*8192, 2*8192, open_stateid, 0xffff)] @@ -191,7 +191,7 @@ def testSplitCommit(t, env): check(res) lo_stateid1 = res.resarray[-1].logr_stateid - print lo_stateid1 + print(lo_stateid1) # Parse opaque to get info for commit # STUB not very general layout = res.resarray[-1].logr_layout[-1] diff --git a/nfs4.1/server41tests/st_create_session.py b/nfs4.1/server41tests/st_create_session.py index bf1eefc..2ab8ba0 100644 --- a/nfs4.1/server41tests/st_create_session.py +++ b/nfs4.1/server41tests/st_create_session.py @@ -310,7 +310,7 @@ def testRdmaArray2(t, env): xid = c.compound_async(ops, checks=False) try: res = c.listen(xid) - print res + print(res) except RPCAcceptError, e: if e.stat == GARBAGE_ARGS: # Legitimate return @@ -339,7 +339,7 @@ def testCallbackProgram(t, env): cb_occurred = threading.Event() transient = 0x40000004 def mycheck(prog): - print "Got call using prog=0x%x" % prog + print("Got call using prog=0x%x" % prog) cb_occurred.prog = prog cb_occurred.set() return True; @@ -366,7 +366,7 @@ def testCallbackVersion(t, env): cb_occurred = threading.Event() transient = 0x40000000 def mycheck(low, hi, vers): - print "Got call using version=%i" % vers + print("Got call using version=%i" % vers) cb_occurred.low = low cb_occurred.hi = hi cb_occurred.vers = vers diff --git a/nfs4.1/server41tests/st_debug.py b/nfs4.1/server41tests/st_debug.py index 532ee7a..e34d03f 100644 --- a/nfs4.1/server41tests/st_debug.py +++ b/nfs4.1/server41tests/st_debug.py @@ -31,7 +31,7 @@ def testSupported2(t, env): owner, how, claim) res = sess2.compound(env.home + [open_op]) # STUB - since we are not handling callback, deleg_return never gets done - print res + print(res) check(res) fh2 = res.resarray[-1].object stateid2 = res.resarray[-2].stateid @@ -55,16 +55,16 @@ def testReadWrite(t, env): owner, how, claim) fh_op = op.putrootfh() res = sess1.compound([fh_op, open_op, op.getfh()]) # OPEN - print res + print(res) check(res) fh = res.resarray[-1].object stateid = res.resarray[-2].stateid stateid.seqid = 0 res = sess1.compound([op.putfh(fh), op.write(stateid, 5, FILE_SYNC4, "write test data")]) - print res + print(res) check(res) res = sess1.compound([op.putfh(fh), op.read(stateid, 0, 1000)]) - print res + print(res) check(res) res = close_file(sess1, fh, stateid=stateid) check(res) @@ -95,7 +95,7 @@ def testDeadlock(t, env): for xid in xids: res = sess1.listen(xid) check(res) - print res + print(res) res = close_file(sess1, fh, stateid=stateid) check(res) diff --git a/nfs4.1/server41tests/st_destroy_session.py b/nfs4.1/server41tests/st_destroy_session.py index c48d144..466845d 100644 --- a/nfs4.1/server41tests/st_destroy_session.py +++ b/nfs4.1/server41tests/st_destroy_session.py @@ -109,7 +109,7 @@ def testDestroy3(t, env): check(res) fh = res.resarray[-1].object deleg = res.resarray[-2].delegation - print "OPEN fh =", repr(fh) + print("OPEN fh =", repr(fh)) if deleg.delegation_type == OPEN_DELEGATE_NONE: fail("Could not get delegation") recall.happened = False diff --git a/nfs4.1/server41tests/st_exchange_id.py b/nfs4.1/server41tests/st_exchange_id.py index b0ab99c..68f3b09 100644 --- a/nfs4.1/server41tests/st_exchange_id.py +++ b/nfs4.1/server41tests/st_exchange_id.py @@ -91,7 +91,7 @@ def testSSV(t, env): # This should fail if not using GSS? What about E_ID? res = sess.set_ssv('\x5a' * c.protect.context.ssv_len) - print res + print(res) def testNoImplId(t, env): """Do a simple EXCHANGE_ID w/o setting client impl_id @@ -118,7 +118,7 @@ def testLongArray(t, env): xid = c.compound_async(ops, checks=False) try: res = c.listen(xid) - print res + print(res) except RPCAcceptError, e: if e.stat == GARBAGE_ARGS: # Legitimate return diff --git a/nfs4.1/server41tests/st_getdevicelist.py b/nfs4.1/server41tests/st_getdevicelist.py index a556ce0..edf5fe4 100644 --- a/nfs4.1/server41tests/st_getdevicelist.py +++ b/nfs4.1/server41tests/st_getdevicelist.py @@ -28,7 +28,7 @@ def testGetDevList(t, env): check(res) # STUB - check block stuff dev_list = res.resarray[-1].gdlr_deviceid_list - print dev_list + print(dev_list) def testGetDevInfo(t, env): """Check devlist @@ -60,7 +60,7 @@ def testGetDevInfo(t, env): p.reset(res.resarray[-1].da_addr_body) decode = p.unpack_pnfs_block_deviceaddr4() p.done() - print decode + print(decode) ## def xxxtestLayout(t, env): @@ -110,7 +110,7 @@ def testGetLayout(t, env): p = BlockUnpacker(layout.loc_body) opaque = p.unpack_pnfs_block_layout4() p.done() - print opaque + print(opaque) def testEMCGetLayout(t, env): """Verify layout handling @@ -142,7 +142,7 @@ def testEMCGetLayout(t, env): p = BlockUnpacker(layout.loc_body) opaque = p.unpack_pnfs_block_layout4() p.done() - print opaque + print(opaque) def testLayoutReturnFile(t, env): """ @@ -257,9 +257,9 @@ def testLayoutCommit(t, env): p = BlockUnpacker(layout.loc_body) opaque = p.unpack_pnfs_block_layout4() p.done() - print opaque + print(opaque) final_extent = opaque.blo_extents[-1] - print final_extent + print(final_extent) if final_extent.bex_state != PNFS_BLOCK_INVALID_DATA: fail("Expected INVALID_DATA in extent") # LAYOUTCOMMIT @@ -276,6 +276,6 @@ def testLayoutCommit(t, env): layoutupdate4(LAYOUT4_BLOCK_VOLUME, p.get_buffer()))] res = sess.compound(ops) check(res) - print res + print(res) diff --git a/nfs4.1/server41tests/st_secinfo_no_name.py b/nfs4.1/server41tests/st_secinfo_no_name.py index 4c8cb57..9cd6bd3 100644 --- a/nfs4.1/server41tests/st_secinfo_no_name.py +++ b/nfs4.1/server41tests/st_secinfo_no_name.py @@ -32,7 +32,7 @@ def testSupported2(t, env): # GETFH after do a SECINFO_NO_NAME should get error NFS4ERR_NOFILEHANDLE res = sess.compound([op.putrootfh(), op.secinfo_no_name(0), op.getfh()]) - print res + print(res) check(res, NFS4ERR_NOFILEHANDLE) def testSupported3(t, env): diff --git a/nfs4.1/setup.py b/nfs4.1/setup.py index 5c3a0df..37b99a0 100644 --- a/nfs4.1/setup.py +++ b/nfs4.1/setup.py @@ -31,10 +31,10 @@ class build_py(_build_py): self.build_module(module, module_file, package) def expand_xdr(self, dir): - print "expand = %r" % dir + print("expand = %r" % dir) cwd = os.getcwd() xdrdir = os.path.join(cwd, dir, 'xdrdef') - print "xdrdir = %r" % xdrdir + print("xdrdir = %r" % xdrdir) if os.path.exists(xdrdir): try: os.chdir(xdrdir) @@ -47,7 +47,7 @@ class build_py(_build_py): os.remove("parser.out") os.remove("parsetab.py") except: - print "Remove parse* failed" + print("Remove parse* failed") finally: os.chdir(cwd) diff --git a/nfs4.1/testclient.py b/nfs4.1/testclient.py index 95e90e1..8a1be9f 100755 --- a/nfs4.1/testclient.py +++ b/nfs4.1/testclient.py @@ -24,7 +24,7 @@ import use_local # HACK so don't have to rebuild constantly import sys if sys.hexversion < 0x02050000: - print "Requires python 2.5 or higher" + print("Requires python 2.5 or higher") sys.exit(1) import os @@ -197,16 +197,16 @@ def printflags(list): command_names = [s.lower()[3:].replace('_', '') \ for s in nfs_opnum4.values()] list.sort() - # First print command names + # First print(command names) print for s in list: if s in command_names: - print s + print(s) # Then everything else print for s in list: if s not in command_names: - print s + print(s) def main(): p = OptionParser("%prog SERVER:/PATH [options] flags|testcodes\n" @@ -228,16 +228,16 @@ def main(): codes = cdict.keys() codes.sort() for c in codes: - print c + print(c) sys.exit(0) # Grab server info and set defaults if not args: p.error("Need a server") url = args.pop(0) - print "url", url + print("url", url) opt.path = nfs4lib.path_components(url) - print "Set opt.path", opt.path + print("Set opt.path", opt.path) # Check --use* options are valid for attr in dir(opt): @@ -245,14 +245,14 @@ def main(): opt.useparams = parse_useparams(opt.useparams) elif attr.startswith('use') and attr != "usefh": path = getattr(opt, attr) - #print attr, path + #print(attr, path) if path is None: path = opt.path + ['tree', attr[3:]] else: # FIXME - have funct that checks path validity if path[0] != '/': p.error("Need to use absolute path for --%s" % attr) - # print path + # print(path) if path[-1] == '/' and attr != 'usedir': p.error("Can't use dir for --%s" %attr) try: @@ -297,20 +297,20 @@ def main(): # Place tests in desired order tests.sort() # FIXME - add options for random sort - # Run the tests and save/print results + # Run the tests and save/print(results) try: env = environment.Environment(opt) env.init() except socket.gaierror, e: if e.args[0] == -2: - print "Unknown server '%s'" % opt.server + print("Unknown server '%s'" % opt.server) sys.exit(1) except Exception, e: - print "Initialization failed, no tests run." + print("Initialization failed, no tests run.") if not opt.maketree: - print "Perhaps you need to use the --maketree option" + print("Perhaps you need to use the --maketree option") raise - print sys.exc_info()[1] + print(sys.exc_info()[1]) sys.exit(1) if opt.outfile is not None: fd = file(opt.outfile, 'w') @@ -330,7 +330,7 @@ def main(): fail = True testmod.printresults(tests, opt) if fail: - print "\nWARNING: could not clean testdir due to:\n%s\n" % str(e) + print("\nWARNING: could not clean testdir due to:\n%s\n" % str(e)) if __name__ == "__main__": main() diff --git a/nfs4.1/testmod.py b/nfs4.1/testmod.py index c5ca0fe..a8b4a82 100644 --- a/nfs4.1/testmod.py +++ b/nfs4.1/testmod.py @@ -6,6 +6,7 @@ # Copyright (C) 2004 University of Michigan, Center for # Information Technology Integration # +from __future__ import print_function from __future__ import with_statement import nfs4lib import re @@ -212,11 +213,11 @@ class Test(object): def run(self, environment, verbose=False): """Run self.runtest, storing result""" - #print "*********Running test %s (%s)" % (self.name, self.code) + #print("*********Running test %s (%s)" % (self.name, self.code)) self.result = self._run_result start_time = time.time() if verbose: - print repr(self) + print(repr(self)) try: environment.startUp() self.runtest(self, environment) @@ -245,7 +246,7 @@ class Test(object): self.time_taken = stop_time - start_time if verbose: - print repr(self) + print(repr(self)) class Environment(object): """Base class for a test environment""" @@ -419,8 +420,8 @@ def printresults(tests, opts, file=None): count = [0] * 6 for t in tests: if not hasattr(t, "result"): - print dir(t) - print t.__dict__ + print(dir(t)) + print(t.__dict__) raise if t.result == TEST_NOTRUN: count[NOTRUN] += 1 @@ -434,7 +435,7 @@ def printresults(tests, opts, file=None): count[WARN] += 1 elif t.result == TEST_PASS: count[PASS] += 1 - print >> file, "*"*50 + print("*"*50, file=file) for t in tests: if t.result == TEST_NOTRUN: continue @@ -448,16 +449,16 @@ def printresults(tests, opts, file=None): continue if (not opts.showfail) and t.result == TEST_FAIL: continue - print >> file, t.display(0,0) - print >> file, "*"*50 + print(t.display(0,0), file=file) + print("*"*50, file=file) if count[NOTRUN]: - print >> file, "Tests interrupted! Only %i tests run" % \ - sum(count[SKIP:]) + print("Tests interrupted! Only %i tests run" % \ + sum(count[SKIP:]), file=file) else: - print >> file, "Command line asked for %i of %i tests" % \ - (sum(count[SKIP:]), len(tests)) - print >> file, "Of those: %i Skipped, %i Failed, %i Warned, %i Passed" % \ - (count[SKIP], count[FAIL], count[WARN], count[PASS]) + print("Command line asked for %i of %i tests" % \ + (sum(count[SKIP:]), len(tests)), file=file) + print("Of those: %i Skipped, %i Failed, %i Warned, %i Passed" % \ + (count[SKIP], count[FAIL], count[WARN], count[PASS]), file=file) return count[FAIL] def xml_printresults(tests, file_name, suite='all'): diff --git a/nfs4.1/testserver.py b/nfs4.1/testserver.py index 9c2133e..70b4f62 100755 --- a/nfs4.1/testserver.py +++ b/nfs4.1/testserver.py @@ -28,7 +28,7 @@ import use_local # HACK so don't have to rebuild constantly import sys if sys.hexversion < 0x02050000: - print "Requires python 2.5 or higher" + print("Requires python 2.5 or higher") sys.exit(1) import os @@ -196,16 +196,16 @@ def printflags(list): command_names = [s.lower()[3:].replace('_', '') \ for s in nfs_opnum4.values()] list.sort() - # First print command names + # First print(command names) print for s in list: if s in command_names: - print s + print(s) # Then everything else print for s in list: if s not in command_names: - print s + print(s) def main(): p = OptionParser("%prog SERVER:/PATH [options] flags|testcodes\n" @@ -229,14 +229,14 @@ def main(): codes = cdict.keys() codes.sort() for c in codes: - print c + print(c) sys.exit(0) if opt.showcodesflags: codes = cdict.keys() codes.sort() for c in codes: - print c, "FLAGS:", ', '.join(cdict[c].flags_list) + print(c, "FLAGS:", ', '.join(cdict[c].flags_list)) sys.exit(0) # Grab server info and set defaults @@ -257,14 +257,14 @@ def main(): for attr in dir(opt): if attr.startswith('use') and attr != "usefh": path = getattr(opt, attr) - #print attr, path + #print(attr, path) if path is None: path = opt.path + ['tree', attr[3:]] else: # FIXME - have funct that checks path validity if path[0] != '/': p.error("Need to use absolute path for --%s" % attr) - # print path + # print(path) if path[-1] == '/' and attr != 'usedir': p.error("Can't use dir for --%s" %attr) try: @@ -316,21 +316,21 @@ def main(): # Place tests in desired order tests.sort() # FIXME - add options for random sort - # Run the tests and save/print results + # Run the tests and save/print(results) try: env = environment.Environment(opt) env.init() except socket.gaierror, e: if e.args[0] == -2: - print "Unknown server '%s'" % opt.server - print sys.exc_info()[1] + print("Unknown server '%s'" % opt.server) + print(sys.exc_info()[1]) sys.exit(1) except Exception, e: - print "Initialization failed, no tests run." + print("Initialization failed, no tests run.") if not opt.maketree: - print "Perhaps you need to use the --maketree option" + print("Perhaps you need to use the --maketree option") raise - print sys.exc_info()[1] + print(sys.exc_info()[1]) sys.exit(1) if opt.outfile is not None: fd = file(opt.outfile, 'w') @@ -350,7 +350,7 @@ def main(): fail = True testmod.printresults(tests, opt) if fail: - print "\nWARNING: could not clean testdir due to:\n%s\n" % str(e) + print("\nWARNING: could not clean testdir due to:\n%s\n" % str(e)) if opt.xmlout is not None: testmod.xml_printresults(tests, opt.xmlout) diff --git a/rpc/rpc.py b/rpc/rpc.py index 1a3ca38..e06dbbf 100644 --- a/rpc/rpc.py +++ b/rpc/rpc.py @@ -878,8 +878,8 @@ class ConnectionHandler(object): def listen(self, pipe, xid): # STUB - should be overwritten by subclass header, data = pipe.listen(xid) - print "HEADER", header - print "DATA", repr(data) + print("HEADER", header) + print("DATA", repr(data)) ################################################# diff --git a/setup.py b/setup.py index a032afe..ace0ab5 100755 --- a/setup.py +++ b/setup.py @@ -1,5 +1,7 @@ #!/usr/bin/env python +from __future__ import print_function + from distutils.core import setup import sys @@ -19,7 +21,7 @@ def setup(*args, **kwargs): cwd = os.getcwd() command = " ".join(sys.argv) for dir in DIRS: - print "\n\nMoving to %s" % dir + print("\n\nMoving to %s" % dir ) os.chdir(join(cwd, dir)) os.system("python %s" % command) os.chdir(cwd) diff --git a/showresults.py b/showresults.py index b843a5f..962407d 100755 --- a/showresults.py +++ b/showresults.py @@ -1,13 +1,14 @@ #!/usr/bin/env python # showresults.py - redisplay results from nfsv4 server tester output file # -# Requires python 2.3 +# Requires python 2.7 # # Written by Fred Isaman # Copyright (C) 2004 University of Michigan, Center for # Information Technology Integration # +from __future__ import print_function # Allow to be run stright from package root if __name__ == "__main__": diff --git a/xdr/xdrgen.py b/xdr/xdrgen.py index 4eb5b16..6353835 100755 --- a/xdr/xdrgen.py +++ b/xdr/xdrgen.py @@ -300,7 +300,7 @@ def t_linecomment(t): t.lexer.lineno += 1 def t_error(t): - print "Illegal character %s at %d type %s" % (repr(t.value[0]), t.lexer.lineno, t.type) + print("Illegal character %s at %d type %s" % (repr(t.value[0]), t.lexer.lineno, t.type)) t.lexer.skip(1) # Build the lexer @@ -371,7 +371,7 @@ def p_optional_value(t): if msg: global error_occurred error_occurred = True - print "ERROR - %s near line %i" % (msg, t.lineno(1)) + print("ERROR - %s near line %i" % (msg, t.lineno(1))) def p_type_def_1(t): '''type_def : TYPEDEF declaration SEMI''' @@ -382,7 +382,7 @@ def p_type_def_1(t): if d.type == 'void': global error_occurred error_occurred = True - print "ERROR - can't use void in typedef at line %i" % lineno + print("ERROR - can't use void in typedef at line %i" % lineno) return d.lineno = lineno if id_unique(d.id, d.type, lineno): @@ -560,11 +560,11 @@ def p_enum_constant(t): # We have a name instead of a constant, make sure it is defined if value not in name_dict: error_occurred = True - print "ERROR - can't derefence %s at line %s" % (value, lineno) + print("ERROR - can't derefence %s at line %s" % (value, lineno)) elif not isinstance(name_dict[value], const_info): error_occurred = True - print "ERROR - reference to %s at line %s is not a constant" %\ - (value, lineno) + print("ERROR - reference to %s at line %s is not a constant" %\ + (value, lineno)) else: info.positive = name_dict[value].positive t[0] = [info] @@ -586,9 +586,9 @@ def p_error(t): global error_occurred error_occurred = True if t: - print "Syntax error at '%s' (lineno %d)" % (t.value, t.lineno) + print("Syntax error at '%s' (lineno %d)" % (t.value, t.lineno)) else: - print "Syntax error: unexpectedly hit EOF" + print("Syntax error: unexpectedly hit EOF") # # RPC specific routines follow @@ -596,7 +596,7 @@ def p_error(t): def p_program_def(t): '''program_def : PROGRAM ID LBRACE version_def version_def_list RBRACE EQUALS constant SEMI''' - print "Ignoring program %s = %s" % (t[2], t[8]) + print("Ignoring program %s = %s" % (t[2], t[8])) global name_dict id = t[2] value = t[8] @@ -666,8 +666,8 @@ def id_unique(id, name, lineno): if id in name_dict: global error_occurred error_occurred = True - print "ERROR - %s definition %s at line %s conflicts with %s" % \ - (name, id, lineno, name_dict[id]) + print("ERROR - %s definition %s at line %s conflicts with %s" % \ + (name, id, lineno, name_dict[id])) return False else: return True @@ -1391,7 +1391,7 @@ def run(infile, filters=True, pass_attrs=True, debug=False): global use_filters, allow_attr_passthrough use_filters = filters allow_attr_passthrough = pass_attrs - print "Input file is", infile + print("Input file is", infile) # Create output file names (without .py) global constants_file, types_file, packer_file @@ -1399,8 +1399,8 @@ def run(infile, filters=True, pass_attrs=True, debug=False): constants_file = name_base + "_const" types_file = name_base + "_type" packer_file = name_base + "_pack" - print "Will use output files %s.py, %s.py, and %s.py" % \ - (constants_file, types_file, packer_file) + print("Will use output files %s.py, %s.py, and %s.py" % \ + (constants_file, types_file, packer_file)) # Parse the input data with yacc global name_dict @@ -1414,7 +1414,7 @@ def run(infile, filters=True, pass_attrs=True, debug=False): if error_occurred: print - print "Error occurred, did not write output files" + print("Error occurred, did not write output files") return 1 comment_string = "# Generated by rpcgen.py from %s on %s\n" % \ @@ -1433,7 +1433,7 @@ def run(infile, filters=True, pass_attrs=True, debug=False): type_list = name_dict.values() type_list.sort() for value in type_list: - #print value + #print(value) output = value.const_output() if output is not None: #const_fd.write("# **** %s ****\n" % value.id) @@ -1465,7 +1465,7 @@ def run(infile, filters=True, pass_attrs=True, debug=False): # if __name__ == "__main__": if len(sys.argv) < 2: - print "Usage: %s " % sys.argv[0] + print("Usage: %s " % sys.argv[0]) sys.exit(1) run(sys.argv[1]) From patchwork Tue Jul 24 07:33:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jianhong Yin X-Patchwork-Id: 10541393 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B1A8317FD for ; Tue, 24 Jul 2018 07:33:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9701C28759 for ; Tue, 24 Jul 2018 07:33:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8AF682875C; Tue, 24 Jul 2018 07:33:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F1EF728759 for ; Tue, 24 Jul 2018 07:33:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388400AbeGXIi7 (ORCPT ); Tue, 24 Jul 2018 04:38:59 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:54696 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2388391AbeGXIi7 (ORCPT ); Tue, 24 Jul 2018 04:38:59 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 82C3383221; Tue, 24 Jul 2018 07:33:52 +0000 (UTC) Received: from dhcp-12-115.nay.redhat.com (unknown [10.66.12.115]) by smtp.corp.redhat.com (Postfix) with ESMTP id EB0D1178B3; Tue, 24 Jul 2018 07:33:50 +0000 (UTC) From: jiyin@redhat.com To: bfields@redhat.com Cc: linux-nfs@vger.kernel.org, "Jianhong.Yin" Subject: [PATCH 02/24] pynfs: python3 support plan: exec -> exec() Date: Tue, 24 Jul 2018 15:33:20 +0800 Message-Id: <20180724073342.5738-2-jiyin@redhat.com> In-Reply-To: <20180724073342.5738-1-jiyin@redhat.com> References: <20180724073342.5738-1-jiyin@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Tue, 24 Jul 2018 07:33:52 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Tue, 24 Jul 2018 07:33:52 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'jiyin@redhat.com' RCPT:'' Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: "Jianhong.Yin" '/exec / {:loop /[^\\]$/! {N; b loop}; s/exec /exec(/; s/$/)/; }' Signed-off-by: Jianhong Yin --- nfs4.1/nfs4commoncode.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nfs4.1/nfs4commoncode.py b/nfs4.1/nfs4commoncode.py index cadd237..3c9c811 100644 --- a/nfs4.1/nfs4commoncode.py +++ b/nfs4.1/nfs4commoncode.py @@ -190,8 +190,8 @@ class %(CompoundState)s(object): ''' # Create normal code -exec code_str % _d +exec(code_str % _d) # Create callback code -exec code_str % _cb_d +exec(code_str % _cb_d) From patchwork Tue Jul 24 07:33:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jianhong Yin X-Patchwork-Id: 10541395 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A2E4C17FD for ; Tue, 24 Jul 2018 07:34:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 81F302875A for ; Tue, 24 Jul 2018 07:34:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7387628761; Tue, 24 Jul 2018 07:34:02 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 391102875A for ; Tue, 24 Jul 2018 07:34:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388387AbeGXIjF (ORCPT ); Tue, 24 Jul 2018 04:39:05 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:54798 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2388391AbeGXIjF (ORCPT ); Tue, 24 Jul 2018 04:39:05 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B18B37D84D; Tue, 24 Jul 2018 07:33:54 +0000 (UTC) Received: from dhcp-12-115.nay.redhat.com (unknown [10.66.12.115]) by smtp.corp.redhat.com (Postfix) with ESMTP id 24030178B3; Tue, 24 Jul 2018 07:33:52 +0000 (UTC) From: jiyin@redhat.com To: bfields@redhat.com Cc: linux-nfs@vger.kernel.org, "Jianhong.Yin" Subject: [PATCH 03/24] pynfs: python3 support plan: "except E,e:" -> "except E as e:" Date: Tue, 24 Jul 2018 15:33:21 +0800 Message-Id: <20180724073342.5738-3-jiyin@redhat.com> In-Reply-To: <20180724073342.5738-1-jiyin@redhat.com> References: <20180724073342.5738-1-jiyin@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Tue, 24 Jul 2018 07:33:54 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Tue, 24 Jul 2018 07:33:54 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'jiyin@redhat.com' RCPT:'' Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: "Jianhong.Yin" s/except *([^,]+), *([^ ]+):/except \1 as \2:/ Signed-off-by: Jianhong Yin --- nfs4.0/lib/rpc/rpc.py | 8 +++--- nfs4.0/lib/rpc/rpcsec/sec_auth_sys.py | 2 +- nfs4.0/nfs4server.py | 32 +++++++++++------------ nfs4.0/nfs4state.py | 8 +++--- nfs4.0/servertests/st_compound.py | 4 +-- nfs4.0/servertests/st_create.py | 2 +- nfs4.0/servertests/st_delegation.py | 4 +-- nfs4.0/servertests/st_gss.py | 28 ++++++++++---------- nfs4.0/servertests/st_link.py | 2 +- nfs4.0/servertests/st_lookup.py | 6 ++--- nfs4.0/servertests/st_readdir.py | 6 ++--- nfs4.0/servertests/st_remove.py | 4 +-- nfs4.0/servertests/st_rename.py | 6 ++--- nfs4.0/testserver.py | 8 +++--- nfs4.1/config.py | 2 +- nfs4.1/fs.py | 4 +-- nfs4.1/nfs4client.py | 6 ++--- nfs4.1/nfs4server.py | 24 ++++++++--------- nfs4.1/server41tests/st_compound.py | 2 +- nfs4.1/server41tests/st_create_session.py | 2 +- nfs4.1/server41tests/st_exchange_id.py | 2 +- nfs4.1/server41tests/st_lookup.py | 4 +-- nfs4.1/testclient.py | 8 +++--- nfs4.1/testmod.py | 8 +++--- nfs4.1/testserver.py | 8 +++--- rpc/rpc.py | 16 ++++++------ rpc/rpclib.py | 4 +-- rpc/security.py | 8 +++--- 28 files changed, 109 insertions(+), 109 deletions(-) diff --git a/nfs4.0/lib/rpc/rpc.py b/nfs4.0/lib/rpc/rpc.py index 48e3093..83a51c4 100644 --- a/nfs4.0/lib/rpc/rpc.py +++ b/nfs4.0/lib/rpc/rpc.py @@ -226,7 +226,7 @@ class RPCClient(object): try: sock.bind(('', port)) return - except socket.error, why: + except socket.error as why: if why[0] == errno.EADDRINUSE: port += 1 else: @@ -330,7 +330,7 @@ class RPCClient(object): self.socket.send_record(header + data) except socket.timeout: raise - except socket.error, e: + except socket.error as e: print("Got error:", e) if self.debug: print("resend", xid) try: @@ -360,7 +360,7 @@ class RPCClient(object): reply = self.socket.recv_record() except socket.timeout: raise - except socket.error, e: + except socket.error as e: print("Got error:", e) if self.debug: print("relisten", xid) try: @@ -635,7 +635,7 @@ class RPCServer(Server): self.rpcunpacker.reset(recv_data) try: recv_msg = self.rpcunpacker.unpack_rpc_msg() - except xdrlib.Error, e: + except xdrlib.Error as e: print("XDRError", e) return if recv_msg.body.mtype != CALL: diff --git a/nfs4.0/lib/rpc/rpcsec/sec_auth_sys.py b/nfs4.0/lib/rpc/rpcsec/sec_auth_sys.py index 5b5691d..27fc52e 100644 --- a/nfs4.0/lib/rpc/rpcsec/sec_auth_sys.py +++ b/nfs4.0/lib/rpc/rpcsec/sec_auth_sys.py @@ -18,7 +18,7 @@ class SecAuthSys(SecFlavor): p.pack_uint(gid) p.pack_array(gids, p.pack_uint) self.cred = p.get_buffer() - except Error, e: + except Error as e: raise SecError("Packing error: %s", str(e)) self.uid = uid self.gid = gid diff --git a/nfs4.0/nfs4server.py b/nfs4.0/nfs4server.py index d5aea34..cb3ea72 100755 --- a/nfs4.0/nfs4server.py +++ b/nfs4.0/nfs4server.py @@ -227,7 +227,7 @@ class NFS4Server(rpc.RPCServer): raise NFS4Error(NFS4ERR_NOFILEHANDLE) print(" CLOSE fh", self.curr_fh.handle) self.state.close(stateid) - except NFS4Error, e: + except NFS4Error as e: self.state.advance_seqid(stateid, op, (e.code,)) return simple_error(e.code) # Return a garbage state id @@ -269,7 +269,7 @@ class NFS4Server(rpc.RPCServer): attrset = self.curr_fh.create(op.opcreate.objname, op.opcreate.objtype, attrs) new_cinfo = self.curr_fh.fattr4_change self.curr_fh = self.curr_fh.lookup(op.opcreate.objname) - except NFS4Error, e: + except NFS4Error as e: return simple_error(e.code) cin4 = change_info4(before=old_cinfo, after=new_cinfo, atomic=1) c4resok = CREATE4resok(cinfo=cin4, attrset = attrset) @@ -290,7 +290,7 @@ class NFS4Server(rpc.RPCServer): return simple_error(NFS4ERR_NOFILEHANDLE) attrs = nfs4lib.bitmap2list(op.opgetattr.attr_request) attrvals = self.curr_fh.get_attributes(attrs) - except NFS4Error, e: + except NFS4Error as e: return simple_error(e.code) garesok = GETATTR4resok(attrvals) return simple_error(NFS4_OK, garesok) @@ -351,7 +351,7 @@ class NFS4Server(rpc.RPCServer): self.state.new_lockowner(op.oplock.locker.open_owner) stateid = self.state.lock(self.curr_fh, owner, op.oplock.locktype, op.oplock.offset, op.oplock.length) - except NFS4Error, e: + except NFS4Error as e: if op.oplock.locker.new_lock_owner: # FIXME - a bug? compare with replay=check_seqid() above self.state.advance_seqid(openstateid, op, (e.code,)) @@ -376,7 +376,7 @@ class NFS4Server(rpc.RPCServer): self.state.testlock(self.curr_fh, op.oplockt.owner, op.oplockt.locktype, op.oplockt.offset, op.oplockt.length) - except NFS4Error, e: + except NFS4Error as e: return simple_error(e.code, e.lock_denied) return simple_error(NFS4_OK) @@ -393,7 +393,7 @@ class NFS4Server(rpc.RPCServer): raise NFS4Error(NFS4ERR_NOFILEHANDLE) sid = self.state.unlock(self.curr_fh, stateid, op.oplocku.locktype, op.oplocku.offset, op.oplocku.length) - except NFS4Error, e: + except NFS4Error as e: self.state.advance_seqid(stateid, op, (e.code,)) return simple_error(e.code) self.state.advance_seqid(stateid, op, (NFS4_OK, sid), self.curr_fh) @@ -438,7 +438,7 @@ class NFS4Server(rpc.RPCServer): if FATTR4_RDATTR_ERROR in attrreq: return simple_error(NFS4ERR_INVAL) attrvals = self.curr_fh.get_attributes(attrreq.keys(), ignore=False) - except NFS4Error, e: + except NFS4Error as e: return simple_error(e.code) if attrvals == attrreq: return simple_error(NFS4ERR_SAME) @@ -524,7 +524,7 @@ class NFS4Server(rpc.RPCServer): # 'existing' now points to a valid file, so check and set shares sid, flags = self.state.open(existing, owner, op.opopen.share_access, op.opopen.share_deny) - except NFS4Error, e: + except NFS4Error as e: print("Open error") self.state.advance_seqid(owner, op, (e.code,)) return simple_error(e.code) @@ -560,7 +560,7 @@ class NFS4Server(rpc.RPCServer): if self.curr_fh.get_type() != NF4REG: raise NFS4Error(NFS4ERR_INVAL) sid = self.state.confirm(self.curr_fh, stateid) - except NFS4Error, e: + except NFS4Error as e: self.state.advance_seqid(stateid, op, (e.code,)) return simple_error(e.code) oc4resok = OPEN_CONFIRM4resok(sid) @@ -583,7 +583,7 @@ class NFS4Server(rpc.RPCServer): sid = self.state.downgrade(self.curr_fh, stateid, op.opopen_downgrade.share_access, op.opopen_downgrade.share_deny) - except NFS4Error, e: + except NFS4Error as e: self.state.advance_seqid(stateid, op, (e.code,)) return simple_error(e.code) od4resok = OPEN_DOWNGRADE4resok(sid) @@ -626,7 +626,7 @@ class NFS4Server(rpc.RPCServer): offset, count) read_data = self.curr_fh.read(offset, count) print(" READ DATA: len=%i" % len(read_data)) - except NFS4Error, e: + except NFS4Error as e: return simple_error(e.code) if len(read_data) < count: read_eof = 1 @@ -693,7 +693,7 @@ class NFS4Server(rpc.RPCServer): d4 = dirlist4(e4, eof=0) else: d4 = dirlist4(e4, eof=1) - except NFS4Error, e: + except NFS4Error as e: return simple_error(e.code) rdresok = READDIR4resok(cookieverf=verifier, reply=d4) return simple_error(NFS4_OK, rdresok) @@ -777,7 +777,7 @@ class NFS4Server(rpc.RPCServer): def op_renew(self, op): try: self.state.renew(op.oprenew.clientid) - except NFS4Error, e: + except NFS4Error as e: return simple_error(e.code) return simple_error(NFS4_OK) @@ -830,7 +830,7 @@ class NFS4Server(rpc.RPCServer): self.state.check_write(self.curr_fh, op.opsetattr.stateid, offset, length) attrset = self.curr_fh.set_attributes(attrdict) - except NFS4Error, e: + except NFS4Error as e: return simple_error(e.code, e.attrs) return simple_error(NFS4_OK, attrset) @@ -908,7 +908,7 @@ class NFS4Server(rpc.RPCServer): if FATTR4_RDATTR_ERROR in attrreq: return simple_error(NFS4ERR_INVAL) attrvals = self.curr_fh.get_attributes(attrreq.keys(), ignore=False) - except NFS4Error, e: + except NFS4Error as e: return simple_error(e.code) if attrvals == attrreq: return simple_error(NFS4_OK) @@ -935,7 +935,7 @@ class NFS4Server(rpc.RPCServer): offset, len(data)) count = self.curr_fh.write(offset, data) print(" wrote %i bytes" % count) - except NFS4Error, e: + except NFS4Error as e: return simple_error(e.code) w4resok = WRITE4resok(count, FILE_SYNC4, self.state.write_verifier) return simple_error(NFS4_OK, w4resok) diff --git a/nfs4.0/nfs4state.py b/nfs4.0/nfs4state.py index fb3fd5c..064aadd 100755 --- a/nfs4.0/nfs4state.py +++ b/nfs4.0/nfs4state.py @@ -249,7 +249,7 @@ class NFSServerState: mustexist = True try: info = self.__getinfo(obj, allownew=not mustexist) - except ValueError, e: + except ValueError as e: if mustexist: raise #print(" check_seqid: %s" % info) if info is None: @@ -286,7 +286,7 @@ class NFSServerState: # RFC 3530 sec 8.1.5 try: info = self.__getinfo(owner) - except (ValueError, NFS4Error): + except (ValueError as NFS4Error): # An unknown owner, do nothing return if info is None: @@ -1132,7 +1132,7 @@ class VirtualHandle(NFSFileHandle): except AttributeError: # Otherwise, just set the variable setattr(self, name, attrdict[attr]) - except NFS4Error, e: + except NFS4Error as e: # Note attributes set so far in any error that occurred e.attrs = mapping(ret_list) raise @@ -1170,7 +1170,7 @@ class VirtualHandle(NFSFileHandle): if POSIXACL: try: nfs4acl.maps_to_posix(acl) - except nfs4acl.ACLError, e: + except nfs4acl.ACLError as e: print("*"*50) print(e) print("*"*50) diff --git a/nfs4.0/servertests/st_compound.py b/nfs4.0/servertests/st_compound.py index 4919289..59a279d 100644 --- a/nfs4.0/servertests/st_compound.py +++ b/nfs4.0/servertests/st_compound.py @@ -82,7 +82,7 @@ def testUndefined(t, env): try: res = c.compound([nfs_argop4(argop=opnum)]) check(res, NFS4ERR_OP_ILLEGAL, "Sent illegal op=%i" % opnum) - except RPCError, e: + except RPCError as e: t.fail("COMPOUND with illegal op=%i got %s, " "expected NFS4ERR_OP_ILLEGAL" % (opnum,e)) finally: @@ -106,6 +106,6 @@ def testLongCompound(t, env): "COMPOUND with len=%i argarry" % (3*count)) if res.status == NFS4ERR_RESOURCE: return - except RPCError, e: + except RPCError as e: t.fail("COMPOUND with len=%i argarry got %s, " "expected NFS4ERR_RESOURCE" % (3*count, e)) diff --git a/nfs4.0/servertests/st_create.py b/nfs4.0/servertests/st_create.py index 7017fdf..ac57aaf 100644 --- a/nfs4.0/servertests/st_create.py +++ b/nfs4.0/servertests/st_create.py @@ -290,5 +290,5 @@ def testLongName(t, env): (x, rejected_names_create) = self.try_file_names(creator=self.create_via_create) self.failIf(rejected_names_open != rejected_names_create, "CREATE does not obey OPEN naming policy") - except SkipException, e: + except SkipException as e: self.skip(e) diff --git a/nfs4.0/servertests/st_delegation.py b/nfs4.0/servertests/st_delegation.py index a2bce04..8e0d891 100644 --- a/nfs4.0/servertests/st_delegation.py +++ b/nfs4.0/servertests/st_delegation.py @@ -21,7 +21,7 @@ class _handle_error(object): _lock.acquire() try: self.c.compound(ops) - except Exception, e: + except Exception as e: print("CALLBACK error in _recall:", e) pass _lock.release() @@ -33,7 +33,7 @@ def _recall(c, thisop, cbid): _lock.acquire() try: res = c.compound(ops) - except Exception, e: + except Exception as e: print("CALLBACK error in _recall:", e) res = None _lock.release() diff --git a/nfs4.0/servertests/st_gss.py b/nfs4.0/servertests/st_gss.py index c67a802..414883e 100644 --- a/nfs4.0/servertests/st_gss.py +++ b/nfs4.0/servertests/st_gss.py @@ -109,11 +109,11 @@ def testInconsistentGssSeqnum(t, env): try: res = c.compound([op.putrootfh()]) e = "operation erroneously suceeding" - except rpc.RPCAcceptError, e: + except rpc.RPCAcceptError as e: if e.stat == rpc.GARBAGE_ARGS: # This is correct response return - except Exception, e: + except Exception as e: pass t.fail("Using inconsistent gss_seq_nums in header and body of message " "should return GARBAGE_ARGS, instead got %s" % e) @@ -138,11 +138,11 @@ def testBadVerfChecksum(t, env): try: res = c.compound([op.putrootfh()]) e = "peration erroneously suceeding" - except rpc.RPCDeniedError, e: + except rpc.RPCDeniedError as e: if e.stat == rpc.AUTH_ERROR and e.astat == rpc.RPCSEC_GSS_CREDPROBLEM: # This is correct response return - except Exception, e: + except Exception as e: pass t.fail("Using bad verifier checksum in header " "should return RPCSEC_GSS_CREDPROBLEM, instead got %s" % e) @@ -174,11 +174,11 @@ def testBadDataChecksum(t, env): try: res = c.compound([op.putrootfh()]) e = "operation erroneously suceeding" - except rpc.RPCAcceptError, e: + except rpc.RPCAcceptError as e: if e.stat == rpc.GARBAGE_ARGS: # This is correct response return - except Exception, e: + except Exception as e: pass t.fail("Using bad data checksum for body of message " "should return GARBAGE_ARGS, instead got %s" % e) @@ -214,11 +214,11 @@ def testBadVersion(t, env): try: res = c.compound([op.putrootfh()]) e = "operation erroneously suceeding" - except rpc.RPCDeniedError, e: + except rpc.RPCDeniedError as e: if e.stat == rpc.AUTH_ERROR and e.astat == rpc.AUTH_BADCRED: # This is correct response e = None - except Exception, e: + except Exception as e: pass if e is not None: t.fail("Using bad gss version number %i " @@ -241,11 +241,11 @@ def testHighSeqNum(t, env): try: res = c.compound([op.putrootfh()]) e = "operation erroneously suceeding" - except rpc.RPCDeniedError, e: + except rpc.RPCDeniedError as e: if e.stat == rpc.AUTH_ERROR and e.astat == rpc.RPCSEC_GSS_CTXPROBLEM: # This is correct response return - except Exception, e: + except Exception as e: pass t.fail("Using gss_seq_num over MAXSEQ " "should return RPCSEC_GSS_CTXPROBLEM, instead got %s" % e) @@ -279,11 +279,11 @@ def testBadProcedure(t, env): try: res = c.compound([op.putrootfh()]) e = "operation erroneously suceeding" - except rpc.RPCDeniedError, e: + except rpc.RPCDeniedError as e: if e.stat == rpc.AUTH_ERROR and e.astat == rpc.AUTH_BADCRED: # This is correct response e = None - except Exception, e: + except Exception as e: pass if e is not None: t.fail("Using bad gss procedure number %i " @@ -321,11 +321,11 @@ def testBadService(t, env): try: res = c.compound([op.putrootfh()]) e = "operation erroneously suceeding" - except rpc.RPCDeniedError, e: + except rpc.RPCDeniedError as e: if e.stat == rpc.AUTH_ERROR and e.astat == rpc.AUTH_BADCRED: # This is correct response e = None - except Exception, e: + except Exception as e: pass if e is not None: t.fail("Using bad gss service number %i " diff --git a/nfs4.0/servertests/st_link.py b/nfs4.0/servertests/st_link.py index 49e0538..feddf1e 100644 --- a/nfs4.0/servertests/st_link.py +++ b/nfs4.0/servertests/st_link.py @@ -264,6 +264,6 @@ def testDots(t, env): (x, rejected_names_link) = self.try_file_names(creator=self.create_via_link) self.failIf(rejected_names_open != rejected_names_link, "LINK does not obey OPEN naming policy") - except SkipException, e: + except SkipException as e: self.skip(e) diff --git a/nfs4.0/servertests/st_lookup.py b/nfs4.0/servertests/st_lookup.py index c3203f9..cd1b93c 100644 --- a/nfs4.0/servertests/st_lookup.py +++ b/nfs4.0/servertests/st_lookup.py @@ -312,7 +312,7 @@ def testBadOpaque(t, env): res = c.compound([op.putrootfh(), op.lookup("setlength=0xcccccccc")]) e = "operation erroneously suceeding" check(res, NFS4ERR_BADXDR) - except rpc.RPCAcceptError, e: + except rpc.RPCAcceptError as e: if e.stat == rpc.GARBAGE_ARGS: # This is correct response return @@ -336,7 +336,7 @@ def testBadOpaque(t, env): # Saved files for LOOKUP try: (accepted_names, rejected_names) = self.try_file_names(0) - except SkipException, e: + except SkipException as e: self.skip(e) # Ok, lets try LOOKUP on all accepted names @@ -363,7 +363,7 @@ def testBadOpaque(t, env): try: (accepted_names, rejected_names) = self.try_file_names() - except SkipException, e: + except SkipException as e: self.skip(e) # Ok, lets try LOOKUP on all rejected names diff --git a/nfs4.0/servertests/st_readdir.py b/nfs4.0/servertests/st_readdir.py index a88c370..5a70145 100644 --- a/nfs4.0/servertests/st_readdir.py +++ b/nfs4.0/servertests/st_readdir.py @@ -272,7 +272,7 @@ def testUnaccessibleDirAttrs(t, env): try: (accepted_names, rejected_names) = self.try_file_names(remove_files=0) - except SkipException, e: + except SkipException as e: self.skip(e) fh = self.do_rpc(self.ncl.do_getfh, self.tmp_dir) @@ -309,11 +309,11 @@ def testUnaccessibleDirAttrs(t, env): try: (accepted_names, rejected_names) = self.small_try_file_names(remove_files=0) - except SkipException, e: + except SkipException as e: self.skip(e) try: self.clean_dir(self.tmp_dir) - except SkipException, e: + except SkipException as e: self.fail(e) def small_try_file_names(self, remove_files=1, creator=None): diff --git a/nfs4.0/servertests/st_remove.py b/nfs4.0/servertests/st_remove.py index 076ca41..5f531f4 100644 --- a/nfs4.0/servertests/st_remove.py +++ b/nfs4.0/servertests/st_remove.py @@ -274,7 +274,7 @@ def testNotEmpty(t, env): # Save files for REMOVE try: (accepted_names, rejected_names) = self.try_file_names(remove_files=0) - except SkipException, e: + except SkipException as e: self.skip(e) # Ok, lets try REMOVE on all accepted names @@ -299,7 +299,7 @@ def testNotEmpty(t, env): self.init_connection() try: (accepted_names, rejected_names) = self.try_file_names() - except SkipException, e: + except SkipException as e: self.skip(e) # Ok, lets try REMOVE on all rejected names diff --git a/nfs4.0/servertests/st_rename.py b/nfs4.0/servertests/st_rename.py index 5698a8c..8f41763 100644 --- a/nfs4.0/servertests/st_rename.py +++ b/nfs4.0/servertests/st_rename.py @@ -534,7 +534,7 @@ def testLinkRename(t, env): (x, rejected_names_rename) = self.try_file_names(creator=self.create_via_rename) self.failIf(rejected_names_open != rejected_names_rename, "RENAME does not obey OPEN naming policy") - except SkipException, e: + except SkipException as e: self.skip(e) def testValidNames(t, env): @@ -550,7 +550,7 @@ def testLinkRename(t, env): # Saved files for try: (accepted_names, rejected_names) = self.try_file_names(remove_files=0) - except SkipException, e: + except SkipException as e: self.skip(e) # Ok, lets try RENAME on all accepted names @@ -573,7 +573,7 @@ def testLinkRename(t, env): try: (accepted_names, rejected_names) = self.try_file_names() - except SkipException, e: + except SkipException as e: self.skip(e) # Ok, lets try RENAME on all rejected names diff --git a/nfs4.0/testserver.py b/nfs4.0/testserver.py index c049a5a..96012a1 100755 --- a/nfs4.0/testserver.py +++ b/nfs4.0/testserver.py @@ -297,7 +297,7 @@ def main(): p.error("Can't use dir for --%s" %attr) try: path = unixpath2comps(path) - except Exception, e: + except Exception as e: p.error(e) setattr(opt, attr, [comp for comp in path if comp]) @@ -341,12 +341,12 @@ def main(): try: env = environment.Environment(opt) env.init() - except socket.gaierror, e: + except socket.gaierror as e: if e.args[0] == -2: print("Unknown server '%s'" % opt.server) print(sys.exc_info()[1]) sys.exit(1) - except Exception, e: + except Exception as e: print("Initialization failed, no tests run.") if not opt.maketree: print("Perhaps you need to use the --maketree option") @@ -367,7 +367,7 @@ def main(): try: fail = False env.finish() - except Exception, e: + except Exception as e: fail = True nfail = testmod.printresults(tests, opt) if fail: diff --git a/nfs4.1/config.py b/nfs4.1/config.py index 1dbb2ac..23b5b9a 100644 --- a/nfs4.1/config.py +++ b/nfs4.1/config.py @@ -74,7 +74,7 @@ class ConfigLine(object): def _set_value(self, value): try: self._value = self.verify(value) - except ConfigAction, e: + except ConfigAction as e: e.name = self.name e.value = value raise diff --git a/nfs4.1/fs.py b/nfs4.1/fs.py index 8947014..d9b58f2 100644 --- a/nfs4.1/fs.py +++ b/nfs4.1/fs.py @@ -323,7 +323,7 @@ class FSObject(object): base = self.meta try: setattr(base, name, attrs[attr]) - except NFS4Error, e: + except NFS4Error as e: # Note attributes set so far in any error that occurred e.attrs = bitmap raise @@ -747,7 +747,7 @@ class ConfigObj(FSObject): return try: self.configline.value = lines[0] - except ConfigAction, e: + except ConfigAction as e: if e.name == "reboot": self.fs.server.reboot() except: diff --git a/nfs4.1/nfs4client.py b/nfs4.1/nfs4client.py index 3e28103..708850d 100644 --- a/nfs4.1/nfs4client.py +++ b/nfs4.1/nfs4client.py @@ -161,7 +161,7 @@ class NFS4Client(rpc.Client, rpc.Server): env.results.cache.results)) env.cache.data = p.get_buffer() env.cache.valid.set() - except NFS4Replay, e: + except NFS4Replay as e: log_cb.info("Replay...waiting for valid data") e.cache.valid.wait() log_cb.info("Replay...sending data") @@ -183,7 +183,7 @@ class NFS4Client(rpc.Client, rpc.Server): return env try: self.check_utf8str_cs(args.tag) - except NFS4Errror, e: + except NFS4Errror as e: env.results.set_empty_return(e.status, "Invalid utf8 tag") return env # Handle the individual operations @@ -202,7 +202,7 @@ class NFS4Client(rpc.Client, rpc.Server): try: # Otherwise, call the function result = funct(arg, env) - except NFS4Error, e: + except NFS4Error as e: # XXX NOTE this only works for error returns that # include no data. Must ensure others (eg setattr) # catch error themselves to encode properly. diff --git a/nfs4.1/nfs4server.py b/nfs4.1/nfs4server.py index 8856a82..f8bd251 100755 --- a/nfs4.1/nfs4server.py +++ b/nfs4.1/nfs4server.py @@ -350,7 +350,7 @@ class ClientRecord(object): state.delete() # STUB - what about LAYOUT? # STUB - config whether DELEG OK or not - except StandardError, e: + except StandardError as e: log_41.exception("Ignoring problem during state removal") self.state = {} self.lastused = time.time() @@ -721,7 +721,7 @@ class NFS4Server(rpc.Server): env.results.cache.results)) env.cache.data = p.get_buffer() env.cache.valid.set() - except NFS4Replay, e: + except NFS4Replay as e: log_41.info("Replay...waiting for valid data") e.cache.valid.wait() log_41.info("Replay...sending data") @@ -808,7 +808,7 @@ class NFS4Server(rpc.Server): return env try: self.check_utf8str_cs(args.tag) - except NFS4Errror, e: + except NFS4Errror as e: env.results.set_empty_return(e.status, "Invalid utf8 tag") return env # Handle the individual operations @@ -828,7 +828,7 @@ class NFS4Server(rpc.Server): try: # Otherwise, call the function result = funct(arg, env) - except NFS4Error, e: + except NFS4Error as e: # XXX NOTE this only works for error returns that # include no data. Must ensure others (eg setattr) # catch error themselves to encode properly. @@ -876,7 +876,7 @@ class NFS4Server(rpc.Server): # We have a session. Check for injected errors try: self.check_opsconfig(env, "sequence") - except NFS4Error, e: + except NFS4Error as e: self.error_set_session(session, arg.sa_sessionid, e.status) # Check connection binding @@ -962,7 +962,7 @@ class NFS4Server(rpc.Server): self.cb_null(session.cb_prog, connection, credinfo=None) flags |= CREATE_SESSION4_FLAG_CONN_BACK_CHAN cb_channel.connections.append(connection) - except rpc.RPCError, e: + except rpc.RPCError as e: log_41.warn("cb_null failed with %r, no backchannel created", e) # STUB: backchannel is down: set sequence bits, disable layouts, etc. pass @@ -1604,7 +1604,7 @@ class NFS4Server(rpc.Server): finally: state.mark_done_writing() return encode_status(NFS4_OK, bitmap) - except NFS4Error, e: + except NFS4Error as e: # SETATTR failure does not encode just status return encode_status(e.status, e.attrs) @@ -1702,7 +1702,7 @@ class NFS4Server(rpc.Server): if FATTR4_RDATTR_ERROR in attrreq: raise NFS4Error(NFS4ERR_INVAL) attrvals = self.get_attributes(env.cfh, attrreq.keys(), ignore=False) - except NFS4Error, e: + except NFS4Error as e: return encode_status(e.code) if attrvals == attrreq: return encode_status(NFS4ERR_SAME) @@ -1717,7 +1717,7 @@ class NFS4Server(rpc.Server): if FATTR4_RDATTR_ERROR in attrreq: raise NFS4Error(NFS4ERR_INVAL) attrvals = self.get_attributes(env.cfh, attrreq.keys(), ignore=False) - except NFS4Error, e: + except NFS4Error as e: return encode_status(e.code) if attrvals != attrreq: return encode_status(NFS4ERR_NOT_SAME) @@ -1806,7 +1806,7 @@ class NFS4Server(rpc.Server): with find_state(env, arg.lock_stateid, allow_0=False) as state: state.add_lock(arg.locktype, arg.offset, end) stateid = state.get_id() - except NFS4Error, e: + except NFS4Error as e: return encode_status(e.status, denied=e.lock_denied) l4resok = LOCK4resok(stateid) return encode_status(NFS4_OK, l4resok) @@ -1820,7 +1820,7 @@ class NFS4Server(rpc.Server): with env.cfh.state: env.cfh.state.test_lock(env.session.client, arg.owner.owner, arg.locktype, arg.offset, end) - except NFS4Error, e: + except NFS4Error as e: return encode_status(e.status, denied=e.lock_denied) return encode_status(NFS4_OK) @@ -1904,7 +1904,7 @@ class NFS4Server(rpc.Server): return_on_close = False res = LAYOUTGET4resok(return_on_close, entry.get_id(), [layout]) return encode_status(NFS4_OK, res) - except NFS4Error, e: + except NFS4Error as e: # LAYOUTGET failure does not encode just status if e.status == NFS4ERR_LAYOUTTRYLATER: return encode_status(e.status, None, False) diff --git a/nfs4.1/server41tests/st_compound.py b/nfs4.1/server41tests/st_compound.py index 05ad5b3..3915dd8 100644 --- a/nfs4.1/server41tests/st_compound.py +++ b/nfs4.1/server41tests/st_compound.py @@ -118,7 +118,7 @@ def testUndefined(t, env): check(res, NFS4ERR_OP_ILLEGAL) if res.resarray[-1].resop != OP_ILLEGAL: t.fail('Server echoed invalid opcode: Should return OP_ILLEGAL') - except RPCAcceptError, e: + except RPCAcceptError as e: if e.stat == GARBAGE_ARGS: pass else: diff --git a/nfs4.1/server41tests/st_create_session.py b/nfs4.1/server41tests/st_create_session.py index 2ab8ba0..5018ec6 100644 --- a/nfs4.1/server41tests/st_create_session.py +++ b/nfs4.1/server41tests/st_create_session.py @@ -311,7 +311,7 @@ def testRdmaArray2(t, env): try: res = c.listen(xid) print(res) - except RPCAcceptError, e: + except RPCAcceptError as e: if e.stat == GARBAGE_ARGS: # Legitimate return return diff --git a/nfs4.1/server41tests/st_exchange_id.py b/nfs4.1/server41tests/st_exchange_id.py index 68f3b09..9becec6 100644 --- a/nfs4.1/server41tests/st_exchange_id.py +++ b/nfs4.1/server41tests/st_exchange_id.py @@ -119,7 +119,7 @@ def testLongArray(t, env): try: res = c.listen(xid) print(res) - except RPCAcceptError, e: + except RPCAcceptError as e: if e.stat == GARBAGE_ARGS: # Legitimate return return diff --git a/nfs4.1/server41tests/st_lookup.py b/nfs4.1/server41tests/st_lookup.py index 7ba6918..9f50004 100644 --- a/nfs4.1/server41tests/st_lookup.py +++ b/nfs4.1/server41tests/st_lookup.py @@ -360,7 +360,7 @@ if 0: # Saved files for LOOKUP try: (accepted_names, rejected_names) = self.try_file_names(0) - except SkipException, e: + except SkipException as e: self.skip(e) # Ok, lets try LOOKUP on all accepted names @@ -387,7 +387,7 @@ if 0: try: (accepted_names, rejected_names) = self.try_file_names() - except SkipException, e: + except SkipException as e: self.skip(e) # Ok, lets try LOOKUP on all rejected names diff --git a/nfs4.1/testclient.py b/nfs4.1/testclient.py index 8a1be9f..1027fa6 100755 --- a/nfs4.1/testclient.py +++ b/nfs4.1/testclient.py @@ -257,7 +257,7 @@ def main(): p.error("Can't use dir for --%s" %attr) try: path = nfs4lib.path_components(path) - except Exception, e: + except Exception as e: p.error(e) setattr(opt, attr, [comp for comp in path if comp]) @@ -301,11 +301,11 @@ def main(): try: env = environment.Environment(opt) env.init() - except socket.gaierror, e: + except socket.gaierror as e: if e.args[0] == -2: print("Unknown server '%s'" % opt.server) sys.exit(1) - except Exception, e: + except Exception as e: print("Initialization failed, no tests run.") if not opt.maketree: print("Perhaps you need to use the --maketree option") @@ -326,7 +326,7 @@ def main(): try: fail = False env.finish() - except Exception, e: + except Exception as e: fail = True testmod.printresults(tests, opt) if fail: diff --git a/nfs4.1/testmod.py b/nfs4.1/testmod.py index a8b4a82..8108a23 100644 --- a/nfs4.1/testmod.py +++ b/nfs4.1/testmod.py @@ -226,19 +226,19 @@ class Test(object): environment.clean_clients() except KeyboardInterrupt: raise - except TestException, e: + except TestException as e: self.result = Result(e.type, e, sys.exc_info()) - except StandardError, e: + except StandardError as e: if verbose: print_exc() self.result = Result(TEST_FAIL, '', sys.exc_info()) self.result.msg = self.result.tb[-1] - except Exception, e: + except Exception as e: self.result = Result(TEST_FAIL, e, sys.exc_info()) self.result.msg = self.result.tb[-1] try: environment.shutDown() - except StandardError, e: + except StandardError as e: self.result = Result(TEST_FAIL, '', sys.exc_info()) self.result.msg = self.result.tb[-1] diff --git a/nfs4.1/testserver.py b/nfs4.1/testserver.py index 70b4f62..101cfb1 100755 --- a/nfs4.1/testserver.py +++ b/nfs4.1/testserver.py @@ -269,7 +269,7 @@ def main(): p.error("Can't use dir for --%s" %attr) try: path = nfs4lib.path_components(path) - except Exception, e: + except Exception as e: p.error(e) setattr(opt, attr, [comp for comp in path if comp]) @@ -320,12 +320,12 @@ def main(): try: env = environment.Environment(opt) env.init() - except socket.gaierror, e: + except socket.gaierror as e: if e.args[0] == -2: print("Unknown server '%s'" % opt.server) print(sys.exc_info()[1]) sys.exit(1) - except Exception, e: + except Exception as e: print("Initialization failed, no tests run.") if not opt.maketree: print("Perhaps you need to use the --maketree option") @@ -346,7 +346,7 @@ def main(): try: fail = False env.finish() - except Exception, e: + except Exception as e: fail = True testmod.printresults(tests, opt) if fail: diff --git a/rpc/rpc.py b/rpc/rpc.py index e06dbbf..834fedd 100644 --- a/rpc/rpc.py +++ b/rpc/rpc.py @@ -169,7 +169,7 @@ class Alarm(object): self._s.setblocking(0) try: self._s.connect(address) - except socket.error, e: + except socket.error as e: if e.args[0] in [EINPROGRESS, EWOULDBLOCK]: # address has not yet called accept, since this is done in a # single thread, so get "op in progress error". When the @@ -330,7 +330,7 @@ class Pipe(object): raise RuntimeError try: count = self._s.send(self._write_buf) - except socket.error, e: + except socket.error as e: log_p.error("flush_pipe got exception %s" % str(e)) return True # This is to stop retries self._write_buf = self._write_buf[count:] @@ -513,13 +513,13 @@ class ConnectionHandler(object): for fd in w: try: self._event_write(fd) - except socket.error, e: + except socket.error as e: self._event_close(fd) for fd in r: if fd in self.listeners: try: self._event_connect_incoming(fd) - except socket.error, e: + except socket.error as e: self._event_close(fd) elif fd == self._alarm_poll.fileno(): commands = self._alarm_poll.recv(self.rsize) @@ -527,7 +527,7 @@ class ConnectionHandler(object): data = self._alarm.pop() try: switch[c](data) - except socket.error, e: + except socket.error as e: self._event_close(fd) else: try: @@ -557,7 +557,7 @@ class ConnectionHandler(object): s.setblocking(0) else: csock, caddr = s.accept() - except socket.error, e: + except socket.error as e: log_p.error("accept() got error %s" % str(e)) return csock.setblocking(0) @@ -700,7 +700,7 @@ class ConnectionHandler(object): # Silently drop the request self._notify_drop() return - except rpclib.RPCFlowContol, e: + except rpclib.RPCFlowContol as e: body, data = e.body() except Exception: log_t.warn("Unexpected exception", exc_info=True) @@ -832,7 +832,7 @@ class ConnectionHandler(object): try: s.bind(('', using)) return - except socket.error, why: + except socket.error as why: if why[0] == errno.EADDRINUSE: using += 1 if port < 1024 <= using: diff --git a/rpc/rpclib.py b/rpc/rpclib.py index e7bb965..e738870 100644 --- a/rpc/rpclib.py +++ b/rpc/rpclib.py @@ -33,7 +33,7 @@ class RPCDeniedReply(RPCFlowContol): else: # Something has gone haywire rreply = rejected_reply(AUTH_ERROR, astat=AUTH_FAILED) - except Exception, e: + except Exception as e: log.critical("Oops, encountered bug", exc_info=True) rreply = rejected_reply(AUTH_ERROR, astat=AUTH_FAILED) return reply_body(MSG_DENIED, rreply=rreply), '' @@ -52,7 +52,7 @@ class RPCUnsuccessfulReply(RPCFlowContol): data = rpc_reply_data(self.stat) if self.stat == PROG_MISMATCH: data.mismatch_info = rpc_mismatch_info(*self.statdata) - except Exception, e: + except Exception as e: log.critical("Oops, encountered bug", exc_info=True) data = rpc_reply_data(SYSTEM_ERR) areply = accepted_reply(NULL_CRED, data) diff --git a/rpc/security.py b/rpc/security.py index 1bfb920..896d7a2 100644 --- a/rpc/security.py +++ b/rpc/security.py @@ -379,7 +379,7 @@ class AuthGss(AuthNone): else: # Can't get here, but doesn't hurt log_gss.error("Unknown service %i for RPCSEC_GSS" % cred.service) - except gssapi.Error, e: + except gssapi.Error as e: log_gss.warn("unsecure_data: gssapi call returned %s" % e.name) raise rpclib.RPCUnsuccessfulReply(GARBAGE_ARGS) return data @@ -413,7 +413,7 @@ class AuthGss(AuthNone): else: # Can't get here, but doesn't hurt log_gss.error("Unknown service %i for RPCSEC_GSS" % cred.service) - except gssapi.Error, e: + except gssapi.Error as e: # XXX What now? log_gss.warn("secure_data: gssapi call returned %s" % e.name) raise @@ -449,7 +449,7 @@ class AuthGss(AuthNone): data = self.partially_packed_header(xid, body) try: qop = self._get_context(body.cred.body.handle).verifyMIC(data, body.verf.body) - except gssapi.Error, e: + except gssapi.Error as e: log_gss.warn("Verifier checksum failed verification with %s" % e.name) return False @@ -522,7 +522,7 @@ class AuthGss(AuthNone): context = self._get_context(cred.body.handle) try: token = context.accept(token) - except gssapi.Error, e: + except gssapi.Error as e: log_gss.debug("RPCSEC_GSS_INIT failed (%s, %i)!" % (e.name, e.minor)) res = rpc_gss_init_res('', e.major, e.minor, 0, '') From patchwork Tue Jul 24 07:33:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jianhong Yin X-Patchwork-Id: 10541401 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0B7B7184F for ; Tue, 24 Jul 2018 07:34:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E2F4C2875C for ; Tue, 24 Jul 2018 07:34:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D7A9C28763; Tue, 24 Jul 2018 07:34:05 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 558972875C for ; Tue, 24 Jul 2018 07:34:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388405AbeGXIjG (ORCPT ); Tue, 24 Jul 2018 04:39:06 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:54804 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2388346AbeGXIjG (ORCPT ); Tue, 24 Jul 2018 04:39:06 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DF1D17DAC2; Tue, 24 Jul 2018 07:33:56 +0000 (UTC) Received: from dhcp-12-115.nay.redhat.com (unknown [10.66.12.115]) by smtp.corp.redhat.com (Postfix) with ESMTP id 52FF3178B3; Tue, 24 Jul 2018 07:33:55 +0000 (UTC) From: jiyin@redhat.com To: bfields@redhat.com Cc: linux-nfs@vger.kernel.org, "Jianhong.Yin" Subject: [PATCH 04/24] pynfs: python3 support plan: "raise E, args:" -> "raise E(args)" Date: Tue, 24 Jul 2018 15:33:22 +0800 Message-Id: <20180724073342.5738-4-jiyin@redhat.com> In-Reply-To: <20180724073342.5738-1-jiyin@redhat.com> References: <20180724073342.5738-1-jiyin@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Tue, 24 Jul 2018 07:33:56 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Tue, 24 Jul 2018 07:33:56 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'jiyin@redhat.com' RCPT:'' Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: "Jianhong.Yin" '/raise / { :loop /[^\\]$/! {N; b loop}; s/\ --- nfs4.0/lib/rpc/rpcsec/sec_auth_gss.py | 52 +++++++++++++-------------- nfs4.0/nfs4state.py | 28 +++++++-------- nfs4.1/config.py | 2 +- nfs4.1/nfs4state.py | 4 +-- xdr/xdrgen.py | 22 ++++++------ 5 files changed, 54 insertions(+), 54 deletions(-) diff --git a/nfs4.0/lib/rpc/rpcsec/sec_auth_gss.py b/nfs4.0/lib/rpc/rpcsec/sec_auth_gss.py index 2c68875..6351355 100644 --- a/nfs4.0/lib/rpc/rpcsec/sec_auth_gss.py +++ b/nfs4.0/lib/rpc/rpcsec/sec_auth_gss.py @@ -127,8 +127,8 @@ class SecAuthGss(SecFlavor): self.gss_seq_num = 0 d = gssapi.importName("nfs@%s" % client.remotehost) if d['major'] != gssapi.GSS_S_COMPLETE: - raise SecError, "gssapi.importName returned: %s" % \ - show_major(d['major']) + raise SecError("gssapi.importName returned: %s" % \ + show_major(d['major'])) name = d['name'] # We need to send NULLPROCs with token from initSecContext good_major = [gssapi.GSS_S_COMPLETE, gssapi.GSS_S_CONTINUE_NEEDED] @@ -141,11 +141,11 @@ class SecAuthGss(SecFlavor): major = d['major'] context = d['context'] if major not in good_major: - raise SecError, "gssapi.initSecContext returned: %s" % \ - show_major(major) + raise SecError("gssapi.initSecContext returned: %s" % \ + show_major(major)) if (major == gssapi.GSS_S_CONTINUE_NEEDED) and \ (reply_major == gssapi.GSS_S_COMPLETE): - raise SecError, "Unexpected GSS_S_COMPLETE from server" + raise SecError("Unexpected GSS_S_COMPLETE from server") token = d['token'] if reply_major != gssapi.GSS_S_COMPLETE: # FRED - sec 5.2.2 of RFC 2203 mentions possibility that @@ -161,13 +161,13 @@ class SecAuthGss(SecFlavor): up.done() reply_major = res.gss_major if reply_major not in good_major: - raise SecError, "Server returned: %s" % \ - show_major(reply_major) + raise SecError("Server returned: %s" % \ + show_major(reply_major)) self.init = 2 reply_token = res.gss_token if major == gssapi.GSS_S_COMPLETE: if reply_major != gssapi.GSS_S_COMPLETE: - raise SecError, "Unexpected COMPLETE from client" + raise SecError("Unexpected COMPLETE from client") break self.gss_context = context self.gss_handle = res.handle @@ -240,8 +240,8 @@ class SecAuthGss(SecFlavor): d = gssapi.getMIC(self.gss_context, data) major = d['major'] if major != gssapi.GSS_S_COMPLETE: - raise SecError, "gssapi.getMIC returned: %s" % \ - show_major(major) + raise SecError("gssapi.getMIC returned: %s" % \ + show_major(major)) return opaque_auth(RPCSEC_GSS, d['token']) def _make_cred_gss(self, handle, service, gss_proc=RPCSEC_GSS_DATA, seq=0): @@ -266,8 +266,8 @@ class SecAuthGss(SecFlavor): data = p.get_buffer() + data d = gssapi.getMIC(self.gss_context, data) if d['major'] != gssapi.GSS_S_COMPLETE: - raise SecError, "gssapi.getMIC returned: %s" % \ - show_major(d['major']) + raise SecError("gssapi.getMIC returned: %s" % \ + show_major(d['major'])) p.reset() p.pack_opaque(data) p.pack_opaque(d['token']) @@ -280,14 +280,14 @@ class SecAuthGss(SecFlavor): data = p.get_buffer() + data d = gssapi.wrap(self.gss_context, data) if d['major'] != gssapi.GSS_S_COMPLETE: - raise SecError, "gssapi.wrap returned: %s" % \ - show_major(d['major']) + raise SecError("gssapi.wrap returned: %s" % \ + show_major(d['major'])) p.reset() p.pack_opaque(d['msg']) data = p.get_buffer() else: # Not really necessary, should have already raised XDRError - raise SecError, "Unknown service %i for RPCSEC_GSS" % gss_cred.service + raise SecError("Unknown service %i for RPCSEC_GSS" % gss_cred.service) return data def unsecure_data(self, data, cred): @@ -305,14 +305,14 @@ class SecAuthGss(SecFlavor): p.done() d = gssapi.verifyMIC(self.gss_context, data, checksum) if d['major'] != gssapi.GSS_S_COMPLETE: - raise SecError, "gssapi.verifyMIC returned: %s" % \ - show_major(d['major']) + raise SecError("gssapi.verifyMIC returned: %s" % \ + show_major(d['major'])) p.reset(data) seqnum = p.unpack_uint() if seqnum != gss_cred.seq_num: - raise SecError, \ + raise SecError(\ "Mismatched seqnum in reply: got %i, expected %i" % \ - (seqnum, gss_cred.seq_num) + (seqnum, gss_cred.seq_num)) data = p.get_buffer()[p.get_position():] elif gss_cred.service == rpc_gss_svc_privacy: # data = opaque[wrap([gss_seq_num+data])] @@ -322,18 +322,18 @@ class SecAuthGss(SecFlavor): p.done() d = gssapi.unwrap(self.gss_context, data) if d['major'] != gssapi.GSS_S_COMPLETE: - raise SecError, "gssapi.unwrap returned %s" % \ - show_major(d['major']) + raise SecError("gssapi.unwrap returned %s" % \ + show_major(d['major'])) p.reset(d['msg']) seqnum = p.unpack_uint() if seqnum != gss_cred.seq_num: - raise SecError, \ + raise SecError(\ "Mismatched seqnum in reply: got %i, expected %i" % \ - (seqnum, self.gss_cred.seq_num) + (seqnum, self.gss_cred.seq_num)) data = p.get_buffer()[p.get_position():] else: # Not really necessary, should have already raised XDRError - raise SecError, "Unknown service %i for RPCSEC_GSS" % gss_cred.service + raise SecError("Unknown service %i for RPCSEC_GSS" % gss_cred.service) return data def _gss_cred_from_opaque_auth(self, auth): @@ -361,8 +361,8 @@ class SecAuthGss(SecFlavor): p.pack_uint(i) d = gssapi.getMIC(self.gss_context, p.get_buffer()) if d['major'] != gssapi.GSS_S_COMPLETE: - raise SecError, "gssapi.getMIC returned: %s" % \ - show_major(d['major']) + raise SecError("gssapi.getMIC returned: %s" % \ + show_major(d['major'])) return opaque_auth(RPCSEC_GSS, d['token']) def check_verf(self, rverf, cred): diff --git a/nfs4.0/nfs4state.py b/nfs4.0/nfs4state.py index 064aadd..e854b3b 100755 --- a/nfs4.0/nfs4state.py +++ b/nfs4.0/nfs4state.py @@ -146,7 +146,7 @@ class NFSServerState: def addentry(self, entry): if not isinstance(entry, self.CacheEntry): - raise TypeError, "Bad entry: %s" % str(entry) + raise TypeError("Bad entry: %s" % str(entry)) if self.exists(x=entry.x) or self.exists(c=entry.c): raise "Bad Cache" self.list.append(entry) @@ -200,7 +200,7 @@ class NFSServerState: elif isinstance(owner, lock_owner4): self.openid = openid else: - raise TypeError, "Passed in owner = %s" % str(owner) + raise TypeError("Passed in owner = %s" % str(owner)) # An owner is confirmed with OpenConfirm, a lock by sending stateid self.confirmed = False self.owner = owner @@ -323,7 +323,7 @@ class NFSServerState: Conflict will raise NFS4Error. """ if not isinstance(owner, open_owner4): - raise TypeError, "Owner was given as %s" % str(owner) + raise TypeError("Owner was given as %s" % str(owner)) info = self.__getinfo(owner) if not info.confirmed: # Remove any pending open (RFC 3530 sec 14.2.18) @@ -380,7 +380,7 @@ class NFSServerState: def __state2id(self, stateid, checkseq=False): """Translate nfs4 stateid to internal id""" if not isinstance(stateid, stateid4): - raise TypeError, "State was given as %s" % str(stateid) + raise TypeError("State was given as %s" % str(stateid)) # Check for special stateids if stateid.seqid==0 and stateid.other==chr(0)*12: return 0 @@ -407,11 +407,11 @@ class NFSServerState: info = self.__owner2info(owner, allownew) try: if fh is None: - raise ValueError, "File is None" + raise ValueError("File is None") return info.files[fh.handle] except KeyError: if not allownew: - raise ValueError, "File %s not open for %s" % (fh.name, info) + raise ValueError("File %s not open for %s" % (fh.name, info)) #print("Creating new id %i for fh %s" % (self.next_id, fh.handle)) id = info.files[fh.handle] = self.next_id self.next_id += 1 @@ -428,12 +428,12 @@ class NFSServerState: elif isinstance(owner, lock_owner4): ownerdict = self.lockowners else: - raise TypeError, "Gave owner as %s" % str(owner) + raise TypeError("Gave owner as %s" % str(owner)) self.__check_clientid(owner.clientid) try: info = ownerdict[owner.clientid][owner.owner] except KeyError: - if not allownew: raise ValueError, "Unknown owner %s" % str(owner) + if not allownew: raise ValueError("Unknown owner %s" % str(owner)) #print("Creating new info") info = self.OwnerInfo(owner) if owner.clientid in ownerdict: @@ -694,8 +694,8 @@ class NFSFileState: self.start = start self.end = end if start < 0 or end < start: - raise ValueError, "Bad values for start and end (%s, %s)" % \ - (start, end) + raise ValueError("Bad values for start and end (%s, %s)" % \ + (start, end)) def __repr__(self): if self.type & 1: str = "READ" @@ -1478,7 +1478,7 @@ class DirList: for x in self.list: if x.name == name: return x.fh - raise KeyError, "Invalid key %s" % name + raise KeyError("Invalid key %s" % name) def __setitem__(self, name, fh): """Allows self[name] = fh""" @@ -1499,18 +1499,18 @@ class DirList: if x.name == name: self.list.remove(x) return - raise KeyError, "Invalid key %s" % name + raise KeyError("Invalid key %s" % name) def getcookie(self, name): for x in self.list: if x.name == name: return x.cookie - raise KeyError, "Invalid key %s" % name + raise KeyError("Invalid key %s" % name) def readdir(self, cookie): """Returns DirEnt list containing all entries larger than cookie""" if cookie < 0 or cookie > self.__lastcookie: - raise IndexError, "Invalid cookie %i" % cookie + raise IndexError("Invalid cookie %i" % cookie) i = None for x in self.list: if x.cookie > cookie: diff --git a/nfs4.1/config.py b/nfs4.1/config.py index 23b5b9a..b4a45d7 100644 --- a/nfs4.1/config.py +++ b/nfs4.1/config.py @@ -56,7 +56,7 @@ def _opline(value): l = value else: print(' OPLINE type ', type(value)) - raise TypeError, 'Only type list or str accepted' + raise TypeError('Only type list or str accepted') if l[0] == "ERROR": if not len(l) == 3: print(' OPLINE length ', len) diff --git a/nfs4.1/nfs4state.py b/nfs4.1/nfs4state.py index 2214c0d..95f84df 100644 --- a/nfs4.1/nfs4state.py +++ b/nfs4.1/nfs4state.py @@ -99,8 +99,8 @@ class ByteLock(object): self.start = start self.end = end if start < 0 or end < start: - raise ValueError, "Bad values for start and end (%s, %s)" % \ - (start, end) + raise ValueError("Bad values for start and end (%s, %s)" % \ + (start, end)) def __repr__(self): str = ("WRITE" if self.iswrite else "READ") diff --git a/xdr/xdrgen.py b/xdr/xdrgen.py index 6353835..0aa1a52 100755 --- a/xdr/xdrgen.py +++ b/xdr/xdrgen.py @@ -819,7 +819,7 @@ class Info(object): (prefix, self.id) if self.len is not None: limit = "%sif len(data) > %s:\n" \ - "%s%sraise XDRError, 'array length too long'\n" %\ + "%s%sraise XDRError('array length too long')\n" %\ (prefix, self.fullname(self.len), prefix, varindent) array = limit + array else: @@ -846,7 +846,7 @@ class Info(object): (prefix, newdata, self.id) if self.len is not None: limit = "%sif len(%s) > %s:\n" \ - "%s%sraise XDRError, 'array length too long'\n" %\ + "%s%sraise XDRError('array length too long')\n" %\ (prefix, newdata, self.fullname(self.len), prefix, indent) array += limit newdata = 'data' @@ -858,7 +858,7 @@ class Info(object): prefix, data, subheader, array = self._array_pack(prefix, data) varlist = ["const.%s" % l.id for l in self.body] check = "%sif self.check_enum and %s not in [%s]:\n" \ - "%s%sraise XDRError, 'value=%%s not in enum %s' %% %s\n" % \ + "%s%sraise XDRError('value=%%s not in enum %s' %% %s)\n" % \ (prefix, data, ', '.join(varlist), prefix, indent, self.id, data) pack = check + "%sself.pack_int(%s)\n" % (prefix, data) @@ -868,7 +868,7 @@ class Info(object): prefix, data, subheader, array = self._array_unpack(prefix, data) varlist = ["const.%s" % l.id for l in self.body] check = "%sif self.check_enum and %s not in [%s]:\n" \ - "%s%sraise XDRError, 'value=%%s not in enum %s' %% %s\n" % \ + "%s%sraise XDRError('value=%%s not in enum %s' %% %s)\n" % \ (prefix, data, ', '.join(varlist), prefix, indent, self.id, data) unpack = "%s%s = self.unpack_int()\n" % (prefix, data) @@ -908,7 +908,7 @@ class Info(object): if default != []: pack += default[0].packout(prefix + indent, data) else: - pack += "%s%sraise XDRError, 'bad switch=%%s' %% %s.%s\n" % \ + pack += "%s%sraise XDRError('bad switch=%%s' %% %s.%s)\n" % \ (prefix, indent, data, switch.id) return subheader + pack + array @@ -950,7 +950,7 @@ class Info(object): ## (prefix, indent, data, data, default[0].id) ## unpack += arm else: - unpack += "%s%sraise XDRError, 'bad switch=%%s' %% %s.%s\n" % \ + unpack += "%s%sraise XDRError('bad switch=%%s' %% %s.%s)\n" % \ (prefix, indent, data, switch.id) return subheader + unpack + array @@ -1220,7 +1220,7 @@ class type_info(Info): def packout(self, prefix='', data='data'): check = "%sif %s.%s is None:\n" \ - "%s%sraise TypeError, '%s.%s == None'\n" % \ + "%s%sraise TypeError('%s.%s == None')\n" % \ (prefix, data, self.id, prefix, indent, data, self.id) if self.type == 'void': return prefix + 'pass\n' @@ -1279,8 +1279,8 @@ class type_info(Info): limit = '' else: limit = "%sif len(%s) > %s and self.check_array:\n" \ - "%s%sraise XDRError, " \ - "'array length too long for %s'\n" % \ + "%s%sraise XDRError(" \ + "'array length too long for %s')\n" % \ (prefix, data, self.fullname(self.len), prefix, indent, data) if self.fixed: fixchar = 'f' @@ -1303,8 +1303,8 @@ class type_info(Info): limit = '' else: limit = "%sif len(%s) > %s and self.check_array:\n" \ - "%s%sraise XDRError, " \ - "'array length too long for %s'\n" % \ + "%s%sraise XDRError(" \ + "'array length too long for %s')\n" % \ (prefix, data, self.fullname(self.len), prefix, indent, data) if self.fixed: fixchar = 'f' From patchwork Tue Jul 24 07:33:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jianhong Yin X-Patchwork-Id: 10541405 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2F4179093 for ; Tue, 24 Jul 2018 07:34:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 138202875C for ; Tue, 24 Jul 2018 07:34:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 080D928760; Tue, 24 Jul 2018 07:34:07 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8B77E2875E for ; Tue, 24 Jul 2018 07:34:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388346AbeGXIjG (ORCPT ); Tue, 24 Jul 2018 04:39:06 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:54810 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2388391AbeGXIjG (ORCPT ); Tue, 24 Jul 2018 04:39:06 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 182797DAC6; Tue, 24 Jul 2018 07:33:59 +0000 (UTC) Received: from dhcp-12-115.nay.redhat.com (unknown [10.66.12.115]) by smtp.corp.redhat.com (Postfix) with ESMTP id 80FA3178B4; Tue, 24 Jul 2018 07:33:57 +0000 (UTC) From: jiyin@redhat.com To: bfields@redhat.com Cc: linux-nfs@vger.kernel.org, "Jianhong.Yin" Subject: [PATCH 05/24] pynfs: python3 support plan: remove suffix 'L' of long integer Date: Tue, 24 Jul 2018 15:33:23 +0800 Message-Id: <20180724073342.5738-5-jiyin@redhat.com> In-Reply-To: <20180724073342.5738-1-jiyin@redhat.com> References: <20180724073342.5738-1-jiyin@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Tue, 24 Jul 2018 07:33:59 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Tue, 24 Jul 2018 07:33:59 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'jiyin@redhat.com' RCPT:'' Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: "Jianhong.Yin" s/(0x[[:xdigit:]]+)L\>/\1/g s/(\<[[:digit:]]+)L\>/\1/g Signed-off-by: Jianhong Yin --- nfs4.0/lib/rpc/rpc.py | 14 +++++++------- nfs4.0/lib/rpc/rpcsec/sec_auth_gss.py | 2 +- nfs4.0/nfs4lib.py | 8 ++++---- nfs4.0/nfs4server.py | 6 +++--- nfs4.0/nfs4state.py | 4 ++-- nfs4.0/servertests/environment.py | 2 +- nfs4.0/servertests/st_commit.py | 8 ++++---- nfs4.1/client41tests/environment.py | 2 +- nfs4.1/dataserver.py | 2 +- nfs4.1/fs.py | 2 +- nfs4.1/nfs4client.py | 2 +- nfs4.1/nfs4lib.py | 10 +++++----- nfs4.1/nfs4server.py | 4 ++-- nfs4.1/server41tests/environment.py | 4 ++-- nfs4.1/server41tests/st_debug.py | 2 +- nfs4.1/testmod.py | 2 +- rpc/rpc.py | 8 ++++---- 17 files changed, 41 insertions(+), 41 deletions(-) diff --git a/nfs4.0/lib/rpc/rpc.py b/nfs4.0/lib/rpc/rpc.py index 83a51c4..d9c1401 100644 --- a/nfs4.0/lib/rpc/rpc.py +++ b/nfs4.0/lib/rpc/rpc.py @@ -157,9 +157,9 @@ def _recv_record(self): while not last: rec_mark = self.recv_all(4) count = struct.unpack('>L', rec_mark)[0] - last = count & 0x80000000L + last = count & 0x80000000 if last: - count &= 0x7fffffffL + count &= 0x7fffffff data += self.recv_all(count) return data @@ -171,7 +171,7 @@ def _send_record(self, data, chunksize=2048): chunk = data[i:i+chunksize] i += chunksize if i >= dlen: - last = 0x80000000L + last = 0x80000000 mark = struct.pack('>L', last | len(chunk)) self.sendall(mark + chunk) @@ -202,7 +202,7 @@ class RPCClient(object): self._rpcunpacker = {t : rpc_pack.RPCUnpacker('')} self.default_prog = program self.default_vers = version - self.xid = 0L + self.xid = 0 self._xidlist = {} if sec_list is None: sec_list = [SecAuthNone()] @@ -558,8 +558,8 @@ class RPCServer(Server): str = self.readbufs[fd] if len(str) >= 4: packetlen = struct.unpack('>L', str[0:4])[0] - last = 0x80000000L & packetlen - packetlen &= 0x7fffffffL + last = 0x80000000 & packetlen + packetlen &= 0x7fffffff if len(str) >= 4 + packetlen: self.packetbufs[fd].append(str[4:4 + packetlen]) self.readbufs[fd] = str[4 + packetlen:] @@ -593,7 +593,7 @@ class RPCServer(Server): last = 0 self.recordbufs[fd][0] = data[chunksize:] else: - last = 0x80000000L + last = 0x80000000 del self.recordbufs[fd][0] mark = struct.pack('>L', last | len(chunk)) self.writebufs[fd] = (mark + chunk) diff --git a/nfs4.0/lib/rpc/rpcsec/sec_auth_gss.py b/nfs4.0/lib/rpc/rpcsec/sec_auth_gss.py index 6351355..ee6ad53 100644 --- a/nfs4.0/lib/rpc/rpcsec/sec_auth_gss.py +++ b/nfs4.0/lib/rpc/rpcsec/sec_auth_gss.py @@ -72,7 +72,7 @@ def show_major(m): """Return string corresponding to major code""" if m == 0: return gss_major_codes[0] - call = m & 0xff000000L + call = m & 0xff000000 routine = m & 0xff0000 supp = m & 0xffff out = [] diff --git a/nfs4.0/nfs4lib.py b/nfs4.0/nfs4lib.py index a0fdce1..d255eb7 100644 --- a/nfs4.0/nfs4lib.py +++ b/nfs4.0/nfs4lib.py @@ -93,7 +93,7 @@ class FancyNFS4Packer(nfs4_pack.NFS4Packer): def filter_bitmap4(self, data): out = [] while data: - out.append(data & 0xffffffffL) + out.append(data & 0xffffffff) data >>= 32 return out @@ -108,7 +108,7 @@ class FancyNFS4Packer(nfs4_pack.NFS4Packer): class FancyNFS4Unpacker(nfs4_pack.NFS4Unpacker): def filter_bitmap4(self, data): """Put bitmap into single long, instead of array of 32bit chunks""" - out = 0L + out = 0 shift = 0 for i in data: out |= (long(i) << shift) @@ -1006,9 +1006,9 @@ def fattr2dict(obj): def list2bitmap(list): """Construct a bitmap from a list of bit numbers""" - mask = 0L + mask = 0 for bit in list: - mask |= 1L << bit + mask |= 1 << bit return mask def bitmap2list(bitmap): diff --git a/nfs4.0/nfs4server.py b/nfs4.0/nfs4server.py index cb3ea72..163bd60 100755 --- a/nfs4.0/nfs4server.py +++ b/nfs4.0/nfs4server.py @@ -475,7 +475,7 @@ class NFS4Server(rpc.RPCServer): e = verify_name(filename) if e: raise NFS4Error(e) # At this point we know it is CLAIM_NULL with valid filename and cfh - attrset = 0L + attrset = 0 ci_old = self.curr_fh.fattr4_change if op.opopen.openhow.opentype == OPEN4_CREATE: print(" CREATING FILE.") @@ -812,13 +812,13 @@ class NFS4Server(rpc.RPCServer): print(" CURRENT FILEHANDLE: %s" % repr(self.curr_fh)) print(op.opsetattr.obj_attributes) if not self.curr_fh: - return simple_error(NFS4ERR_NOFILEHANDLE, 0L) + return simple_error(NFS4ERR_NOFILEHANDLE, 0) try: attrdict = op.opsetattr.obj_attributes if FATTR4_SIZE in attrdict: # This counts as a write, so must do some checking if self.curr_fh.get_type() != NF4REG: - return simple_error(NFS4ERR_BAD_STATEID, 0L) + return simple_error(NFS4ERR_BAD_STATEID, 0) oldsize = self.curr_fh.fattr4_size newsize = attrdict[FATTR4_SIZE] if oldsize <= newsize: diff --git a/nfs4.0/nfs4state.py b/nfs4.0/nfs4state.py index e854b3b..484a284 100755 --- a/nfs4.0/nfs4state.py +++ b/nfs4.0/nfs4state.py @@ -26,7 +26,7 @@ POSIXLOCK = True # If True, allow locks to be split/joined automatically POSIXACL = True # If True, forces acls to follow posix mapping rules class NFS4Error(Exception): - def __init__(self, code, msg=None, attrs=0L, lock_denied=None): + def __init__(self, code, msg=None, attrs=0, lock_denied=None): self.code = code self.name = nfsstat4[code] if msg is None: @@ -384,7 +384,7 @@ class NFSServerState: # Check for special stateids if stateid.seqid==0 and stateid.other==chr(0)*12: return 0 - if stateid.seqid==0xffffffffL and stateid.other==chr(0xff)*12: + if stateid.seqid==0xffffffff and stateid.other==chr(0xff)*12: return 1 # Check for self consistency if stateid.other[:4] != self.instance: diff --git a/nfs4.0/servertests/environment.py b/nfs4.0/servertests/environment.py index a848ed4..a5cfe60 100644 --- a/nfs4.0/servertests/environment.py +++ b/nfs4.0/servertests/environment.py @@ -119,7 +119,7 @@ class Environment(testmod.Environment): self.filedata = "This is the file test data." self.linkdata = "/etc/X11" self.stateid0 = stateid4(0, '') - self.stateid1 = stateid4(0xffffffffL, '\xff'*12) + self.stateid1 = stateid4(0xffffffff, '\xff'*12) def _get_security(self, opts): if opts.security == 'none': diff --git a/nfs4.0/servertests/st_commit.py b/nfs4.0/servertests/st_commit.py index e903739..eecf2c8 100644 --- a/nfs4.0/servertests/st_commit.py +++ b/nfs4.0/servertests/st_commit.py @@ -42,7 +42,7 @@ def testCommitOffsetMax1(t, env): DEPEND: MKFILE CODE: CMT1c """ - _commit(t, env.c1, 0xffffffffffffffffL, statlist=[NFS4_OK, NFS4ERR_INVAL]) + _commit(t, env.c1, 0xffffffffffffffff, statlist=[NFS4_OK, NFS4ERR_INVAL]) def testCommitOffsetMax2(t, env): """COMMIT @@ -51,7 +51,7 @@ def testCommitOffsetMax2(t, env): DEPEND: MKFILE CODE: CMT1d """ - _commit(t, env.c1, 0xfffffffffffffffeL, statlist=[NFS4_OK, NFS4ERR_INVAL]) + _commit(t, env.c1, 0xfffffffffffffffe, statlist=[NFS4_OK, NFS4ERR_INVAL]) def testCommitCount1(t, env): """COMMIT @@ -69,7 +69,7 @@ def testCommitCountMax(t, env): DEPEND: MKFILE CODE: CMT1f """ - _commit(t, env.c1, 0, 0xffffffffL) + _commit(t, env.c1, 0, 0xffffffff) def testLink(t, env): """COMMIT @@ -159,5 +159,5 @@ def testCommitOverflow(t, env): fh, stateid = c.create_confirm(t.code) res = c.write_file(fh, _text, 0, stateid, how=UNSTABLE4) check(res, msg="WRITE with how=UNSTABLE4") - res = c.commit_file(fh, 0xfffffffffffffff0L, 64) + res = c.commit_file(fh, 0xfffffffffffffff0, 64) check(res, NFS4ERR_INVAL, "COMMIT with offset + count overflow") diff --git a/nfs4.1/client41tests/environment.py b/nfs4.1/client41tests/environment.py index 6b48d12..7c7bb0c 100644 --- a/nfs4.1/client41tests/environment.py +++ b/nfs4.1/client41tests/environment.py @@ -373,7 +373,7 @@ def clean_dir(sess, path): res = sess.compound(ops) check(res, msg="Trying to remove %s" % repr(e.name)) -def do_readdir(sess, file, cookie=0, cookieverf='', attrs=0L, +def do_readdir(sess, file, cookie=0, cookieverf='', attrs=0, dircount=4096, maxcount=4096): # Since we may not get whole directory listing in one readdir request, # loop until we do. For each request result, create a flat list diff --git a/nfs4.1/dataserver.py b/nfs4.1/dataserver.py index f32f3d7..80179f8 100644 --- a/nfs4.1/dataserver.py +++ b/nfs4.1/dataserver.py @@ -206,7 +206,7 @@ class DataServer41(DataServer): def get_size(self, fh): ops = [op4.putfh(fh), - op4.getattr(1L << const4.FATTR4_SIZE)] + op4.getattr(1 << const4.FATTR4_SIZE)] res = self._execute(ops) attrdict = res.resarray[-1].obj_attributes return attrdict.get(const4.FATTR4_SIZE, 0) diff --git a/nfs4.1/fs.py b/nfs4.1/fs.py index d9b58f2..b0b06d5 100644 --- a/nfs4.1/fs.py +++ b/nfs4.1/fs.py @@ -306,7 +306,7 @@ class FSObject(object): # STUB - need to check principal, and set owner/group if needed log_o.log(5, "FSObject.set_attrs(%r)" % attrs) info = nfs4lib.attr_info - bitmap = 0L + bitmap = 0 try: for attr in attrs: if self.fs.fattr4_supported_attrs & attr == 0: diff --git a/nfs4.1/nfs4client.py b/nfs4.1/nfs4client.py index 708850d..135981d 100644 --- a/nfs4.1/nfs4client.py +++ b/nfs4.1/nfs4client.py @@ -611,7 +611,7 @@ sha256 = '`\x86H\x01e\x03\x04\x02\x01' binding_opts = conn_binding4args(True, ["gibberish", sha256]) fore_attrs = channel_attrs4(4096,4096,4096,128,8,[]) cb_sec= callback_sec_parms4(0) -C.compound([C.create_session_op(0,1,0L,0,binding_opts, fore_attrs, fore_attrs,123,[cb_sec])]) +C.compound([C.create_session_op(0,1,0,0,binding_opts, fore_attrs, fore_attrs,123,[cb_sec])]) """ """ SEQUENCE diff --git a/nfs4.1/nfs4lib.py b/nfs4.1/nfs4lib.py index 96752c2..20eae0f 100644 --- a/nfs4.1/nfs4lib.py +++ b/nfs4.1/nfs4lib.py @@ -194,7 +194,7 @@ class FancyNFS4Packer(NFS4Packer): def filter_bitmap4(self, data): out = [] while data: - out.append(data & 0xffffffffL) + out.append(data & 0xffffffff) data >>= 32 return out @@ -217,7 +217,7 @@ class FancyNFS4Packer(NFS4Packer): class FancyNFS4Unpacker(NFS4Unpacker): def filter_bitmap4(self, data): """Put bitmap into single long, instead of array of 32bit chunks""" - out = 0L + out = 0 shift = 0 for i in data: out |= (long(i) << shift) @@ -276,9 +276,9 @@ def fattr2dict(obj): def list2bitmap(list): """Construct a bitmap from a list of bit numbers""" - mask = 0L + mask = 0 for bit in list: - mask |= 1L << bit + mask |= 1 << bit return mask def bitmap2list(bitmap): @@ -565,7 +565,7 @@ def attr_name(bitnum): return bitnum2attr.get(bitnum, "unknown_%r" % bitnum) class NFS4Error(Exception): - def __init__(self, status, attrs=0L, lock_denied=None, tag=None, check_msg=None): + def __init__(self, status, attrs=0, lock_denied=None, tag=None, check_msg=None): self.status = status self.name = xdrdef.nfs4_const.nfsstat4[status] if check_msg is None: diff --git a/nfs4.1/nfs4server.py b/nfs4.1/nfs4server.py index f8bd251..cd78082 100755 --- a/nfs4.1/nfs4server.py +++ b/nfs4.1/nfs4server.py @@ -212,7 +212,7 @@ class ClientList(object): def __init__(self): self._data = {} self.lock = Lock("ClientList") - self._nextid = 0L + self._nextid = 0 def __getitem__(self, key): return self._data.get(key) @@ -1381,7 +1381,7 @@ class NFS4Server(rpc.Server): def open_claim_null(self, arg, env): """Simulated switch function from op_open that handles CLAIM_NULL""" - bitmask = 0L + bitmask = 0 # cfh holds dir, claim.file holds name if not env.cfh.isdir: raise NFS4Error(NFS4ERR_NOTDIR) diff --git a/nfs4.1/server41tests/environment.py b/nfs4.1/server41tests/environment.py index 1a837ee..823dfe3 100644 --- a/nfs4.1/server41tests/environment.py +++ b/nfs4.1/server41tests/environment.py @@ -139,7 +139,7 @@ class Environment(testmod.Environment): self.filedata = "This is the file test data." self.linkdata = "/etc/X11" self.stateid0 = stateid4(0, '') - self.stateid1 = stateid4(0xffffffffL, '\xff'*12) + self.stateid1 = stateid4(0xffffffff, '\xff'*12) log.info("Created client to %s, %i" % (opts.server, opts.port)) @@ -429,7 +429,7 @@ def clean_dir(sess, path): res = sess.compound(ops) check(res, msg="Trying to remove %s" % repr(e.name)) -def do_readdir(sess, file, cookie=0, cookieverf='', attrs=0L, +def do_readdir(sess, file, cookie=0, cookieverf='', attrs=0, dircount=4096, maxcount=4096): # Since we may not get whole directory listing in one readdir request, # loop until we do. For each request result, create a flat list diff --git a/nfs4.1/server41tests/st_debug.py b/nfs4.1/server41tests/st_debug.py index e34d03f..345fc77 100644 --- a/nfs4.1/server41tests/st_debug.py +++ b/nfs4.1/server41tests/st_debug.py @@ -89,7 +89,7 @@ def testDeadlock(t, env): def ops(i): return [op.putfh(fh), op.write(stateid, i*1000, UNSTABLE4, chr(97+i)*100), - op.getattr(42950721818L) + op.getattr(42950721818) ] xids = [sess1.compound_async(ops(i), slot=i) for i in range(4)] for xid in xids: diff --git a/nfs4.1/testmod.py b/nfs4.1/testmod.py index 8108a23..21e9915 100644 --- a/nfs4.1/testmod.py +++ b/nfs4.1/testmod.py @@ -374,7 +374,7 @@ def createtests(testdir): # Reduce doc string info into format easier to work with used_codes = {} flag_dict = {} - bit = 1L + bit = 1 for t in tests: ## if not t.flags_list: ## raise RuntimeError("%s has no flags" % t.fullname) diff --git a/rpc/rpc.py b/rpc/rpc.py index 834fedd..af2b325 100644 --- a/rpc/rpc.py +++ b/rpc/rpc.py @@ -265,8 +265,8 @@ class Pipe(object): # We don't even have the packet length yet, wait for more data break packetlen = struct.unpack('>L', buf[0:4])[0] - last = 0x80000000L & packetlen - packetlen &= 0x7fffffffL + last = 0x80000000 & packetlen + packetlen &= 0x7fffffff packetlen += 4 # Include size of record mark if len(buf) < packetlen: # We don't have a full packet yet, wait for more data @@ -310,7 +310,7 @@ class Pipe(object): chunk = record[i: i + count] i += count if i >= dlen: - last = 0x80000000L + last = 0x80000000 mark = struct.pack('>L', last | len(chunk)) out += mark + chunk return out @@ -351,7 +351,7 @@ class RpcPipe(Pipe): Pipe.__init__(self, *args, **kwargs) self._pending = {} # {xid:defer} self._lock = threading.Lock() # Protects fields below - self._xid = random.randint(0, 0x7fffffffL) + self._xid = random.randint(0, 0x7fffffff) self.set_active() def _get_xid(self): From patchwork Tue Jul 24 07:33:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jianhong Yin X-Patchwork-Id: 10541403 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A5C4517FD for ; Tue, 24 Jul 2018 07:34:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8442B28759 for ; Tue, 24 Jul 2018 07:34:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 78B8428760; Tue, 24 Jul 2018 07:34:06 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A095328759 for ; Tue, 24 Jul 2018 07:34:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388407AbeGXIjK (ORCPT ); Tue, 24 Jul 2018 04:39:10 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:52728 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2388406AbeGXIjK (ORCPT ); Tue, 24 Jul 2018 04:39:10 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 47268805A530; Tue, 24 Jul 2018 07:34:01 +0000 (UTC) Received: from dhcp-12-115.nay.redhat.com (unknown [10.66.12.115]) by smtp.corp.redhat.com (Postfix) with ESMTP id AF5E3178B3; Tue, 24 Jul 2018 07:33:59 +0000 (UTC) From: jiyin@redhat.com To: bfields@redhat.com Cc: linux-nfs@vger.kernel.org, "Jianhong.Yin" Subject: [PATCH 06/24] pynfs: python3 support plan: octal literal 0644 -> 0o644 Date: Tue, 24 Jul 2018 15:33:24 +0800 Message-Id: <20180724073342.5738-6-jiyin@redhat.com> In-Reply-To: <20180724073342.5738-1-jiyin@redhat.com> References: <20180724073342.5738-1-jiyin@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Tue, 24 Jul 2018 07:34:01 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Tue, 24 Jul 2018 07:34:01 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'jiyin@redhat.com' RCPT:'' Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: "Jianhong.Yin" s/\<0([0-9]{3})\>/0o\1/g s/\<0([0-9]{2})\>/0o\1/g Signed-off-by: Jianhong Yin --- nfs4.0/nfs4acl.py | 8 ++++---- nfs4.0/nfs4lib.py | 10 +++++----- nfs4.0/nfs4state.py | 4 ++-- nfs4.0/servertests/st_close.py | 4 ++-- nfs4.0/servertests/st_create.py | 2 +- nfs4.0/servertests/st_delegation.py | 2 +- nfs4.0/servertests/st_lock.py | 2 +- nfs4.0/servertests/st_locku.py | 2 +- nfs4.0/servertests/st_lookup.py | 10 +++++----- nfs4.0/servertests/st_open.py | 18 +++++++++--------- nfs4.0/servertests/st_read.py | 4 ++-- nfs4.0/servertests/st_readdir.py | 8 ++++---- nfs4.0/servertests/st_reboot.py | 4 ++-- nfs4.0/servertests/st_setattr.py | 18 +++++++++--------- nfs4.0/servertests/st_write.py | 16 ++++++++-------- nfs4.1/client41tests/environment.py | 8 ++++---- nfs4.1/dataserver.py | 6 +++--- nfs4.1/fs.py | 2 +- nfs4.1/nfs4client.py | 2 +- nfs4.1/server41tests/environment.py | 14 +++++++------- nfs4.1/server41tests/st_lookup.py | 4 ++-- 21 files changed, 74 insertions(+), 74 deletions(-) diff --git a/nfs4.0/nfs4acl.py b/nfs4.0/nfs4acl.py index 91a0316..b7f033e 100644 --- a/nfs4.0/nfs4acl.py +++ b/nfs4.0/nfs4acl.py @@ -66,9 +66,9 @@ def mode2acl(mode, dir=False): """Translate a 3-digit octal mode into a posix compatible acl""" if dir: modes = DMODES else: modes = MODES - owner = modes[(mode & 0700)//0100] | FLAG_ALL | FLAG_OWN - group = modes[(mode & 0070)//010] | FLAG_ALL - other = modes[(mode & 0007)] | FLAG_ALL + owner = modes[(mode & 0o700)//0o100] | FLAG_ALL | FLAG_OWN + group = modes[(mode & 0o070)//0o10] | FLAG_ALL + other = modes[(mode & 0o007)] | FLAG_ALL return [ nfsace4(ALLOWED, 0, owner, "OWNER@"), nfsace4(DENIED, 0, negate(owner), "OWNER@"), @@ -102,7 +102,7 @@ def acl2mode(acl): for key in perms: if perms[key] is None: perm[keys] = 0 - return perms["OWNER@"]*0100 + perms["GROUP@"]*010 + perms["EVERYONE@"] + return perms["OWNER@"]*0o100 + perms["GROUP@"]*0o10 + perms["EVERYONE@"] def maps_to_posix(acl): """Raises ACLError if acl does not map to posix """ diff --git a/nfs4.0/nfs4lib.py b/nfs4.0/nfs4lib.py index d255eb7..5c9e853 100644 --- a/nfs4.0/nfs4lib.py +++ b/nfs4.0/nfs4lib.py @@ -463,7 +463,7 @@ class NFS4Client(rpc.RPCClient): return self.compound(ops) def open(self, owner, name=None, type=OPEN4_NOCREATE, - mode=UNCHECKED4, attrs={FATTR4_MODE:0644}, verf=None, + mode=UNCHECKED4, attrs={FATTR4_MODE:0o644}, verf=None, access=OPEN4_SHARE_ACCESS_READ, deny=OPEN4_SHARE_DENY_WRITE, claim_type=CLAIM_NULL, deleg_type=None, deleg_cur_info=None): @@ -568,7 +568,7 @@ class NFS4Client(rpc.RPCClient): for e in entries: # We separate setattr and remove to avoid an inode locking bug ops = [op4.putfh(fh), op4.lookup(e.name)] - ops += [op4.setattr(stateid, {FATTR4_MODE:0755})] + ops += [op4.setattr(stateid, {FATTR4_MODE:0o755})] res = self.compound(ops) check_result(res, "Making sure %s is writable" % repr(e.name)) ops = [op4.putfh(fh), op4.remove(e.name)] @@ -589,7 +589,7 @@ class NFS4Client(rpc.RPCClient): d = self.do_getattrdict([], [FATTR4_LEASE_TIME]) return d[FATTR4_LEASE_TIME] - def create_obj(self, path, type=NF4DIR, attrs={FATTR4_MODE:0755}, + def create_obj(self, path, type=NF4DIR, attrs={FATTR4_MODE:0o755}, linkdata="/etc/X11"): if __builtins__['type'](path) is str: path = self.homedir + [path] @@ -613,7 +613,7 @@ class NFS4Client(rpc.RPCClient): ops += [op4.rename(oldpath[-1], newpath[-1])] return self.compound(ops) - def create_file(self, owner, path=None, attrs={FATTR4_MODE: 0644}, + def create_file(self, owner, path=None, attrs={FATTR4_MODE: 0o644}, access=OPEN4_SHARE_ACCESS_BOTH, deny=OPEN4_SHARE_DENY_WRITE, mode=UNCHECKED4, verifier=None, @@ -702,7 +702,7 @@ class NFS4Client(rpc.RPCClient): return (fhandle, stateid) - def create_confirm(self, owner, path=None, attrs={FATTR4_MODE: 0644}, + def create_confirm(self, owner, path=None, attrs={FATTR4_MODE: 0o644}, access=OPEN4_SHARE_ACCESS_BOTH, deny=OPEN4_SHARE_DENY_WRITE, mode=GUARDED4): diff --git a/nfs4.0/nfs4state.py b/nfs4.0/nfs4state.py index 484a284..180e642 100755 --- a/nfs4.0/nfs4state.py +++ b/nfs4.0/nfs4state.py @@ -953,7 +953,7 @@ class VirtualHandle(NFSFileHandle): if self.fattr4_type == NF4DIR: self.dirent = DirList() - self.fattr4_mode = 0755 + self.fattr4_mode = 0o755 if self.fattr4_type == NF4REG: self.file = StringIO.StringIO() self.state = NFSFileState() @@ -987,7 +987,7 @@ class VirtualHandle(NFSFileHandle): self.fattr4_maxname = 128 # Are these enforced? self.fattr4_maxread = 1000 # Are these enforced? self.fattr4_maxwrite = 1000 # Are these enforced? - self.fattr4_mode = 0644 # Currently no access restrictions enforced + self.fattr4_mode = 0o644 # Currently no access restrictions enforced self.fattr4_acl = nfs4acl.mode2acl(self.fattr4_mode, self.fattr4_type == NF4DIR) self.fattr4_numlinks = 1 # Updated? - Yes diff --git a/nfs4.0/servertests/st_close.py b/nfs4.0/servertests/st_close.py index 1690fad..89ccbba 100644 --- a/nfs4.0/servertests/st_close.py +++ b/nfs4.0/servertests/st_close.py @@ -110,7 +110,7 @@ def testTimedoutClose1(t, env): sleeptime = c.getLeaseTime() * 2 c.init_connection() fh, stateid = c.create_confirm(t.code, deny=OPEN4_SHARE_DENY_WRITE, - attrs={FATTR4_MODE: 0666}) + attrs={FATTR4_MODE: 0o666}) env.sleep(sleeptime) # Conflicting open should force server to drop state c2 = env.c2 @@ -132,7 +132,7 @@ def testTimedoutClose2(t, env): sleeptime = c.getLeaseTime() * 2 c.init_connection() fh, stateid = c.create_confirm(t.code, deny=OPEN4_SHARE_DENY_WRITE, - attrs={FATTR4_MODE: 0666}) + attrs={FATTR4_MODE: 0o666}) res = c.lock_file(t.code, fh, stateid) check(res) env.sleep(sleeptime) diff --git a/nfs4.0/servertests/st_create.py b/nfs4.0/servertests/st_create.py index ac57aaf..c7256e5 100644 --- a/nfs4.0/servertests/st_create.py +++ b/nfs4.0/servertests/st_create.py @@ -8,7 +8,7 @@ def getDefaultAttr(c): attr = {} #attr[FATTR4_OWNER] = c.security.get_owner() #attr[FATTR4_OWNER_GROUP] = c.security.get_group() - attr[FATTR4_MODE] = 0755 + attr[FATTR4_MODE] = 0o755 return attr def _test_create(t, env, type, name, **keywords): diff --git a/nfs4.0/servertests/st_delegation.py b/nfs4.0/servertests/st_delegation.py index 8e0d891..937d95f 100644 --- a/nfs4.0/servertests/st_delegation.py +++ b/nfs4.0/servertests/st_delegation.py @@ -706,7 +706,7 @@ def testServerChmod(t, env): c.init_connection('pynfs%i_%s' % (os.getpid(), t.code), cb_ident=0) c.create_confirm(t.code, path=c.homedir + [t.code + '-2']) _get_deleg(t, c, c.homedir + [t.code], _recall, NFS4_OK) - env.serverhelper("chmod 0777 " + _listToPath(c.homedir + [t.code])) + env.serverhelper("chmod 0o777 " + _listToPath(c.homedir + [t.code])) _verify_cb_occurred(t, c, count) def testServerSelfConflict(t, env): diff --git a/nfs4.0/servertests/st_lock.py b/nfs4.0/servertests/st_lock.py index 1cdbea3..060236a 100644 --- a/nfs4.0/servertests/st_lock.py +++ b/nfs4.0/servertests/st_lock.py @@ -529,7 +529,7 @@ def testReadLocks2(t, env): file = c1.homedir + [t.code] # Client1 creates a file fh1, stateid1 = c1.create_confirm('owner1', file, - attrs={FATTR4_MODE: 0666}, + attrs={FATTR4_MODE: 0o666}, access=OPEN4_SHARE_ACCESS_BOTH, deny=OPEN4_SHARE_DENY_NONE) # Client2 opens the file diff --git a/nfs4.0/servertests/st_locku.py b/nfs4.0/servertests/st_locku.py index 3006445..74b464a 100644 --- a/nfs4.0/servertests/st_locku.py +++ b/nfs4.0/servertests/st_locku.py @@ -256,7 +256,7 @@ def testTimedoutUnlock(t, env): c = env.c1 sleeptime = c.getLeaseTime() * 3 // 2 c.init_connection() - fh, stateid = c.create_confirm(t.code, attrs={FATTR4_MODE: 0666}) + fh, stateid = c.create_confirm(t.code, attrs={FATTR4_MODE: 0o666}) res1 = c.lock_file(t.code, fh, stateid) check(res1) env.sleep(sleeptime) diff --git a/nfs4.0/servertests/st_lookup.py b/nfs4.0/servertests/st_lookup.py index cd1b93c..a57d4cb 100644 --- a/nfs4.0/servertests/st_lookup.py +++ b/nfs4.0/servertests/st_lookup.py @@ -206,7 +206,7 @@ def testNonAccessable(t, env): DEPEND: MKDIR CODE: LOOK6 """ - # Create dir/foo, and set mode of dir to 000 + # Create dir/foo, and set mode of dir to 0o000 c = env.c1 dir = c.homedir + [t.code] res = c.create_obj(dir) @@ -220,9 +220,9 @@ def testNonAccessable(t, env): check(res) res = c.compound(c.use_obj(dir + ['foo'])) if env.opts.uid == 0: - check(res, [NFS4_OK, NFS4ERR_ACCESS], "LOOKUP object in a dir with mode=000") + check(res, [NFS4_OK, NFS4ERR_ACCESS], "LOOKUP object in a dir with mode=0o000") else: - check(res, NFS4ERR_ACCESS, "LOOKUP object in a dir with mode=000") + check(res, NFS4ERR_ACCESS, "LOOKUP object in a dir with mode=0o000") def testInvalidUtf8(t, env): """LOOKUP with bad UTF-8 name strings should return NFS4ERR_INVAL @@ -283,9 +283,9 @@ def testUnaccessibleDir(t, env): check(res, msg="Setting mode=0 on directory %s" % t.code) res = c.compound(c.use_obj(path + ['hidden'])) if env.opts.uid == 0: - check(res, [NFS4_OK, NFS4ERR_ACCESS], "LOOKUP off of dir with mode=000") + check(res, [NFS4_OK, NFS4ERR_ACCESS], "LOOKUP off of dir with mode=0o000") else: - check(res, NFS4ERR_ACCESS, "LOOKUP off of dir with mode=000") + check(res, NFS4ERR_ACCESS, "LOOKUP off of dir with mode=0o000") def testBadOpaque(t, env): """LOOKUP with a path component that has an incorrect array length diff --git a/nfs4.0/servertests/st_open.py b/nfs4.0/servertests/st_open.py index 437fb67..12db5df 100644 --- a/nfs4.0/servertests/st_open.py +++ b/nfs4.0/servertests/st_open.py @@ -25,7 +25,7 @@ def testCreateUncheckedFile(t, env): c.init_connection() # Create the file - orig_attrs = { FATTR4_MODE: 0644, FATTR4_SIZE: 32 } + orig_attrs = { FATTR4_MODE: 0o644, FATTR4_SIZE: 32 } res = c.create_file(t.code, attrs=orig_attrs, deny=OPEN4_SHARE_DENY_NONE) check(res, msg="Trying to create file %s" % t.code) fh, stateid = c.confirm(t.code, res) @@ -33,7 +33,7 @@ def testCreateUncheckedFile(t, env): checkdict(orig_attrs, rcvd_attrs, get_bitnumattr_dict(), "Checking attrs on creation") # Create the file again...it should ignore attrs - attrs = { FATTR4_MODE: 0600, FATTR4_SIZE: 16 } + attrs = { FATTR4_MODE: 0o600, FATTR4_SIZE: 16 } res = c.create_file(t.code, attrs=attrs, deny=OPEN4_SHARE_DENY_NONE) check(res, msg="Trying to recreate file %s" % t.code) fh, stateid = c.confirm(t.code, res) @@ -41,12 +41,12 @@ def testCreateUncheckedFile(t, env): checkdict(orig_attrs, rcvd_attrs, get_bitnumattr_dict(), "Attrs on recreate should be ignored") # Create the file again, should truncate size to 0 and ignore other attrs - attrs = { FATTR4_MODE: 0600, FATTR4_SIZE: 0 } + attrs = { FATTR4_MODE: 0o600, FATTR4_SIZE: 0 } res = c.create_file(t.code, attrs=attrs, deny=OPEN4_SHARE_DENY_NONE) check(res, msg="Trying to truncate file %s" % t.code) fh, stateid = c.confirm(t.code, res) rcvd_attrs = c.do_getattrdict(fh, orig_attrs.keys()) - expect = { FATTR4_MODE: 0644, FATTR4_SIZE: 0 } + expect = { FATTR4_MODE: 0o644, FATTR4_SIZE: 0 } checkdict(expect, rcvd_attrs, get_bitnumattr_dict(), "Attrs on recreate should be ignored, except for size") @@ -327,13 +327,13 @@ def testModeChange(t, env): check(res) ops = c.use_obj(fh) + [c.setattr({FATTR4_MODE:0})] res = c.compound(ops) - check(res, msg="Setting mode of file %s to 000" % t.code) + check(res, msg="Setting mode of file %s to 0o000" % t.code) res = c.open_file(t.code, access=OPEN4_SHARE_ACCESS_BOTH, deny=OPEN4_SHARE_DENY_NONE) if env.opts.uid == 0: - check(res, [NFS4_OK, NFS4ERR_ACCESS], "Opening file %s with mode=000" % t.code) + check(res, [NFS4_OK, NFS4ERR_ACCESS], "Opening file %s with mode=0o000" % t.code) else: - check(res, NFS4ERR_ACCESS, "Opening file %s with mode=000" % t.code) + check(res, NFS4ERR_ACCESS, "Opening file %s with mode=0o000" % t.code) def testShareConflict1(t, env): """OPEN conflicting with previous share @@ -361,13 +361,13 @@ def testFailedOpen(t, env): c1.init_connection() # Client 1: create a file and deny others access fh, stateid = c1.create_confirm(t.code) - ops = c1.use_obj(fh) + [c1.setattr({FATTR4_MODE: 0700})] + ops = c1.use_obj(fh) + [c1.setattr({FATTR4_MODE: 0o700})] check(c1.compound(ops)) # Client 2: try to open the file c2 = env.c2 c2.init_connection() res = c2.open_file(t.code) - check(res, NFS4ERR_ACCESS, "Opening file with mode 0700 as 'other'") + check(res, NFS4ERR_ACCESS, "Opening file with mode 0o700 as 'other'") # Client 1: try to use fh, stateid res1 = c1.lock_file(t.code, fh, stateid) check(res1, msg="Locking file after another client had a failed open") diff --git a/nfs4.0/servertests/st_read.py b/nfs4.0/servertests/st_read.py index 9b2203b..15f8795 100644 --- a/nfs4.0/servertests/st_read.py +++ b/nfs4.0/servertests/st_read.py @@ -74,7 +74,7 @@ def testLargeCount(t, env): c = env.c1 c.init_connection() fh, stateid = c.create_confirm(t.code, attrs={FATTR4_SIZE: 10000000, - FATTR4_MODE: 0644}) + FATTR4_MODE: 0o644}) res = c.read_file(fh, 0, 9000000, stateid) check(res, msg="Reading file %s" % t.code) _compare(t, res, '\x00'*9000000, False) @@ -234,7 +234,7 @@ def testStolenStateid(t, env): """ c = env.c1 c.init_connection() - res = c.create_file(t.code, attrs={FATTR4_MODE: 0600}) + res = c.create_file(t.code, attrs={FATTR4_MODE: 0o600}) fh, stateid = c.confirm(t.code, res) security=c.security c.security=rpc.SecAuthSys(0, "whatever", 3912, 2422, []) diff --git a/nfs4.0/servertests/st_readdir.py b/nfs4.0/servertests/st_readdir.py index 5a70145..fb484b6 100644 --- a/nfs4.0/servertests/st_readdir.py +++ b/nfs4.0/servertests/st_readdir.py @@ -232,9 +232,9 @@ def testUnaccessibleDir(t, env): ops = c.use_obj(path) + [c.readdir()] res = c.compound(ops) if env.opts.uid == 0: - check(res, [NFS4_OK, NFS4ERR_ACCESS], "READDIR of directory with mode=000") + check(res, [NFS4_OK, NFS4ERR_ACCESS], "READDIR of directory with mode=0o000") else: - check(res, NFS4ERR_ACCESS, "READDIR of directory with mode=000") + check(res, NFS4ERR_ACCESS, "READDIR of directory with mode=0o000") def testUnaccessibleDirAttrs(t, env): """READDIR with (cfh) in unaccessible directory requesting attrs @@ -253,9 +253,9 @@ def testUnaccessibleDirAttrs(t, env): [c.readdir(attr_request=[FATTR4_RDATTR_ERROR, FATTR4_TYPE])] res = c.compound(ops) if env.opts.uid == 0: - check(res, [NFS4_OK, NFS4ERR_ACCESS], "READDIR of directory with mode=000") + check(res, [NFS4_OK, NFS4ERR_ACCESS], "READDIR of directory with mode=0o000") else: - check(res, NFS4ERR_ACCESS, "READDIR of directory with mode=000") + check(res, NFS4ERR_ACCESS, "READDIR of directory with mode=0o000") ########################################### diff --git a/nfs4.0/servertests/st_reboot.py b/nfs4.0/servertests/st_reboot.py index 33c3a4a..16cb008 100644 --- a/nfs4.0/servertests/st_reboot.py +++ b/nfs4.0/servertests/st_reboot.py @@ -116,7 +116,7 @@ def testEdge1(t, env): c1 = env.c1 c1.init_connection() # Client 1: lock file - fh1, stateid1 = c1.create_confirm(t.code, attrs={FATTR4_MODE:0666}, + fh1, stateid1 = c1.create_confirm(t.code, attrs={FATTR4_MODE:0o666}, access=OPEN4_SHARE_ACCESS_BOTH, deny=OPEN4_SHARE_DENY_NONE) res1 = c1.lock_file(t.code, fh1, stateid1) @@ -161,7 +161,7 @@ def testEdge2(t, env): c1 = env.c1 c1.init_connection() # Client 1: lock file - fh1, stateid1 = c1.create_confirm(t.code, attrs={FATTR4_MODE:0666}, + fh1, stateid1 = c1.create_confirm(t.code, attrs={FATTR4_MODE:0o666}, access=OPEN4_SHARE_ACCESS_BOTH, deny=OPEN4_SHARE_DENY_NONE) res1 = c1.lock_file(t.code, fh1, stateid1) diff --git a/nfs4.0/servertests/st_setattr.py b/nfs4.0/servertests/st_setattr.py index 4a80f65..aa7123b 100644 --- a/nfs4.0/servertests/st_setattr.py +++ b/nfs4.0/servertests/st_setattr.py @@ -7,7 +7,7 @@ op = nfs_ops.NFS4ops() def _set_mode(t, c, file, stateid=None, msg=" using stateid=0", warnlist=[]): - mode = 0740 + mode = 0o740 dict = {FATTR4_MODE: mode} ops = c.use_obj(file) + [c.setattr(dict, stateid)] res = c.compound(ops) @@ -399,7 +399,7 @@ def testInvalidAttr1(t, env): path = c.homedir + [t.code] res = c.create_obj(path) check(res) - badattr = dict2fattr({FATTR4_MODE: 0644}) + badattr = dict2fattr({FATTR4_MODE: 0o644}) badattr.attr_vals = '' res = c.compound(c.use_obj(path) + [op.setattr(env.stateid0, badattr)]) check(res, NFS4ERR_BADXDR, "SETATTR(FATTR4_MODE) with no data") @@ -418,7 +418,7 @@ def testInvalidAttr2(t, env): path = c.homedir + [t.code] res = c.create_obj(path) check(res) - badattr = dict2fattr({FATTR4_MODE: 0644}) + badattr = dict2fattr({FATTR4_MODE: 0o644}) badattr.attr_vals += 'Garbage data' res = c.compound(c.use_obj(path) + [op.setattr(env.stateid0, badattr)]) check(res, NFS4ERR_BADXDR, @@ -674,7 +674,7 @@ def testInodeLocking(t, env): # In a single compound statement, setattr on dir and then # do a state operation on a file in dir (like write or remove) - ops = c.use_obj(basedir) + [c.setattr({FATTR4_MODE:0754})] + ops = c.use_obj(basedir) + [c.setattr({FATTR4_MODE:0o754})] ops += [op.lookup('file'), op.write(stateid, 0, 0, 'blahblah')] res = c.compound(ops) check(res, msg="SETATTR on dir and state operation on file in dir") @@ -690,7 +690,7 @@ def testChange(t, env): c.init_connection() fh, stateid = c.create_confirm(t.code) change = c.do_getattr(FATTR4_CHANGE, fh) - ops = c.use_obj(fh) + [c.setattr({FATTR4_MODE: 0740})] + ops = c.use_obj(fh) + [c.setattr({FATTR4_MODE: 0o740})] res = c.compound(ops) check(res) change2 = c.do_getattr(FATTR4_CHANGE, fh) @@ -708,10 +708,10 @@ def testChangeGranularity(t, env): c.init_connection() fh, stateid = c.create_confirm(t.code) ops = c.use_obj(fh) + [c.getattr([FATTR4_CHANGE])] \ - + [c.setattr({FATTR4_MODE: 0740})] + [c.getattr([FATTR4_CHANGE])] \ - + [c.setattr({FATTR4_MODE: 0741})] + [c.getattr([FATTR4_CHANGE])] \ - + [c.setattr({FATTR4_MODE: 0742})] + [c.getattr([FATTR4_CHANGE])] \ - + [c.setattr({FATTR4_MODE: 0743})] + [c.getattr([FATTR4_CHANGE])] + + [c.setattr({FATTR4_MODE: 0o740})] + [c.getattr([FATTR4_CHANGE])] \ + + [c.setattr({FATTR4_MODE: 0o741})] + [c.getattr([FATTR4_CHANGE])] \ + + [c.setattr({FATTR4_MODE: 0o742})] + [c.getattr([FATTR4_CHANGE])] \ + + [c.setattr({FATTR4_MODE: 0o743})] + [c.getattr([FATTR4_CHANGE])] res = c.compound(ops) check(res) chattr1 = res.resarray[1].obj_attributes diff --git a/nfs4.0/servertests/st_write.py b/nfs4.0/servertests/st_write.py index 2f73cbb..4777e1b 100644 --- a/nfs4.0/servertests/st_write.py +++ b/nfs4.0/servertests/st_write.py @@ -38,7 +38,7 @@ def testSimpleWrite(t, env): """ c = env.c1 c.init_connection() - attrs = {FATTR4_SIZE: 32, FATTR4_MODE: 0644} + attrs = {FATTR4_SIZE: 32, FATTR4_MODE: 0o644} fh, stateid = c.create_confirm(t.code, attrs=attrs, deny=OPEN4_SHARE_DENY_NONE) res = c.write_file(fh, _text, how=UNSTABLE4) @@ -55,7 +55,7 @@ def testSimpleWrite2(t, env): """ c = env.c1 c.init_connection() - attrs = {FATTR4_SIZE: 32, FATTR4_MODE: 0644} + attrs = {FATTR4_SIZE: 32, FATTR4_MODE: 0o644} fh, stateid = c.create_confirm(t.code, attrs=attrs, deny=OPEN4_SHARE_DENY_NONE) res = c.write_file(fh, _text, 30) @@ -72,7 +72,7 @@ def testStateidOne(t, env): """ c = env.c1 c.init_connection() - attrs = {FATTR4_SIZE: 32, FATTR4_MODE: 0644} + attrs = {FATTR4_SIZE: 32, FATTR4_MODE: 0o644} fh, stateid = c.create_confirm(t.code, attrs=attrs, deny=OPEN4_SHARE_DENY_NONE) res = c.write_file(fh, _text, 5, env.stateid1, DATA_SYNC4) @@ -91,7 +91,7 @@ def testWithOpen(t, env): """ c = env.c1 c.init_connection() - attrs = {FATTR4_SIZE: 32, FATTR4_MODE: 0644} + attrs = {FATTR4_SIZE: 32, FATTR4_MODE: 0o644} fh, stateid = c.create_confirm(t.code, attrs=attrs) res = c.write_file(fh, _text, 50, stateid, FILE_SYNC4) check(res, msg="WRITE with openstateid and FILE_SYNC4") @@ -109,7 +109,7 @@ def testNoData(t, env): """ c = env.c1 c.init_connection() - attrs = {FATTR4_SIZE: 32, FATTR4_MODE: 0644} + attrs = {FATTR4_SIZE: 32, FATTR4_MODE: 0o644} fh, stateid = c.create_confirm(t.code, attrs=attrs) time_prior = c.do_getattr(FATTR4_TIME_MODIFY, fh) env.sleep(1) @@ -281,7 +281,7 @@ def testOpenMode(t, env): """ c = env.c1 c.init_connection() - attrs = {FATTR4_SIZE: 32, FATTR4_MODE: 0644} + attrs = {FATTR4_SIZE: 32, FATTR4_MODE: 0o644} fh, stateid = c.create_confirm(t.code, attrs=attrs, access=OPEN4_SHARE_ACCESS_READ) res = c.write_file(fh, _text, 0, stateid) @@ -298,7 +298,7 @@ def testShareDeny(t, env): """ c = env.c1 c.init_connection() - attrs = {FATTR4_SIZE: 32, FATTR4_MODE: 0644} + attrs = {FATTR4_SIZE: 32, FATTR4_MODE: 0o644} fh, stateid = c.create_confirm(t.code, attrs=attrs, deny=OPEN4_SHARE_DENY_WRITE) res = c.write_file(fh, _text) @@ -520,7 +520,7 @@ def testStolenStateid(t, env): """ c = env.c1 c.init_connection() - res = c.create_file(t.code, attrs={FATTR4_MODE: 0600}) + res = c.create_file(t.code, attrs={FATTR4_MODE: 0o600}) fh, stateid = c.confirm(t.code, res) security=c.security c.security=rpc.SecAuthSys(0, "whatever", 3912, 2422, []) diff --git a/nfs4.1/client41tests/environment.py b/nfs4.1/client41tests/environment.py index 7c7bb0c..933264c 100644 --- a/nfs4.1/client41tests/environment.py +++ b/nfs4.1/client41tests/environment.py @@ -362,7 +362,7 @@ def clean_dir(sess, path): for e in entries: # We separate setattr and remove to avoid an inode locking bug ops = use_obj(path + [e.name]) - ops += [op.setattr(stateid, {FATTR4_MODE:0755})] + ops += [op.setattr(stateid, {FATTR4_MODE:0o755})] res = sess.compound(ops) check(res, msg="Setting mode on %s" % repr(e.name)) ops = use_obj(path) @@ -405,7 +405,7 @@ def use_obj(file): else: return [op.putrootfh()] + [op.lookup(comp) for comp in file] -def create_obj(sess, path, kind=NF4DIR, attrs={FATTR4_MODE:0755}): +def create_obj(sess, path, kind=NF4DIR, attrs={FATTR4_MODE:0o755}): """Return ops needed to create given non-file object""" # Ensure using createtype4 if not hasattr(kind, "type"): @@ -413,7 +413,7 @@ def create_obj(sess, path, kind=NF4DIR, attrs={FATTR4_MODE:0755}): ops = use_obj(path[:-1]) + [op.create(kind, path[-1], attrs)] return sess.compound(ops) -def create_file(sess, owner, path=None, attrs={FATTR4_MODE: 0644}, +def create_file(sess, owner, path=None, attrs={FATTR4_MODE: 0o644}, access=OPEN4_SHARE_ACCESS_BOTH, deny=OPEN4_SHARE_DENY_NONE, mode=GUARDED4, verifier=None, want_deleg=False): @@ -434,7 +434,7 @@ def create_file(sess, owner, path=None, attrs={FATTR4_MODE: 0644}, open_claim4(CLAIM_NULL, name)) return sess.compound(use_obj(dir) + [open_op, op.getfh()]) -def create_confirm(sess, owner, path=None, attrs={FATTR4_MODE: 0644}, +def create_confirm(sess, owner, path=None, attrs={FATTR4_MODE: 0o644}, access=OPEN4_SHARE_ACCESS_BOTH, deny=OPEN4_SHARE_DENY_NONE, mode=GUARDED4): diff --git a/nfs4.1/dataserver.py b/nfs4.1/dataserver.py index 80179f8..af0e35a 100644 --- a/nfs4.1/dataserver.py +++ b/nfs4.1/dataserver.py @@ -130,7 +130,7 @@ class DataServer41(DataServer): self.sess.compound([op4.reclaim_complete(const4.FALSE)]) def make_root(self): - attrs = {const4.FATTR4_MODE:0777} + attrs = {const4.FATTR4_MODE:0o777} existing_path = [] kind = type4.createtype4(const4.NF4DIR) for comp in self.path: @@ -153,7 +153,7 @@ class DataServer41(DataServer): seqid=0 access = const4.OPEN4_SHARE_ACCESS_BOTH deny = const4.OPEN4_SHARE_DENY_NONE - attrs = {const4.FATTR4_MODE: 0777} + attrs = {const4.FATTR4_MODE: 0o777} owner = "mds" mode = const4.GUARDED4 verifier = self.sess.c.verifier @@ -257,7 +257,7 @@ class DataServer3(DataServer): def open_file(self, mds_fh): name = self.fh_to_name(mds_fh) where = type3.diropargs3(self.rootfh, name) - attr = type3.sattr3(mode=type3.set_mode3(True, 0777), + attr = type3.sattr3(mode=type3.set_mode3(True, 0o777), uid=type3.set_uid3(True, 0), gid=type3.set_gid3(True, 0), size=type3.set_size3(False), diff --git a/nfs4.1/fs.py b/nfs4.1/fs.py index b0b06d5..e2c7eca 100644 --- a/nfs4.1/fs.py +++ b/nfs4.1/fs.py @@ -25,7 +25,7 @@ class MetaData(object): self.refcnt = 0 self.createverf = "" self.owner = "" - self.mode = 0777 + self.mode = 0o777 self.time_access = self.time_modify = self.time_create = nfs4lib.get_nfstime() if 1: self.parent = 0 diff --git a/nfs4.1/nfs4client.py b/nfs4.1/nfs4client.py index 135981d..5288942 100644 --- a/nfs4.1/nfs4client.py +++ b/nfs4.1/nfs4client.py @@ -560,7 +560,7 @@ class SessionRecord(object): return res ## def open(self, owner, name=None, type=OPEN4_NOCREATE, -## mode=UNCHECKED4, attrs={FATTR4_MODE:0644}, verf=None, +## mode=UNCHECKED4, attrs={FATTR4_MODE:0o644}, verf=None, ## access=OPEN4_SHARE_ACCESS_READ, ## deny=OPEN4_SHARE_DENY_WRITE, ## claim_type=CLAIM_NULL, deleg_type=None, deleg_cur_info=None): diff --git a/nfs4.1/server41tests/environment.py b/nfs4.1/server41tests/environment.py index 823dfe3..3020371 100644 --- a/nfs4.1/server41tests/environment.py +++ b/nfs4.1/server41tests/environment.py @@ -418,7 +418,7 @@ def clean_dir(sess, path): for e in entries: # We separate setattr and remove to avoid an inode locking bug ops = use_obj(path + [e.name]) - ops += [op.setattr(stateid, {FATTR4_MODE:0755})] + ops += [op.setattr(stateid, {FATTR4_MODE:0o755})] res = sess.compound(ops) check(res, msg="Setting mode on %s" % repr(e.name)) ops = use_obj(path) @@ -460,7 +460,7 @@ def do_getattrdict(sess, file, attrlist): check(res) return res.resarray[-1].obj_attributes -def create_obj(sess, path, kind=NF4DIR, attrs={FATTR4_MODE:0755}): +def create_obj(sess, path, kind=NF4DIR, attrs={FATTR4_MODE:0o755}): """Return ops needed to create given non-file object""" # Ensure using createtype4 if not hasattr(kind, "type"): @@ -468,7 +468,7 @@ def create_obj(sess, path, kind=NF4DIR, attrs={FATTR4_MODE:0755}): ops = use_obj(path[:-1]) + [op.create(kind, path[-1], attrs)] return sess.compound(ops) -def open_create_file(sess, owner, path=None, attrs={FATTR4_MODE: 0644}, +def open_create_file(sess, owner, path=None, attrs={FATTR4_MODE: 0o644}, access=OPEN4_SHARE_ACCESS_BOTH, deny=OPEN4_SHARE_DENY_NONE, mode=GUARDED4, verifier=None, @@ -483,7 +483,7 @@ def open_create_file(sess, owner, path=None, attrs={FATTR4_MODE: 0644}, return sess.compound(open_op) -def open_create_file_op(sess, owner, path=None, attrs={FATTR4_MODE: 0644}, +def open_create_file_op(sess, owner, path=None, attrs={FATTR4_MODE: 0o644}, access=OPEN4_SHARE_ACCESS_BOTH, deny=OPEN4_SHARE_DENY_NONE, mode=GUARDED4, verifier=None, @@ -526,7 +526,7 @@ def open_create_file_op(sess, owner, path=None, attrs={FATTR4_MODE: 0644}, return fh_op + [open_op, op.getfh()] -def create_file(sess, owner, path=None, attrs={FATTR4_MODE: 0644}, +def create_file(sess, owner, path=None, attrs={FATTR4_MODE: 0o644}, access=OPEN4_SHARE_ACCESS_BOTH, deny=OPEN4_SHARE_DENY_NONE, mode=GUARDED4, verifier=None, want_deleg=False, @@ -559,7 +559,7 @@ def open_file(sess, owner, path=None, verifier, claim_type, want_deleg, deleg_type, open_create, seqid, clientid) -def create_confirm(sess, owner, path=None, attrs={FATTR4_MODE: 0644}, +def create_confirm(sess, owner, path=None, attrs={FATTR4_MODE: 0o644}, access=OPEN4_SHARE_ACCESS_BOTH, deny=OPEN4_SHARE_DENY_NONE, mode=GUARDED4): @@ -572,7 +572,7 @@ def create_confirm(sess, owner, path=None, attrs={FATTR4_MODE: 0644}, fh = res.resarray[-1].object return fh, res.resarray[-2].stateid -def create_close(sess, owner, path=None, attrs={FATTR4_MODE: 0644}, +def create_close(sess, owner, path=None, attrs={FATTR4_MODE: 0o644}, access=OPEN4_SHARE_ACCESS_BOTH, deny=OPEN4_SHARE_DENY_NONE, mode=GUARDED4): diff --git a/nfs4.1/server41tests/st_lookup.py b/nfs4.1/server41tests/st_lookup.py index 9f50004..3899425 100644 --- a/nfs4.1/server41tests/st_lookup.py +++ b/nfs4.1/server41tests/st_lookup.py @@ -270,7 +270,7 @@ if 0: DEPEND: MKDIR CODE: LOOK6 """ - # Create dir/foo, and set mode of dir to 000 + # Create dir/foo, and set mode of dir to 0o000 c = env.c1 dir = c.homedir + [t.code] res = c.create_obj(dir) @@ -283,7 +283,7 @@ if 0: res = c.compound(c.use_obj(dir)) check(res) res = c.compound(c.use_obj(dir + ['foo'])) - check(res, NFS4ERR_ACCESS, "LOOKUP object in a dir with mode=000") + check(res, NFS4ERR_ACCESS, "LOOKUP object in a dir with mode=0o000") def testInvalidUtf8(t, env): """LOOKUP with bad UTF-8 name strings should return NFS4ERR_INVAL From patchwork Tue Jul 24 07:33:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jianhong Yin X-Patchwork-Id: 10541399 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5F3C5184F for ; Tue, 24 Jul 2018 07:34:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4487428760 for ; Tue, 24 Jul 2018 07:34:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 38E3F28763; Tue, 24 Jul 2018 07:34:05 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E1BD028760 for ; Tue, 24 Jul 2018 07:34:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388406AbeGXIjK (ORCPT ); Tue, 24 Jul 2018 04:39:10 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:54812 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2388391AbeGXIjK (ORCPT ); Tue, 24 Jul 2018 04:39:10 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 760957DAC2; Tue, 24 Jul 2018 07:34:03 +0000 (UTC) Received: from dhcp-12-115.nay.redhat.com (unknown [10.66.12.115]) by smtp.corp.redhat.com (Postfix) with ESMTP id DD86D178B3; Tue, 24 Jul 2018 07:34:01 +0000 (UTC) From: jiyin@redhat.com To: bfields@redhat.com Cc: linux-nfs@vger.kernel.org, "Jianhong.Yin" Subject: [PATCH 07/24] pynfs: python3 support plan: sys.maxint -> sys.maxsize Date: Tue, 24 Jul 2018 15:33:25 +0800 Message-Id: <20180724073342.5738-7-jiyin@redhat.com> In-Reply-To: <20180724073342.5738-1-jiyin@redhat.com> References: <20180724073342.5738-1-jiyin@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Tue, 24 Jul 2018 07:34:03 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Tue, 24 Jul 2018 07:34:03 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'jiyin@redhat.com' RCPT:'' Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: "Jianhong.Yin" s/sys.maxint/sys.maxsize/g Signed-off-by: Jianhong Yin --- nfs4.1/testmod.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nfs4.1/testmod.py b/nfs4.1/testmod.py index 21e9915..0cb76da 100644 --- a/nfs4.1/testmod.py +++ b/nfs4.1/testmod.py @@ -333,7 +333,7 @@ def parseversions(t): raise RuntimeError("Test %s has invalid version range %s" % (t.fullname, t.vers_list)) if len(t.vers_list) == 0: - return (0, sys.maxint) + return (0, sys.maxsize) limits = t.vers_list[0].split("-") if len(limits) != 2: raise RuntimeError("Test %s has invalid version range %s" @@ -343,7 +343,7 @@ def parseversions(t): else: left = int(limits[0]) if limits[1] == '': - right = sys.maxint + right = sys.maxsize else: right = int(limits[1]) return (left, right) From patchwork Tue Jul 24 07:33:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jianhong Yin X-Patchwork-Id: 10541407 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 54E7917FD for ; Tue, 24 Jul 2018 07:34:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3B22C28759 for ; Tue, 24 Jul 2018 07:34:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2F38F2875E; Tue, 24 Jul 2018 07:34:07 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CD3CD28759 for ; Tue, 24 Jul 2018 07:34:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388410AbeGXIjM (ORCPT ); Tue, 24 Jul 2018 04:39:12 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:54816 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2388391AbeGXIjM (ORCPT ); Tue, 24 Jul 2018 04:39:12 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A32427DAC6; Tue, 24 Jul 2018 07:34:05 +0000 (UTC) Received: from dhcp-12-115.nay.redhat.com (unknown [10.66.12.115]) by smtp.corp.redhat.com (Postfix) with ESMTP id 17939178B3; Tue, 24 Jul 2018 07:34:03 +0000 (UTC) From: jiyin@redhat.com To: bfields@redhat.com Cc: linux-nfs@vger.kernel.org, "Jianhong.Yin" Subject: [PATCH 08/24] pynfs: python3 support plan: cStringIO -> StringIO Date: Tue, 24 Jul 2018 15:33:26 +0800 Message-Id: <20180724073342.5738-8-jiyin@redhat.com> In-Reply-To: <20180724073342.5738-1-jiyin@redhat.com> References: <20180724073342.5738-1-jiyin@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Tue, 24 Jul 2018 07:34:05 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Tue, 24 Jul 2018 07:34:05 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'jiyin@redhat.com' RCPT:'' Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: "Jianhong.Yin" try: # python2 import cStringIO.StringIO as StringIO except: # python3 from io import StringIO Signed-off-by: Jianhong Yin --- nfs4.0/nfs4state.py | 5 ++--- nfs4.1/fs.py | 5 ++++- xdr/xdrgen.py | 5 ++++- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/nfs4.0/nfs4state.py b/nfs4.0/nfs4state.py index 180e642..cd36edd 100755 --- a/nfs4.0/nfs4state.py +++ b/nfs4.0/nfs4state.py @@ -5,10 +5,9 @@ import nfs4acl import nfs4lib import os, time, array, random, string try: - import cStringIO - StringIO = cStringIO + import cStringIO.StringIO as StringIO except: - import StringIO + from io import StringIO from stat import * import sha diff --git a/nfs4.1/fs.py b/nfs4.1/fs.py index e2c7eca..e8d413e 100644 --- a/nfs4.1/fs.py +++ b/nfs4.1/fs.py @@ -6,7 +6,10 @@ from nfs4lib import NFS4Error import struct import logging from locking import Lock, RWLock -from cStringIO import StringIO +try: + import cStringIO.StringIO as StringIO +except: + from io import StringIO import time from xdrdef.nfs4_pack import NFS4Packer diff --git a/xdr/xdrgen.py b/xdr/xdrgen.py index 0aa1a52..8856b4c 100755 --- a/xdr/xdrgen.py +++ b/xdr/xdrgen.py @@ -215,7 +215,10 @@ import sys import keyword -import StringIO +try: + import cStringIO.StringIO as StringIO +except: + from io import StringIO import time import os # Allow to be run stright from package From patchwork Tue Jul 24 07:33:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jianhong Yin X-Patchwork-Id: 10541409 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C2DDA17FD for ; Tue, 24 Jul 2018 07:34:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A82D628759 for ; Tue, 24 Jul 2018 07:34:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9CAE32875E; Tue, 24 Jul 2018 07:34:10 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 29E1328759 for ; Tue, 24 Jul 2018 07:34:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388390AbeGXIjP (ORCPT ); Tue, 24 Jul 2018 04:39:15 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:54820 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2388391AbeGXIjP (ORCPT ); Tue, 24 Jul 2018 04:39:15 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D1A137DAC2; Tue, 24 Jul 2018 07:34:07 +0000 (UTC) Received: from dhcp-12-115.nay.redhat.com (unknown [10.66.12.115]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4592C178B4; Tue, 24 Jul 2018 07:34:05 +0000 (UTC) From: jiyin@redhat.com To: bfields@redhat.com Cc: linux-nfs@vger.kernel.org, "Jianhong.Yin" Subject: [PATCH 09/24] pynfs: python3 support plan: dict.has_key -> key in dict Date: Tue, 24 Jul 2018 15:33:27 +0800 Message-Id: <20180724073342.5738-9-jiyin@redhat.com> In-Reply-To: <20180724073342.5738-1-jiyin@redhat.com> References: <20180724073342.5738-1-jiyin@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Tue, 24 Jul 2018 07:34:07 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Tue, 24 Jul 2018 07:34:07 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'jiyin@redhat.com' RCPT:'' Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: "Jianhong.Yin" and rename DirList.has_key() to DirList.has_name() to avoid confuse Signed-off-by: Jianhong Yin --- nfs4.0/lib/rpc/rpc.py | 2 +- nfs4.0/nfs4lib.py | 2 +- nfs4.0/nfs4server.py | 4 ++-- nfs4.0/nfs4state.py | 10 +++++----- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/nfs4.0/lib/rpc/rpc.py b/nfs4.0/lib/rpc/rpc.py index d9c1401..be14658 100644 --- a/nfs4.0/lib/rpc/rpc.py +++ b/nfs4.0/lib/rpc/rpc.py @@ -514,7 +514,7 @@ class RPCServer(Server): 'sys': AUTH_SYS, 'gss': RPCSEC_GSS, }.iteritems(): - if supported.has_key(secname): + if secname in supported: self.security[sectype] = supported[secname]() self.readbufs = {} diff --git a/nfs4.0/nfs4lib.py b/nfs4.0/nfs4lib.py index 5c9e853..dddbf91 100644 --- a/nfs4.0/nfs4lib.py +++ b/nfs4.0/nfs4lib.py @@ -232,7 +232,7 @@ class CBServer(rpc.RPCServer): results = [] ok = NFS4_OK for op in cmp4args.argarray: - if self.opcodes.has_key(op.argop): + if op.argop in self.opcodes: ok, result = self.opcodes[op.argop](op, cbid) else: ok = NFS4ERR_OP_ILLEGAL diff --git a/nfs4.0/nfs4server.py b/nfs4.0/nfs4server.py index 163bd60..18b0aad 100755 --- a/nfs4.0/nfs4server.py +++ b/nfs4.0/nfs4server.py @@ -504,7 +504,7 @@ class NFS4Server(rpc.RPCServer): if op.opopen.openhow.how.mode == GUARDED4: raise NFS4Error(NFS4ERR_EXIST) # with an existing file ignore attrs except size=0 - if attrs.has_key(FATTR4_SIZE) and attrs[FATTR4_SIZE]==0: + if FATTR4_SIZE in attrs and attrs[FATTR4_SIZE]==0: attrset = existing.set_attributes(attrdict={FATTR4_SIZE:0}) # Now break out and use existing as is else: @@ -593,7 +593,7 @@ class NFS4Server(rpc.RPCServer): def op_putfh(self, op): print(" FILEHANDLE '%s'" % repr(op.opputfh.object)) # check access! - if not self.fhcache.has_key(op.opputfh.object): + if not op.opputfh.object in self.fhcache: return simple_error(NFS4ERR_BADHANDLE) self.curr_fh = self.fhcache[op.opputfh.object] return simple_error(NFS4_OK) diff --git a/nfs4.0/nfs4state.py b/nfs4.0/nfs4state.py index cd36edd..8aca178 100755 --- a/nfs4.0/nfs4state.py +++ b/nfs4.0/nfs4state.py @@ -1014,7 +1014,7 @@ class VirtualHandle(NFSFileHandle): # Must make sure that if it fails, nothing is changed if self.fattr4_type != NF4DIR: raise "create called on non-directory (%s)" % self.ref - if self.dirent.has_key(name): + if self.dirent.has_name(name): raise "attempted to create already existing file." fh = VirtualHandle(name, type, self) if FATTR4_SIZE in attrs and type.type != NF4REG: @@ -1116,7 +1116,7 @@ class VirtualHandle(NFSFileHandle): mapping = nfs4lib.list2bitmap ret_list = [] for attr in attrdict.keys(): - if not self.supported.has_key(attr): + if not attr in self.supported: raise NFS4Error(NFS4ERR_ATTRNOTSUPP, attrs=mapping(ret_list)) if 'w' not in self.supported[attr]: raise NFS4Error(NFS4ERR_INVAL, attrs=mapping(ret_list)) @@ -1182,7 +1182,7 @@ class VirtualHandle(NFSFileHandle): # Make sure any error is recorded in fattr4_rdattr_error ret_dict = {} for attr in attrlist: - if not self.supported.has_key(attr): + if not attr in self.supported: # Ignore unknown attributes continue if 'r' not in self.supported[attr]: @@ -1419,7 +1419,7 @@ class HardHandle(NFSFileHandle): self.oldfiles = self.dirent.keys() for i in os.listdir(self.file): fullfile = os.path.join(self.file, i) - if not self.dirent.has_key(i): + if not self.dirent.has_name(i): self.dirent[i] = HardHandle(i, self, fullfile) else: self.oldfiles.remove(i) @@ -1520,7 +1520,7 @@ class DirList: else: return self.list[i:] - def has_key(self, name): + def has_name(self, name): for x in self.list: if x.name == name: return True From patchwork Tue Jul 24 07:33:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jianhong Yin X-Patchwork-Id: 10541411 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 271E817FD for ; Tue, 24 Jul 2018 07:34:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0C3B728759 for ; Tue, 24 Jul 2018 07:34:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 00ED92875E; Tue, 24 Jul 2018 07:34:11 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 91BC328759 for ; Tue, 24 Jul 2018 07:34:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388424AbeGXIjR (ORCPT ); Tue, 24 Jul 2018 04:39:17 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:52764 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2388391AbeGXIjR (ORCPT ); Tue, 24 Jul 2018 04:39:17 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0E42C402332F; Tue, 24 Jul 2018 07:34:10 +0000 (UTC) Received: from dhcp-12-115.nay.redhat.com (unknown [10.66.12.115]) by smtp.corp.redhat.com (Postfix) with ESMTP id 74107178B7; Tue, 24 Jul 2018 07:34:08 +0000 (UTC) From: jiyin@redhat.com To: bfields@redhat.com Cc: linux-nfs@vger.kernel.org, "Jianhong.Yin" Subject: [PATCH 10/24] pynfs: python3 support plan: not equal op s/ <> / != / Date: Tue, 24 Jul 2018 15:33:28 +0800 Message-Id: <20180724073342.5738-10-jiyin@redhat.com> In-Reply-To: <20180724073342.5738-1-jiyin@redhat.com> References: <20180724073342.5738-1-jiyin@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Tue, 24 Jul 2018 07:34:10 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Tue, 24 Jul 2018 07:34:10 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'jiyin@redhat.com' RCPT:'' Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: "Jianhong.Yin" Signed-off-by: Jianhong Yin --- nfs4.0/nfs4lib.py | 4 ++-- nfs4.0/nfs4server.py | 4 ++-- nfs4.1/nfs4client.py | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/nfs4.0/nfs4lib.py b/nfs4.0/nfs4lib.py index dddbf91..6f6d2f9 100644 --- a/nfs4.0/nfs4lib.py +++ b/nfs4.0/nfs4lib.py @@ -227,7 +227,7 @@ class CBServer(rpc.RPCServer): cbid = cmp4args.callback_ident except XDRError: return NFS4ERR_BADXDR, [], tag - if cmp4args.minorversion <> 0: + if cmp4args.minorversion != 0: return NFS4ERR_MINOR_VERS_MISMATCH, [], tag results = [] ok = NFS4_OK @@ -239,7 +239,7 @@ class CBServer(rpc.RPCServer): resop4 = CB_ILLEGAL4res(NFS4ERR_OP_ILLEGAL) result = nfs_cb_resop4(resop=OP_ILLEGAL, opcbillegal=resop4) results += [ result ] - if ok <> NFS4_OK: + if ok != NFS4_OK: break return ok, results, tag diff --git a/nfs4.0/nfs4server.py b/nfs4.0/nfs4server.py index 18b0aad..753372e 100755 --- a/nfs4.0/nfs4server.py +++ b/nfs4.0/nfs4server.py @@ -171,7 +171,7 @@ class NFS4Server(rpc.RPCServer): return NFS4ERR_BADXDR, [], tag print("TCP NFSv4 COMPOUND call, tag: %s, n_ops: %d" % \ (repr(tag), len(cmp4args.argarray))) - if cmp4args.minorversion <> 0: + if cmp4args.minorversion != 0: return NFS4ERR_MINOR_VERS_MISMATCH, [], tag if not verify_utf8(tag): return NFS4ERR_INVAL, [], tag @@ -183,7 +183,7 @@ class NFS4Server(rpc.RPCServer): print("*** %s (%d) ***" % (opname, op.argop)) ok, result = getattr(self, opname.lower())(op) results += [ result ] - if ok <> NFS4_OK: + if ok != NFS4_OK: print(" ! error %s" % nfsstat4[ok]) break print("Replying. Status %s (%d)" % (nfsstat4[ok], ok)) diff --git a/nfs4.1/nfs4client.py b/nfs4.1/nfs4client.py index 5288942..0588d7b 100644 --- a/nfs4.1/nfs4client.py +++ b/nfs4.1/nfs4client.py @@ -177,7 +177,7 @@ class NFS4Client(rpc.Client, rpc.Server): def op_cb_compound(self, args, cred): env = CompoundState(args, cred) # Check for problems with the compound itself - if args.minorversion <> 0: + if args.minorversion != 0: if args.minorversion not in self.minor_versions: env.results.set_empty_return(NFS4ERR_MINOR_VERS_MISMATCH) return env From patchwork Tue Jul 24 07:33:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jianhong Yin X-Patchwork-Id: 10541413 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E8D86184F for ; Tue, 24 Jul 2018 07:34:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D0EB128759 for ; Tue, 24 Jul 2018 07:34:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C5BAC28763; Tue, 24 Jul 2018 07:34:13 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7FBE828759 for ; Tue, 24 Jul 2018 07:34:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388425AbeGXIjT (ORCPT ); Tue, 24 Jul 2018 04:39:19 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:60400 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2388391AbeGXIjT (ORCPT ); Tue, 24 Jul 2018 04:39:19 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3CFBD401EF17; Tue, 24 Jul 2018 07:34:12 +0000 (UTC) Received: from dhcp-12-115.nay.redhat.com (unknown [10.66.12.115]) by smtp.corp.redhat.com (Postfix) with ESMTP id A5245178B3; Tue, 24 Jul 2018 07:34:10 +0000 (UTC) From: jiyin@redhat.com To: bfields@redhat.com Cc: linux-nfs@vger.kernel.org, "Jianhong.Yin" Subject: [PATCH 11/24] pynfs: python3 support plan: xdrgen: remove 'L' suffix of long integer Date: Tue, 24 Jul 2018 15:33:29 +0800 Message-Id: <20180724073342.5738-11-jiyin@redhat.com> In-Reply-To: <20180724073342.5738-1-jiyin@redhat.com> References: <20180724073342.5738-1-jiyin@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Tue, 24 Jul 2018 07:34:12 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Tue, 24 Jul 2018 07:34:12 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'jiyin@redhat.com' RCPT:'' Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: "Jianhong.Yin" Signed-off-by: Jianhong Yin --- xdr/xdrgen.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/xdr/xdrgen.py b/xdr/xdrgen.py index 8856b4c..b5119cc 100755 --- a/xdr/xdrgen.py +++ b/xdr/xdrgen.py @@ -341,10 +341,7 @@ def p_constant(t): '''constant : CONST10 | CONST8 | CONST16''' - if len(t[1]) > 9: - t[0] = t[1] + 'L' - else: - t[0] = t[1] + t[0] = t[1] def p_value(t): '''value : constant From patchwork Tue Jul 24 07:33:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jianhong Yin X-Patchwork-Id: 10541415 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 18794184F for ; Tue, 24 Jul 2018 07:34:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F17912875E for ; Tue, 24 Jul 2018 07:34:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E62CC28761; Tue, 24 Jul 2018 07:34:16 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 83D552875E for ; Tue, 24 Jul 2018 07:34:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388391AbeGXIjW (ORCPT ); Tue, 24 Jul 2018 04:39:22 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:54704 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2388421AbeGXIjW (ORCPT ); Tue, 24 Jul 2018 04:39:22 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6952883221; Tue, 24 Jul 2018 07:34:14 +0000 (UTC) Received: from dhcp-12-115.nay.redhat.com (unknown [10.66.12.115]) by smtp.corp.redhat.com (Postfix) with ESMTP id D1F64178B4; Tue, 24 Jul 2018 07:34:12 +0000 (UTC) From: jiyin@redhat.com To: bfields@redhat.com Cc: linux-nfs@vger.kernel.org, "Jianhong.Yin" Subject: [PATCH 12/24] pynfs: python3 support plan: file() -> open() Date: Tue, 24 Jul 2018 15:33:30 +0800 Message-Id: <20180724073342.5738-12-jiyin@redhat.com> In-Reply-To: <20180724073342.5738-1-jiyin@redhat.com> References: <20180724073342.5738-1-jiyin@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Tue, 24 Jul 2018 07:34:14 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Tue, 24 Jul 2018 07:34:14 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'jiyin@redhat.com' RCPT:'' Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: "Jianhong.Yin" Signed-off-by: Jianhong Yin --- nfs4.0/testserver.py | 2 +- nfs4.1/testclient.py | 2 +- nfs4.1/testserver.py | 2 +- showresults.py | 2 +- xdr/xdrgen.py | 6 +++--- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/nfs4.0/testserver.py b/nfs4.0/testserver.py index 96012a1..fcee8e9 100755 --- a/nfs4.0/testserver.py +++ b/nfs4.0/testserver.py @@ -354,7 +354,7 @@ def main(): print(sys.exc_info()[1]) sys.exit(1) if opt.outfile is not None: - fd = file(opt.outfile, 'w') + fd = open(opt.outfile, 'w') try: clean_finish = False testmod.runtests(tests, opt, env, run_filter) diff --git a/nfs4.1/testclient.py b/nfs4.1/testclient.py index 1027fa6..47b74bd 100755 --- a/nfs4.1/testclient.py +++ b/nfs4.1/testclient.py @@ -313,7 +313,7 @@ def main(): print(sys.exc_info()[1]) sys.exit(1) if opt.outfile is not None: - fd = file(opt.outfile, 'w') + fd = open(opt.outfile, 'w') try: clean_finish = False testmod.runtests(tests, opt, env, run_filter) diff --git a/nfs4.1/testserver.py b/nfs4.1/testserver.py index 101cfb1..c21221e 100755 --- a/nfs4.1/testserver.py +++ b/nfs4.1/testserver.py @@ -333,7 +333,7 @@ def main(): print(sys.exc_info()[1]) sys.exit(1) if opt.outfile is not None: - fd = file(opt.outfile, 'w') + fd = open(opt.outfile, 'w') try: clean_finish = False testmod.runtests(tests, opt, env, run_filter) diff --git a/showresults.py b/showresults.py index 962407d..ed23f7b 100755 --- a/showresults.py +++ b/showresults.py @@ -38,7 +38,7 @@ class MyUnpickler(pickle.Unpickler): return self.Unknown(name) def show(filename, opt): - fd = file(filename, 'r') + fd = open(filename, 'r') p = MyUnpickler(fd) tests = p.load() testmod.printresults(tests, opt) diff --git a/xdr/xdrgen.py b/xdr/xdrgen.py index b5119cc..bed2181 100755 --- a/xdr/xdrgen.py +++ b/xdr/xdrgen.py @@ -1419,12 +1419,12 @@ def run(infile, filters=True, pass_attrs=True, debug=False): comment_string = "# Generated by rpcgen.py from %s on %s\n" % \ (infile, time.asctime()) - const_fd = file(constants_file + ".py", "w") + const_fd = open(constants_file + ".py", "w") const_fd.write(comment_string) - type_fd = file(types_file + ".py", "w") + type_fd = open(types_file + ".py", "w") type_fd.write(comment_string) type_fd.write("import %s as const\n" % constants_file) - pack_fd = file(packer_file + ".py", "w") + pack_fd = open(packer_file + ".py", "w") pack_fd.write(comment_string) pack_fd.write(pack_header % (constants_file, types_file)) pack_fd.write(pack_init % name_base.upper()) From patchwork Tue Jul 24 07:33:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jianhong Yin X-Patchwork-Id: 10541417 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6975017FD for ; Tue, 24 Jul 2018 07:34:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4DAD02875E for ; Tue, 24 Jul 2018 07:34:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4008828780; Tue, 24 Jul 2018 07:34:19 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AC3FB2875E for ; Tue, 24 Jul 2018 07:34:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388426AbeGXIjY (ORCPT ); Tue, 24 Jul 2018 04:39:24 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:54710 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2388421AbeGXIjY (ORCPT ); Tue, 24 Jul 2018 04:39:24 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 97F498780F; Tue, 24 Jul 2018 07:34:16 +0000 (UTC) Received: from dhcp-12-115.nay.redhat.com (unknown [10.66.12.115]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0B34E178B3; Tue, 24 Jul 2018 07:34:14 +0000 (UTC) From: jiyin@redhat.com To: bfields@redhat.com Cc: linux-nfs@vger.kernel.org, "Jianhong.Yin" Subject: [PATCH 13/24] pynfs: python3 support plan: list.sort() -> newlist = sorted(list) Date: Tue, 24 Jul 2018 15:33:31 +0800 Message-Id: <20180724073342.5738-13-jiyin@redhat.com> In-Reply-To: <20180724073342.5738-1-jiyin@redhat.com> References: <20180724073342.5738-1-jiyin@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Tue, 24 Jul 2018 07:34:16 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Tue, 24 Jul 2018 07:34:16 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'jiyin@redhat.com' RCPT:'' Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: "Jianhong.Yin" Signed-off-by: Jianhong Yin --- xdr/xdrgen.py | 56 ++++++++++++++++++++++++++++++++------------------- 1 file changed, 35 insertions(+), 21 deletions(-) diff --git a/xdr/xdrgen.py b/xdr/xdrgen.py index bed2181..6303184 100755 --- a/xdr/xdrgen.py +++ b/xdr/xdrgen.py @@ -305,7 +305,7 @@ def t_linecomment(t): def t_error(t): print("Illegal character %s at %d type %s" % (repr(t.value[0]), t.lexer.lineno, t.type)) t.lexer.skip(1) - + # Build the lexer lex.lex(debug=0) @@ -641,7 +641,7 @@ def p_proc_firstarg(t): def p_type_specifier_list(t): '''type_specifier_list : COMMA type_specifier type_specifier_list | empty''' - + ########################################################################## # # @@ -718,7 +718,7 @@ class Info(object): def const_output(self): return None - + def type_output(self): return None @@ -853,7 +853,7 @@ class Info(object): else: subheader = array = varindent = '' return prefix+varindent, newdata, subheader, array - + def packenum(self, prefix, data='data'): prefix, data, subheader, array = self._array_pack(prefix, data) varlist = ["const.%s" % l.id for l in self.body] @@ -952,7 +952,7 @@ class Info(object): else: unpack += "%s%sraise XDRError('bad switch=%%s' %% %s.%s)\n" % \ (prefix, indent, data, switch.id) - + return subheader + unpack + array def xdrbody(self, prefix=''): @@ -977,7 +977,7 @@ class Info(object): ''.join(["%s\n" % d.xdrout(prefix + indent) for d in self.body[-1].declarations]) return body - + class const_info(Info): """The result of 'CONST ID EQUALS constant SEMI' or inside of enum as 'ID EQUALS value' """ @@ -988,13 +988,16 @@ class const_info(Info): self.lineno = self.sortno = lineno self.type = 'const' self.enum = enum - + def __repr__(self): return "constant %s=%s at line %s" % (self.id, self.value, self.lineno) + def __lt__(self, other): + return self.sortno < other.sortno + def xdrout(self, prefix=''): return "%s%s = %s" % (prefix, self.id, self.value) - + def const_output(self): return "%s = %s\n" % (self.id, self.value) @@ -1016,6 +1019,9 @@ class enum_info(Info): self.array = False self.parent = True + def __lt__(self, other): + return self.sortno < other.sortno + def const_output(self): body = ''.join(["%s%s : '%s',\n" % (indent, l.value, l.id) for l in self.body]) @@ -1029,7 +1035,7 @@ class enum_info(Info): header = "%sdef unpack_%s(self):\n" % (indent, self.id) return header + self.unpackenum(indent2) + \ self._get_unpack_footer() - + class struct_info(Info): """The result of 'TYPEDEF STRUCT ID SEMI' or 'STRUCT ID SEMI' @@ -1048,6 +1054,9 @@ class struct_info(Info): self.array = False self.parent = True + def __lt__(self, other): + return self.sortno < other.sortno + def type_output(self): comment = '%s# ' % indent xdrbody = self.xdrbody(comment) @@ -1079,11 +1088,11 @@ class struct_info(Info): (indent, indent2, candidates[0].id) else: return '' - + def pack_output(self): header = self._get_pack_header() return header + self.packstruct(indent2) - + def unpack_output(self): header = "%sdef unpack_%s(self):\n" % (indent, self.id) return header + self.unpackstruct(indent2) + \ @@ -1107,6 +1116,9 @@ class union_info(Info): self.array = False self.parent = True + def __lt__(self, other): + return self.sortno < other.sortno + def union_getattr(self, prefix=indent): return "%sdef __getattr__(self, attr):\n"\ "%s%sreturn getattr(self.switch, attr)\n" % \ @@ -1174,6 +1186,9 @@ class type_info(Info): self.fixed = False self.parent = False + def __lt__(self, other): + return self.sortno < other.sortno + def __str__(self): return "%s %s at line %s" % (self.type, self.id, self.lineno) @@ -1198,14 +1213,14 @@ class type_info(Info): x.len = self.len x.fixed = self.fixed return x - + def xdrout(self, prefix=''): if self.type == 'void': return "%svoid;" % prefix elif self.type == 'enum': body = self.xdrbody(prefix) name = "%senum {\n%s%s}" % (prefix, body, prefix) - + elif self.type == 'struct': body = self.xdrbody(prefix) name = "%sstruct {\n%s%s}" % (prefix, body, prefix) @@ -1260,7 +1275,7 @@ class type_info(Info): return "%s = %s\n" % (self.id, self.type) elif cast.type == "enum": return "%s = const.%s\n" % (self.id, self.type) - + def pack_output(self): if not self.array: return "%spack_%s = pack_%s\n" % (indent, self.id, self.type) @@ -1297,7 +1312,7 @@ class type_info(Info): pack = "%sself.pack_%s%s(%s%s%s)\n" % \ (prefix, fixchar, type, fixnum, data, packer) return limit + pack - + def _unpack_array(self, prefix, data='data'): if self.fixed or self.len is None: limit = '' @@ -1322,9 +1337,9 @@ class type_info(Info): pack = "%s%s = self.unpack_%s%s(%s)\n" % \ (prefix, data, fixchar, type, ', '.join(fixnum+packer)) return pack + limit - - - + + + ########################################################################## # # # Main Loop # @@ -1430,8 +1445,7 @@ def run(infile, filters=True, pass_attrs=True, debug=False): pack_fd.write(pack_init % name_base.upper()) pack_fd.write(packer_start) - type_list = name_dict.values() - type_list.sort() + type_list = sorted(name_dict.values()) for value in type_list: #print(value) output = value.const_output() @@ -1454,7 +1468,7 @@ def run(infile, filters=True, pass_attrs=True, debug=False): if output is not None: pack_fd.write(output) pack_fd.write('\n') - + const_fd.close() type_fd.close() pack_fd.close() From patchwork Tue Jul 24 07:33:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jianhong Yin X-Patchwork-Id: 10541421 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B0015184F for ; Tue, 24 Jul 2018 07:34:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9669128759 for ; Tue, 24 Jul 2018 07:34:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8AB8C2875E; Tue, 24 Jul 2018 07:34:24 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BB6C12875C for ; Tue, 24 Jul 2018 07:34:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388428AbeGXIj0 (ORCPT ); Tue, 24 Jul 2018 04:39:26 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:53708 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2388421AbeGXIj0 (ORCPT ); Tue, 24 Jul 2018 04:39:26 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C53E840241D3; Tue, 24 Jul 2018 07:34:18 +0000 (UTC) Received: from dhcp-12-115.nay.redhat.com (unknown [10.66.12.115]) by smtp.corp.redhat.com (Postfix) with ESMTP id 39903178B3; Tue, 24 Jul 2018 07:34:16 +0000 (UTC) From: jiyin@redhat.com To: bfields@redhat.com Cc: linux-nfs@vger.kernel.org, "Jianhong.Yin" Subject: [PATCH 14/24] pynfs: python3 support plan: Relative Import -> Absolute Import Date: Tue, 24 Jul 2018 15:33:32 +0800 Message-Id: <20180724073342.5738-14-jiyin@redhat.com> In-Reply-To: <20180724073342.5738-1-jiyin@redhat.com> References: <20180724073342.5738-1-jiyin@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Tue, 24 Jul 2018 07:34:18 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Tue, 24 Jul 2018 07:34:18 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'jiyin@redhat.com' RCPT:'' Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: "Jianhong.Yin" Signed-off-by: Jianhong Yin --- nfs4.0/lib/rpc/rpc.py | 23 ++++++++++++----------- nfs4.0/lib/rpc/rpcsec/sec_auth_gss.py | 2 +- nfs4.0/lib/rpc/rpcsec/sec_auth_none.py | 2 +- nfs4.0/lib/rpc/rpcsec/sec_auth_sys.py | 2 +- nfs4.0/nfs4lib.py | 20 +++++++++++--------- xdr/xdrgen.py | 4 +++- 6 files changed, 29 insertions(+), 24 deletions(-) diff --git a/nfs4.0/lib/rpc/rpc.py b/nfs4.0/lib/rpc/rpc.py index be14658..86075b2 100644 --- a/nfs4.0/lib/rpc/rpc.py +++ b/nfs4.0/lib/rpc/rpc.py @@ -7,6 +7,7 @@ # Information Technology Integration # +from __future__ import absolute_import import struct import xdrlib import socket @@ -14,17 +15,17 @@ import select import threading import errno -from rpc_const import * -from rpc_type import * -import rpc_pack +from rpc.rpc_const import * +from rpc.rpc_type import * +import rpc.rpc_pack as rpc_pack # Import security flavors and store valid ones -from rpcsec.sec_auth_none import SecAuthNone -from rpcsec.sec_auth_sys import SecAuthSys +from .rpcsec.sec_auth_none import SecAuthNone +from .rpcsec.sec_auth_sys import SecAuthSys supported = {'none' : SecAuthNone, 'sys' : SecAuthSys } try: - from rpcsec.sec_auth_gss import SecAuthGss + from .rpcsec.sec_auth_gss import SecAuthGss supported['gss'] = SecAuthGss except ImportError: pass @@ -427,11 +428,11 @@ class RPCClient(object): cred = self.security.make_cred() p.pack_uint(xid) p.pack_enum(CALL) - p.pack_uint(RPCVERSION) - p.pack_uint(prog) - p.pack_uint(vers) - p.pack_uint(proc) - p.pack_opaque_auth(cred) + p.pack_uint(RPCVERSION) + p.pack_uint(prog) + p.pack_uint(vers) + p.pack_uint(proc) + p.pack_opaque_auth(cred) verf = self.security.make_verf(p.get_buffer()) p.pack_opaque_auth(verf) return p.get_buffer(), cred diff --git a/nfs4.0/lib/rpc/rpcsec/sec_auth_gss.py b/nfs4.0/lib/rpc/rpcsec/sec_auth_gss.py index ee6ad53..1b5eb93 100644 --- a/nfs4.0/lib/rpc/rpcsec/sec_auth_gss.py +++ b/nfs4.0/lib/rpc/rpcsec/sec_auth_gss.py @@ -1,4 +1,4 @@ -from base import SecFlavor, SecError +from .base import SecFlavor, SecError from rpc.rpc_const import RPCSEC_GSS from rpc.rpc_type import opaque_auth from gss_const import * diff --git a/nfs4.0/lib/rpc/rpcsec/sec_auth_none.py b/nfs4.0/lib/rpc/rpcsec/sec_auth_none.py index 7058203..ec8896a 100644 --- a/nfs4.0/lib/rpc/rpcsec/sec_auth_none.py +++ b/nfs4.0/lib/rpc/rpcsec/sec_auth_none.py @@ -1,4 +1,4 @@ -from base import SecFlavor +from .base import SecFlavor class SecAuthNone(SecFlavor): pass diff --git a/nfs4.0/lib/rpc/rpcsec/sec_auth_sys.py b/nfs4.0/lib/rpc/rpcsec/sec_auth_sys.py index 27fc52e..778d379 100644 --- a/nfs4.0/lib/rpc/rpcsec/sec_auth_sys.py +++ b/nfs4.0/lib/rpc/rpcsec/sec_auth_sys.py @@ -1,4 +1,4 @@ -from base import SecFlavor, SecError +from .base import SecFlavor, SecError from rpc.rpc_const import AUTH_SYS from rpc.rpc_type import opaque_auth from xdrlib import Packer, Error diff --git a/nfs4.0/nfs4lib.py b/nfs4.0/nfs4lib.py index 6f6d2f9..79e386e 100644 --- a/nfs4.0/nfs4lib.py +++ b/nfs4.0/nfs4lib.py @@ -24,16 +24,8 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +from __future__ import absolute_import - -import rpc -import threading -from xdrlib import Error as XDRError -import xdrdef.nfs4_const as nfs4_const -from xdrdef.nfs4_const import * -import xdrdef.nfs4_type as nfs4_type -from xdrdef.nfs4_type import * -import xdrdef.nfs4_pack as nfs4_pack import time import struct import socket @@ -41,6 +33,16 @@ import sys import re import inspect from os.path import basename +import threading + +import rpc.rpc as rpc +import rpc.rpc_const as rpc_const +import xdrdef.nfs4_const as nfs4_const +from xdrdef.nfs4_const import * +import xdrdef.nfs4_type as nfs4_type +from xdrdef.nfs4_type import * +from xdrlib import Error as XDRError +import xdrdef.nfs4_pack as nfs4_pack import nfs_ops op4 = nfs_ops.NFS4ops() diff --git a/xdr/xdrgen.py b/xdr/xdrgen.py index 6303184..abfc8d7 100755 --- a/xdr/xdrgen.py +++ b/xdr/xdrgen.py @@ -1354,6 +1354,8 @@ allow_attr_passthrough = True # Option which allows substructure attrs to # be referenced directly, in cases where there # is a unique substructure to search. pack_header = """\ +import sys,os +sys.path.append(os.path.dirname(__file__)) import %s as const import %s as types import xdrlib @@ -1438,7 +1440,7 @@ def run(infile, filters=True, pass_attrs=True, debug=False): const_fd.write(comment_string) type_fd = open(types_file + ".py", "w") type_fd.write(comment_string) - type_fd.write("import %s as const\n" % constants_file) + type_fd.write("import sys,os\nsys.path.append(os.path.dirname(__file__))\nimport %s as const\n" % constants_file) pack_fd = open(packer_file + ".py", "w") pack_fd.write(comment_string) pack_fd.write(pack_header % (constants_file, types_file)) From patchwork Tue Jul 24 07:33:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jianhong Yin X-Patchwork-Id: 10541419 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B90E9184F for ; Tue, 24 Jul 2018 07:34:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9FF0E28759 for ; Tue, 24 Jul 2018 07:34:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 947DA28760; Tue, 24 Jul 2018 07:34:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4AB202875E for ; Tue, 24 Jul 2018 07:34:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388436AbeGXIj1 (ORCPT ); Tue, 24 Jul 2018 04:39:27 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:52772 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2388421AbeGXIj1 (ORCPT ); Tue, 24 Jul 2018 04:39:27 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id F2B9C402332F; Tue, 24 Jul 2018 07:34:20 +0000 (UTC) Received: from dhcp-12-115.nay.redhat.com (unknown [10.66.12.115]) by smtp.corp.redhat.com (Postfix) with ESMTP id 66D66178B3; Tue, 24 Jul 2018 07:34:19 +0000 (UTC) From: jiyin@redhat.com To: bfields@redhat.com Cc: linux-nfs@vger.kernel.org, "Jianhong.Yin" Subject: [PATCH 15/24] pynfs: python3 support plan: fix 'socket' has no attribute '_socketobject' Date: Tue, 24 Jul 2018 15:33:33 +0800 Message-Id: <20180724073342.5738-15-jiyin@redhat.com> In-Reply-To: <20180724073342.5738-1-jiyin@redhat.com> References: <20180724073342.5738-1-jiyin@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Tue, 24 Jul 2018 07:34:21 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Tue, 24 Jul 2018 07:34:21 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'jiyin@redhat.com' RCPT:'' Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: "Jianhong.Yin" Signed-off-by: Jianhong Yin --- nfs4.0/lib/rpc/rpc.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/nfs4.0/lib/rpc/rpc.py b/nfs4.0/lib/rpc/rpc.py index 86075b2..93f20dc 100644 --- a/nfs4.0/lib/rpc/rpc.py +++ b/nfs4.0/lib/rpc/rpc.py @@ -176,9 +176,14 @@ def _send_record(self, data, chunksize=2048): mark = struct.pack('>L', last | len(chunk)) self.sendall(mark + chunk) -socket._socketobject.recv_all = _recv_all -socket._socketobject.recv_record = _recv_record -socket._socketobject.send_record = _send_record +try: #for python2 + socket._socketobject.recv_all = _recv_all + socket._socketobject.recv_record = _recv_record + socket._socketobject.send_record = _send_record +except: #for python3 + socket.recv_all = _recv_all + socket.recv_record = _recv_record + socket.send_record = _send_record ################################################# From patchwork Tue Jul 24 07:33:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jianhong Yin X-Patchwork-Id: 10541423 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 41F9517FD for ; Tue, 24 Jul 2018 07:34:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 259CA28759 for ; Tue, 24 Jul 2018 07:34:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1A4E32875E; Tue, 24 Jul 2018 07:34:25 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B683828759 for ; Tue, 24 Jul 2018 07:34:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388421AbeGXIja (ORCPT ); Tue, 24 Jul 2018 04:39:30 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:60404 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2388431AbeGXIja (ORCPT ); Tue, 24 Jul 2018 04:39:30 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2CBBF401EF17; Tue, 24 Jul 2018 07:34:23 +0000 (UTC) Received: from dhcp-12-115.nay.redhat.com (unknown [10.66.12.115]) by smtp.corp.redhat.com (Postfix) with ESMTP id 94E38178B7; Tue, 24 Jul 2018 07:34:21 +0000 (UTC) From: jiyin@redhat.com To: bfields@redhat.com Cc: linux-nfs@vger.kernel.org, "Jianhong.Yin" Subject: [PATCH 16/24] pynfs: python3 support plan: remove cPickle Date: Tue, 24 Jul 2018 15:33:34 +0800 Message-Id: <20180724073342.5738-16-jiyin@redhat.com> In-Reply-To: <20180724073342.5738-1-jiyin@redhat.com> References: <20180724073342.5738-1-jiyin@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Tue, 24 Jul 2018 07:34:23 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Tue, 24 Jul 2018 07:34:23 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'jiyin@redhat.com' RCPT:'' Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: "Jianhong.Yin" Signed-off-by: Jianhong Yin --- nfs4.0/testserver.py | 2 +- nfs4.1/testclient.py | 2 +- nfs4.1/testserver.py | 2 +- showresults.py | 1 - 4 files changed, 3 insertions(+), 4 deletions(-) diff --git a/nfs4.0/testserver.py b/nfs4.0/testserver.py index fcee8e9..581dc3e 100755 --- a/nfs4.0/testserver.py +++ b/nfs4.0/testserver.py @@ -41,7 +41,7 @@ from optparse import OptionParser, OptionGroup, IndentedHelpFormatter import servertests.environment as environment import socket import rpc -import cPickle as pickle +import pickle VERSION="0.2" # How/when update this? diff --git a/nfs4.1/testclient.py b/nfs4.1/testclient.py index 47b74bd..3665253 100755 --- a/nfs4.1/testclient.py +++ b/nfs4.1/testclient.py @@ -34,7 +34,7 @@ from optparse import OptionParser, OptionGroup, IndentedHelpFormatter import client41tests.environment as environment import socket import rpc -import cPickle as pickle +import pickle def parse_useparams(str): return str.split(':') diff --git a/nfs4.1/testserver.py b/nfs4.1/testserver.py index c21221e..7818a5d 100755 --- a/nfs4.1/testserver.py +++ b/nfs4.1/testserver.py @@ -38,7 +38,7 @@ from optparse import OptionParser, OptionGroup, IndentedHelpFormatter import server41tests.environment as environment import socket import rpc -import cPickle as pickle +import pickle VERSION="0.2" # How/when update this? diff --git a/showresults.py b/showresults.py index ed23f7b..0b022fa 100755 --- a/showresults.py +++ b/showresults.py @@ -17,7 +17,6 @@ if __name__ == "__main__": if os.path.isfile(os.path.join(sys.path[0], 'nfs4.1', 'testmod.py')): sys.path.insert(1, os.path.join(sys.path[0], 'nfs4.1')) -#import cPickle as pickle import pickle import testmod from optparse import OptionParser From patchwork Tue Jul 24 07:33:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jianhong Yin X-Patchwork-Id: 10541427 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BD92D9093 for ; Tue, 24 Jul 2018 07:34:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A260C28759 for ; Tue, 24 Jul 2018 07:34:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 96F242875E; Tue, 24 Jul 2018 07:34:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7A69D28759 for ; Tue, 24 Jul 2018 07:34:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388440AbeGXIje (ORCPT ); Tue, 24 Jul 2018 04:39:34 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:54834 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2388431AbeGXIje (ORCPT ); Tue, 24 Jul 2018 04:39:34 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5B1C87DAC6; Tue, 24 Jul 2018 07:34:25 +0000 (UTC) Received: from dhcp-12-115.nay.redhat.com (unknown [10.66.12.115]) by smtp.corp.redhat.com (Postfix) with ESMTP id C217C178B3; Tue, 24 Jul 2018 07:34:23 +0000 (UTC) From: jiyin@redhat.com To: bfields@redhat.com Cc: linux-nfs@vger.kernel.org, "Jianhong.Yin" Subject: [PATCH 17/24] pynfs: python3 support plan: fix indent error on python3 Date: Tue, 24 Jul 2018 15:33:35 +0800 Message-Id: <20180724073342.5738-17-jiyin@redhat.com> In-Reply-To: <20180724073342.5738-1-jiyin@redhat.com> References: <20180724073342.5738-1-jiyin@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Tue, 24 Jul 2018 07:34:25 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Tue, 24 Jul 2018 07:34:25 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'jiyin@redhat.com' RCPT:'' Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: "Jianhong.Yin" Signed-off-by: Jianhong Yin --- nfs4.0/servertests/__init__.py | 2 +- nfs4.0/servertests/st_getattr.py | 12 +++++------ nfs4.0/servertests/st_lookup.py | 8 ++++---- nfs4.0/servertests/st_open.py | 4 ++-- nfs4.0/servertests/st_opendowngrade.py | 5 ++--- nfs4.0/servertests/st_readdir.py | 8 ++++---- nfs4.0/servertests/st_write.py | 4 ++-- nfs4.1/server41tests/__init__.py | 4 ++-- nfs4.1/server41tests/environment.py | 24 +++++++++++----------- nfs4.1/server41tests/st_current_stateid.py | 2 +- nfs4.1/server41tests/st_delegation.py | 12 +++++------ nfs4.1/server41tests/st_destroy_session.py | 2 +- nfs4.1/server41tests/st_flex.py | 2 +- nfs4.1/testmod.py | 8 ++++---- 14 files changed, 48 insertions(+), 49 deletions(-) diff --git a/nfs4.0/servertests/__init__.py b/nfs4.0/servertests/__init__.py index 4b684cb..b5f4974 100644 --- a/nfs4.0/servertests/__init__.py +++ b/nfs4.0/servertests/__init__.py @@ -1,5 +1,5 @@ __all__ = [ "st_access.py", - "st_acl.py", + "st_acl.py", "st_close.py", "st_commit.py", "st_compound.py", diff --git a/nfs4.0/servertests/st_getattr.py b/nfs4.0/servertests/st_getattr.py index 500542d..65a5701 100644 --- a/nfs4.0/servertests/st_getattr.py +++ b/nfs4.0/servertests/st_getattr.py @@ -525,18 +525,18 @@ def testOwnerName(t, env): def xxxtestMountedOnFileid(self): """GETATTR(FATTR4_MOUNTED_ON_FILEID) - This DOES NOT work on standard test tree. It assumes that pseudofs - root / and pseudo fs node /unix exist, and that /unix is a mountpoint - of an exported file system. The fsid of "/" should differ from the - fsid of "/unix", and the mounted_on_fileid should != the filed with - both the Getattr of "/unix" and the Readdir of "/". + This DOES NOT work on standard test tree. It assumes that pseudofs + root / and pseudo fs node /unix exist, and that /unix is a mountpoint + of an exported file system. The fsid of "/" should differ from the + fsid of "/unix", and the mounted_on_fileid should != the filed with + both the Getattr of "/unix" and the Readdir of "/". """ request = [FATTR4_MOUNTED_ON_FILEID, FATTR4_FILEID, FATTR4_FSID] lookupops = [op.lookup("unix")] ops = [op.putrootfh()] ops.append(self.ncl.getattr(request)) - ops += lookupops + ops += lookupops ops.append(self.ncl.getattr(request)) res = self.ncl.do_ops(ops) self.assert_OK(res) diff --git a/nfs4.0/servertests/st_lookup.py b/nfs4.0/servertests/st_lookup.py index a57d4cb..eed7100 100644 --- a/nfs4.0/servertests/st_lookup.py +++ b/nfs4.0/servertests/st_lookup.py @@ -220,9 +220,9 @@ def testNonAccessable(t, env): check(res) res = c.compound(c.use_obj(dir + ['foo'])) if env.opts.uid == 0: - check(res, [NFS4_OK, NFS4ERR_ACCESS], "LOOKUP object in a dir with mode=0o000") + check(res, [NFS4_OK, NFS4ERR_ACCESS], "LOOKUP object in a dir with mode=0o000") else: - check(res, NFS4ERR_ACCESS, "LOOKUP object in a dir with mode=0o000") + check(res, NFS4ERR_ACCESS, "LOOKUP object in a dir with mode=0o000") def testInvalidUtf8(t, env): """LOOKUP with bad UTF-8 name strings should return NFS4ERR_INVAL @@ -283,9 +283,9 @@ def testUnaccessibleDir(t, env): check(res, msg="Setting mode=0 on directory %s" % t.code) res = c.compound(c.use_obj(path + ['hidden'])) if env.opts.uid == 0: - check(res, [NFS4_OK, NFS4ERR_ACCESS], "LOOKUP off of dir with mode=0o000") + check(res, [NFS4_OK, NFS4ERR_ACCESS], "LOOKUP off of dir with mode=0o000") else: - check(res, NFS4ERR_ACCESS, "LOOKUP off of dir with mode=0o000") + check(res, NFS4ERR_ACCESS, "LOOKUP off of dir with mode=0o000") def testBadOpaque(t, env): """LOOKUP with a path component that has an incorrect array length diff --git a/nfs4.0/servertests/st_open.py b/nfs4.0/servertests/st_open.py index 12db5df..b4af81c 100644 --- a/nfs4.0/servertests/st_open.py +++ b/nfs4.0/servertests/st_open.py @@ -331,9 +331,9 @@ def testModeChange(t, env): res = c.open_file(t.code, access=OPEN4_SHARE_ACCESS_BOTH, deny=OPEN4_SHARE_DENY_NONE) if env.opts.uid == 0: - check(res, [NFS4_OK, NFS4ERR_ACCESS], "Opening file %s with mode=0o000" % t.code) + check(res, [NFS4_OK, NFS4ERR_ACCESS], "Opening file %s with mode=0o000" % t.code) else: - check(res, NFS4ERR_ACCESS, "Opening file %s with mode=0o000" % t.code) + check(res, NFS4ERR_ACCESS, "Opening file %s with mode=0o000" % t.code) def testShareConflict1(t, env): """OPEN conflicting with previous share diff --git a/nfs4.0/servertests/st_opendowngrade.py b/nfs4.0/servertests/st_opendowngrade.py index 9cbf5cb..213b2dd 100644 --- a/nfs4.0/servertests/st_opendowngrade.py +++ b/nfs4.0/servertests/st_opendowngrade.py @@ -136,16 +136,15 @@ class open_sequence: deny=OPEN4_SHARE_DENY_NONE, mode=UNCHECKED4) def downgrade(self, access): - res = self.client.downgrade_file(self.owner, self.fh, self.stateid, + res = self.client.downgrade_file(self.owner, self.fh, self.stateid, access=access, deny=OPEN4_SHARE_DENY_NONE) - self.stateid = res.stateid + self.stateid = res.stateid def close(self): self.client.close_file(self.owner, self.fh, self.stateid) def lock(self, type): self.client.lock_file(self.owner, self.fh, self.stateid, type=type) - def testOpenDowngradeSequence(t, env): """test complex upgrade/downgrade sequence diff --git a/nfs4.0/servertests/st_readdir.py b/nfs4.0/servertests/st_readdir.py index fb484b6..798b2d0 100644 --- a/nfs4.0/servertests/st_readdir.py +++ b/nfs4.0/servertests/st_readdir.py @@ -232,9 +232,9 @@ def testUnaccessibleDir(t, env): ops = c.use_obj(path) + [c.readdir()] res = c.compound(ops) if env.opts.uid == 0: - check(res, [NFS4_OK, NFS4ERR_ACCESS], "READDIR of directory with mode=0o000") + check(res, [NFS4_OK, NFS4ERR_ACCESS], "READDIR of directory with mode=0o000") else: - check(res, NFS4ERR_ACCESS, "READDIR of directory with mode=0o000") + check(res, NFS4ERR_ACCESS, "READDIR of directory with mode=0o000") def testUnaccessibleDirAttrs(t, env): """READDIR with (cfh) in unaccessible directory requesting attrs @@ -253,9 +253,9 @@ def testUnaccessibleDirAttrs(t, env): [c.readdir(attr_request=[FATTR4_RDATTR_ERROR, FATTR4_TYPE])] res = c.compound(ops) if env.opts.uid == 0: - check(res, [NFS4_OK, NFS4ERR_ACCESS], "READDIR of directory with mode=0o000") + check(res, [NFS4_OK, NFS4ERR_ACCESS], "READDIR of directory with mode=0o000") else: - check(res, NFS4ERR_ACCESS, "READDIR of directory with mode=0o000") + check(res, NFS4ERR_ACCESS, "READDIR of directory with mode=0o000") ########################################### diff --git a/nfs4.0/servertests/st_write.py b/nfs4.0/servertests/st_write.py index 4777e1b..5b48153 100644 --- a/nfs4.0/servertests/st_write.py +++ b/nfs4.0/servertests/st_write.py @@ -438,8 +438,8 @@ def testLargeReadWrite(t, env): check(res) data = res.resarray[-2].switch.switch.data if len(data) != len(writedata): - t.fail("READ returned %d bytes, expected %d" % - (len(data), len(writedata))) + t.fail("READ returned %d bytes, expected %d" % + (len(data), len(writedata))) if (data != '\0'*size): t.fail("READ returned unexpected data") res = c.read_file(fh, 0, size) diff --git a/nfs4.1/server41tests/__init__.py b/nfs4.1/server41tests/__init__.py index a38c314..47bdd79 100644 --- a/nfs4.1/server41tests/__init__.py +++ b/nfs4.1/server41tests/__init__.py @@ -7,7 +7,7 @@ __all__ = ["st_exchange_id.py", # draft 21 "st_secinfo_no_name.py", "st_secinfo.py", "st_sequence.py", - "st_trunking.py", + "st_trunking.py", "st_open.py", "st_delegation.py", "st_verify.py", @@ -22,6 +22,6 @@ __all__ = ["st_exchange_id.py", # draft 21 ## "st_debug.py", ## "st_loop", "st_current_stateid.py", - "st_sparse.py", + "st_sparse.py", "st_flex.py", ] diff --git a/nfs4.1/server41tests/environment.py b/nfs4.1/server41tests/environment.py index 3020371..360089e 100644 --- a/nfs4.1/server41tests/environment.py +++ b/nfs4.1/server41tests/environment.py @@ -471,12 +471,12 @@ def create_obj(sess, path, kind=NF4DIR, attrs={FATTR4_MODE:0o755}): def open_create_file(sess, owner, path=None, attrs={FATTR4_MODE: 0o644}, access=OPEN4_SHARE_ACCESS_BOTH, deny=OPEN4_SHARE_DENY_NONE, - mode=GUARDED4, verifier=None, - claim_type=CLAIM_NULL, - want_deleg=False, - deleg_type=None, - open_create=OPEN4_NOCREATE, - seqid=0, clientid=0): + mode=GUARDED4, verifier=None, + claim_type=CLAIM_NULL, + want_deleg=False, + deleg_type=None, + open_create=OPEN4_NOCREATE, + seqid=0, clientid=0): open_op = open_create_file_op(sess, owner, path, attrs, access, deny, mode, verifier, claim_type, want_deleg, deleg_type, open_create, seqid, clientid) @@ -486,12 +486,12 @@ def open_create_file(sess, owner, path=None, attrs={FATTR4_MODE: 0o644}, def open_create_file_op(sess, owner, path=None, attrs={FATTR4_MODE: 0o644}, access=OPEN4_SHARE_ACCESS_BOTH, deny=OPEN4_SHARE_DENY_NONE, - mode=GUARDED4, verifier=None, - claim_type=CLAIM_NULL, - want_deleg=False, - deleg_type=None, - open_create=OPEN4_NOCREATE, - seqid=0, clientid=0): + mode=GUARDED4, verifier=None, + claim_type=CLAIM_NULL, + want_deleg=False, + deleg_type=None, + open_create=OPEN4_NOCREATE, + seqid=0, clientid=0): # Set defaults if path is None: dir = sess.c.homedir diff --git a/nfs4.1/server41tests/st_current_stateid.py b/nfs4.1/server41tests/st_current_stateid.py index 792eee8..819dfb1 100644 --- a/nfs4.1/server41tests/st_current_stateid.py +++ b/nfs4.1/server41tests/st_current_stateid.py @@ -43,7 +43,7 @@ def testLockLockU(t, env): open_to_lock_owner = open_to_lock_owner4( 0, stateid, 0, lock_owner4(0, "lock1")) lock_owner = locker4(open_owner=open_to_lock_owner, new_lock_owner=True) lock_ops = [ op.lock(WRITE_LT, False, 0, NFS4_UINT64_MAX, lock_owner), - op.locku(WRITE_LT, 0, current_stateid, 0, NFS4_UINT64_MAX) ] + op.locku(WRITE_LT, 0, current_stateid, 0, NFS4_UINT64_MAX) ] res = sess1.compound([op.putfh(fh)] + lock_ops) check(res, NFS4_OK) res = close_file(sess1, fh, stateid=stateid) diff --git a/nfs4.1/server41tests/st_delegation.py b/nfs4.1/server41tests/st_delegation.py index c5959f6..cbabb85 100644 --- a/nfs4.1/server41tests/st_delegation.py +++ b/nfs4.1/server41tests/st_delegation.py @@ -27,8 +27,8 @@ def __create_file_with_deleg(sess, name, access): return (fh, deleg) def _create_file_with_deleg(sess, name, access): - fh, deleg = __create_file_with_deleg(sess, name, access) - return fh + fh, deleg = __create_file_with_deleg(sess, name, access) + return fh def _testDeleg(t, env, openaccess, want, breakaccess, sec = None, sec2 = None): recall = threading.Event() @@ -182,7 +182,7 @@ def testDelegRevocation(t, env): if res.status == NFS4_OK: break; check(res, [NFS4_OK, NFS4ERR_DELAY]) - # just to keep sess1 renewed. This is a bit fragile, as we + # just to keep sess1 renewed. This is a bit fragile, as we # depend on the above compound waiting no longer than the # server's lease period: res = sess1.compound([]) @@ -196,7 +196,7 @@ def testDelegRevocation(t, env): " sucess of open conflicting with delegation") flags &= ~SEQ4_STATUS_RECALLABLE_STATE_REVOKED if flags: - print("WARNING: unexpected status flag(s) 0x%x set" % flags); + print("WARNING: unexpected status flag(s) 0x%x set" % flags); res = sess1.update_seq_state(res, slot) res = sess1.compound([op.test_stateid([delegstateid])]) stateid_stat = res.resarray[0].tsr_status_codes[0] @@ -210,7 +210,7 @@ def testDelegRevocation(t, env): res = sess1.c.compound([seq_op]) flags = res.resarray[0].sr_status_flags if flags & SEQ4_STATUS_RECALLABLE_STATE_REVOKED: - fail("SEQ4_STATUS_RECALLABLE_STATE_REVOKED should be cleared after" - " FREE_STATEID") + fail("SEQ4_STATUS_RECALLABLE_STATE_REVOKED should be cleared after" + " FREE_STATEID") if flags & ~SEQ4_STATUS_RECALLABLE_STATE_REVOKED: print("WARNING: unexpected status flag(s) 0x%x set" % flags) diff --git a/nfs4.1/server41tests/st_destroy_session.py b/nfs4.1/server41tests/st_destroy_session.py index 466845d..c776617 100644 --- a/nfs4.1/server41tests/st_destroy_session.py +++ b/nfs4.1/server41tests/st_destroy_session.py @@ -97,7 +97,7 @@ def testDestroy3(t, env): recall.happened = True env.notify = recall.set # This is called after compound sent to queue def bad_post_hook(arg, env, res): - return None; + return None; def good_post_hook(arg, env, res): return res c = env.c1.new_client(env.testname(t)) diff --git a/nfs4.1/server41tests/st_flex.py b/nfs4.1/server41tests/st_flex.py index a14c926..35be489 100644 --- a/nfs4.1/server41tests/st_flex.py +++ b/nfs4.1/server41tests/st_flex.py @@ -50,7 +50,7 @@ def testStateid1(t, env): # From draft23 12.5.3 "After the layout stateid is established, # the server increments by one the value of the "seqid" in each # subsequent LAYOUTGET and LAYOUTRETURN response, - check_seqid(lo_stateid, i + 2) + check_seqid(lo_stateid, i + 2) res = close_file(sess, fh, stateid=open_stateid) check(res) diff --git a/nfs4.1/testmod.py b/nfs4.1/testmod.py index 0cb76da..6f576e2 100644 --- a/nfs4.1/testmod.py +++ b/nfs4.1/testmod.py @@ -222,8 +222,8 @@ class Test(object): environment.startUp() self.runtest(self, environment) self.result = self._pass_result - environment.clean_sessions() - environment.clean_clients() + environment.clean_sessions() + environment.clean_clients() except KeyboardInterrupt: raise except TestException as e: @@ -330,8 +330,8 @@ def _import_by_name(name): def parseversions(t): if len(t.vers_list) > 1: - raise RuntimeError("Test %s has invalid version range %s" - % (t.fullname, t.vers_list)) + raise RuntimeError("Test %s has invalid version range %s" + % (t.fullname, t.vers_list)) if len(t.vers_list) == 0: return (0, sys.maxsize) limits = t.vers_list[0].split("-") From patchwork Tue Jul 24 07:33:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jianhong Yin X-Patchwork-Id: 10541425 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4FEE517FD for ; Tue, 24 Jul 2018 07:34:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 380D62875C for ; Tue, 24 Jul 2018 07:34:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2CC2828761; Tue, 24 Jul 2018 07:34:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CB9D02875C for ; Tue, 24 Jul 2018 07:34:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388431AbeGXIje (ORCPT ); Tue, 24 Jul 2018 04:39:34 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:52738 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2388439AbeGXIje (ORCPT ); Tue, 24 Jul 2018 04:39:34 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8851B81A4EA7; Tue, 24 Jul 2018 07:34:27 +0000 (UTC) Received: from dhcp-12-115.nay.redhat.com (unknown [10.66.12.115]) by smtp.corp.redhat.com (Postfix) with ESMTP id F0DBE178B3; Tue, 24 Jul 2018 07:34:25 +0000 (UTC) From: jiyin@redhat.com To: bfields@redhat.com Cc: linux-nfs@vger.kernel.org, "Jianhong.Yin" Subject: [PATCH 18/24] pynfs: python3 support plan: fix 'TypeError: must be str, not bytes' Date: Tue, 24 Jul 2018 15:33:36 +0800 Message-Id: <20180724073342.5738-18-jiyin@redhat.com> In-Reply-To: <20180724073342.5738-1-jiyin@redhat.com> References: <20180724073342.5738-1-jiyin@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Tue, 24 Jul 2018 07:34:27 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Tue, 24 Jul 2018 07:34:27 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'jiyin@redhat.com' RCPT:'' Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: "Jianhong.Yin" Signed-off-by: Jianhong Yin --- 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) From patchwork Tue Jul 24 07:33:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jianhong Yin X-Patchwork-Id: 10541435 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1E80E9093 for ; Tue, 24 Jul 2018 07:34:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F1BA328759 for ; Tue, 24 Jul 2018 07:34:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E5BF42875E; Tue, 24 Jul 2018 07:34:36 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9836128759 for ; Tue, 24 Jul 2018 07:34:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388447AbeGXIjk (ORCPT ); Tue, 24 Jul 2018 04:39:40 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:54714 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2388442AbeGXIjk (ORCPT ); Tue, 24 Jul 2018 04:39:40 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B81EF8780F; Tue, 24 Jul 2018 07:34:29 +0000 (UTC) Received: from dhcp-12-115.nay.redhat.com (unknown [10.66.12.115]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2BD9C178B3; Tue, 24 Jul 2018 07:34:27 +0000 (UTC) From: jiyin@redhat.com To: bfields@redhat.com Cc: linux-nfs@vger.kernel.org, "Jianhong.Yin" Subject: [PATCH 19/24] pynfs: python3 support plan: fix import fail on python3 Date: Tue, 24 Jul 2018 15:33:37 +0800 Message-Id: <20180724073342.5738-19-jiyin@redhat.com> In-Reply-To: <20180724073342.5738-1-jiyin@redhat.com> References: <20180724073342.5738-1-jiyin@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Tue, 24 Jul 2018 07:34:29 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Tue, 24 Jul 2018 07:34:29 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'jiyin@redhat.com' RCPT:'' Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: "Jianhong.Yin" Signed-off-by: Jianhong Yin --- nfs4.0/servertests/environment.py | 2 +- nfs4.0/servertests/st_access.py | 2 +- nfs4.0/servertests/st_acl.py | 2 +- nfs4.0/servertests/st_close.py | 2 +- nfs4.0/servertests/st_commit.py | 2 +- nfs4.0/servertests/st_compound.py | 5 +++-- nfs4.0/servertests/st_create.py | 2 +- nfs4.0/servertests/st_delegation.py | 2 +- nfs4.0/servertests/st_fslocations.py | 2 +- nfs4.0/servertests/st_getattr.py | 2 +- nfs4.0/servertests/st_getfh.py | 2 +- nfs4.0/servertests/st_gss.py | 4 ++-- nfs4.0/servertests/st_link.py | 2 +- nfs4.0/servertests/st_lock.py | 2 +- nfs4.0/servertests/st_lockt.py | 2 +- nfs4.0/servertests/st_locku.py | 2 +- nfs4.0/servertests/st_lookup.py | 4 ++-- nfs4.0/servertests/st_lookupp.py | 2 +- nfs4.0/servertests/st_nverify.py | 2 +- nfs4.0/servertests/st_open.py | 2 +- nfs4.0/servertests/st_openconfirm.py | 2 +- nfs4.0/servertests/st_opendowngrade.py | 2 +- nfs4.0/servertests/st_putfh.py | 2 +- nfs4.0/servertests/st_putpubfh.py | 2 +- nfs4.0/servertests/st_putrootfh.py | 2 +- nfs4.0/servertests/st_read.py | 4 ++-- nfs4.0/servertests/st_readdir.py | 2 +- nfs4.0/servertests/st_readlink.py | 2 +- nfs4.0/servertests/st_reboot.py | 2 +- nfs4.0/servertests/st_releaselockowner.py | 2 +- nfs4.0/servertests/st_remove.py | 2 +- nfs4.0/servertests/st_rename.py | 2 +- nfs4.0/servertests/st_renew.py | 2 +- nfs4.0/servertests/st_replay.py | 2 +- nfs4.0/servertests/st_restorefh.py | 2 +- nfs4.0/servertests/st_savefh.py | 2 +- nfs4.0/servertests/st_secinfo.py | 2 +- nfs4.0/servertests/st_setattr.py | 2 +- nfs4.0/servertests/st_setclientid.py | 2 +- nfs4.0/servertests/st_setclientidconfirm.py | 2 +- nfs4.0/servertests/st_spoof.py | 2 +- nfs4.0/servertests/st_verify.py | 2 +- nfs4.0/servertests/st_write.py | 4 ++-- nfs4.0/testserver.py | 2 +- nfs4.1/client41tests/ct_reboot.py | 2 +- nfs4.1/client41tests/environment.py | 2 +- nfs4.1/dataserver.py | 2 +- nfs4.1/nfs3client.py | 2 +- nfs4.1/nfs4client.py | 2 +- nfs4.1/nfs4lib.py | 2 +- nfs4.1/nfs4proxy.py | 2 +- nfs4.1/nfs4server.py | 2 +- nfs4.1/nfs4state.py | 2 +- nfs4.1/server41tests/environment.py | 2 +- nfs4.1/server41tests/st_block.py | 2 +- nfs4.1/server41tests/st_compound.py | 2 +- nfs4.1/server41tests/st_create_session.py | 2 +- nfs4.1/server41tests/st_current_stateid.py | 4 ++-- nfs4.1/server41tests/st_debug.py | 2 +- nfs4.1/server41tests/st_delegation.py | 2 +- nfs4.1/server41tests/st_destroy_clientid.py | 2 +- nfs4.1/server41tests/st_destroy_session.py | 4 ++-- nfs4.1/server41tests/st_exchange_id.py | 2 +- nfs4.1/server41tests/st_flex.py | 2 +- nfs4.1/server41tests/st_getdevicelist.py | 2 +- nfs4.1/server41tests/st_lookup.py | 4 ++-- nfs4.1/server41tests/st_lookupp.py | 2 +- nfs4.1/server41tests/st_open.py | 4 ++-- nfs4.1/server41tests/st_putfh.py | 2 +- nfs4.1/server41tests/st_reboot.py | 2 +- nfs4.1/server41tests/st_reclaim_complete.py | 2 +- nfs4.1/server41tests/st_rename.py | 2 +- nfs4.1/server41tests/st_secinfo.py | 2 +- nfs4.1/server41tests/st_secinfo_no_name.py | 2 +- nfs4.1/server41tests/st_sequence.py | 2 +- nfs4.1/server41tests/st_sparse.py | 2 +- nfs4.1/server41tests/st_trunking.py | 2 +- nfs4.1/server41tests/st_verify.py | 2 +- nfs4.1/testclient.py | 2 +- nfs4.1/testserver.py | 2 +- rpc/rpc.py | 2 +- 81 files changed, 91 insertions(+), 90 deletions(-) diff --git a/nfs4.0/servertests/environment.py b/nfs4.0/servertests/environment.py index a5cfe60..4d85837 100644 --- a/nfs4.0/servertests/environment.py +++ b/nfs4.0/servertests/environment.py @@ -14,7 +14,7 @@ from nfs4lib import NFS4Client, get_attrbitnum_dict from xdrdef.nfs4_const import * from xdrdef.nfs4_type import fsid4, nfsace4, fs_locations4, fs_location4, \ specdata4, nfstime4, settime4, stateid4 -import rpc +import rpc.rpc as rpc import sys import os import nfs_ops diff --git a/nfs4.0/servertests/st_access.py b/nfs4.0/servertests/st_access.py index 58c42bc..0a16986 100644 --- a/nfs4.0/servertests/st_access.py +++ b/nfs4.0/servertests/st_access.py @@ -1,5 +1,5 @@ from xdrdef.nfs4_const import * -from environment import check +from .environment import check import nfs_ops op = nfs_ops.NFS4ops() diff --git a/nfs4.0/servertests/st_acl.py b/nfs4.0/servertests/st_acl.py index 88667d2..3194ebc 100644 --- a/nfs4.0/servertests/st_acl.py +++ b/nfs4.0/servertests/st_acl.py @@ -1,5 +1,5 @@ from xdrdef.nfs4_const import * -from environment import check +from .environment import check from xdrdef.nfs4_type import nfsace4 from nfs4lib import list2bitmap diff --git a/nfs4.0/servertests/st_close.py b/nfs4.0/servertests/st_close.py index 89ccbba..e0166f6 100644 --- a/nfs4.0/servertests/st_close.py +++ b/nfs4.0/servertests/st_close.py @@ -1,5 +1,5 @@ from xdrdef.nfs4_const import * -from environment import check, makeStaleId +from .environment import check, makeStaleId def testCloseCreate(t, env): diff --git a/nfs4.0/servertests/st_commit.py b/nfs4.0/servertests/st_commit.py index eecf2c8..9345424 100644 --- a/nfs4.0/servertests/st_commit.py +++ b/nfs4.0/servertests/st_commit.py @@ -1,5 +1,5 @@ from xdrdef.nfs4_const import * -from environment import check +from .environment import check _text = "Random data to write" diff --git a/nfs4.0/servertests/st_compound.py b/nfs4.0/servertests/st_compound.py index 59a279d..5225f61 100644 --- a/nfs4.0/servertests/st_compound.py +++ b/nfs4.0/servertests/st_compound.py @@ -1,8 +1,9 @@ from xdrdef.nfs4_const import * from xdrdef.nfs4_type import nfs_argop4 from xdrdef.nfs4_pack import NFS4Packer -from environment import check, get_invalid_utf8strings -from rpc import RPCError +from .environment import check, get_invalid_utf8strings +from rpc.rpc import RPCError + import nfs_ops op = nfs_ops.NFS4ops() diff --git a/nfs4.0/servertests/st_create.py b/nfs4.0/servertests/st_create.py index c7256e5..a43003b 100644 --- a/nfs4.0/servertests/st_create.py +++ b/nfs4.0/servertests/st_create.py @@ -1,6 +1,6 @@ from xdrdef.nfs4_const import * from xdrdef.nfs4_type import createtype4, specdata4 -from environment import check +from .environment import check import nfs_ops op = nfs_ops.NFS4ops() diff --git a/nfs4.0/servertests/st_delegation.py b/nfs4.0/servertests/st_delegation.py index 937d95f..0247151 100644 --- a/nfs4.0/servertests/st_delegation.py +++ b/nfs4.0/servertests/st_delegation.py @@ -1,6 +1,6 @@ from xdrdef.nfs4_const import * from xdrdef.nfs4_type import nfs_client_id4, clientaddr4, cb_client4 -from environment import check +from .environment import check import os import threading import time diff --git a/nfs4.0/servertests/st_fslocations.py b/nfs4.0/servertests/st_fslocations.py index 442d5a2..0387843 100644 --- a/nfs4.0/servertests/st_fslocations.py +++ b/nfs4.0/servertests/st_fslocations.py @@ -1,6 +1,6 @@ from xdrdef.nfs4_const import * from nfs4lib import list2bitmap -from environment import check +from .environment import check import nfs_ops op = nfs_ops.NFS4ops() diff --git a/nfs4.0/servertests/st_getattr.py b/nfs4.0/servertests/st_getattr.py index 65a5701..292fcd2 100644 --- a/nfs4.0/servertests/st_getattr.py +++ b/nfs4.0/servertests/st_getattr.py @@ -1,5 +1,5 @@ from xdrdef.nfs4_const import * -from environment import check +from .environment import check from nfs4lib import get_attr_name import nfs_ops op = nfs_ops.NFS4ops() diff --git a/nfs4.0/servertests/st_getfh.py b/nfs4.0/servertests/st_getfh.py index 6fd22e7..4abe320 100644 --- a/nfs4.0/servertests/st_getfh.py +++ b/nfs4.0/servertests/st_getfh.py @@ -1,5 +1,5 @@ from xdrdef.nfs4_const import * -from environment import check +from .environment import check import nfs_ops op = nfs_ops.NFS4ops() diff --git a/nfs4.0/servertests/st_gss.py b/nfs4.0/servertests/st_gss.py index 414883e..e10e849 100644 --- a/nfs4.0/servertests/st_gss.py +++ b/nfs4.0/servertests/st_gss.py @@ -1,7 +1,7 @@ from xdrdef.nfs4_const import * -from environment import check +from .environment import check from socket import timeout -import rpc +import rpc.rpc as rpc import rpc.rpcsec.gss_const as gss from rpc.rpcsec.gss_type import rpc_gss_cred_t import nfs_ops diff --git a/nfs4.0/servertests/st_link.py b/nfs4.0/servertests/st_link.py index feddf1e..0ef5009 100644 --- a/nfs4.0/servertests/st_link.py +++ b/nfs4.0/servertests/st_link.py @@ -1,5 +1,5 @@ from xdrdef.nfs4_const import * -from environment import check, get_invalid_utf8strings +from .environment import check, get_invalid_utf8strings import nfs_ops op = nfs_ops.NFS4ops() diff --git a/nfs4.0/servertests/st_lock.py b/nfs4.0/servertests/st_lock.py index 060236a..b815a54 100644 --- a/nfs4.0/servertests/st_lock.py +++ b/nfs4.0/servertests/st_lock.py @@ -1,6 +1,6 @@ from xdrdef.nfs4_const import * from xdrdef.nfs4_type import stateid4 -from environment import check, get_invalid_clientid, makeStaleId, makeBadIDganesha +from .environment import check, get_invalid_clientid, makeStaleId, makeBadIDganesha import time import nfs_ops op = nfs_ops.NFS4ops() diff --git a/nfs4.0/servertests/st_lockt.py b/nfs4.0/servertests/st_lockt.py index 7f8c5e1..ee0b825 100644 --- a/nfs4.0/servertests/st_lockt.py +++ b/nfs4.0/servertests/st_lockt.py @@ -1,5 +1,5 @@ from xdrdef.nfs4_const import * -from environment import check, get_invalid_clientid +from .environment import check, get_invalid_clientid def testUnlockedFile(t, env): """LOCKT on a regular unlocked file diff --git a/nfs4.0/servertests/st_locku.py b/nfs4.0/servertests/st_locku.py index 74b464a..3524a61 100644 --- a/nfs4.0/servertests/st_locku.py +++ b/nfs4.0/servertests/st_locku.py @@ -1,6 +1,6 @@ from xdrdef.nfs4_const import * from xdrdef.nfs4_type import stateid4 -from environment import check, makeStaleId +from .environment import check, makeStaleId def testFile(t, env): """LOCKU a regular file diff --git a/nfs4.0/servertests/st_lookup.py b/nfs4.0/servertests/st_lookup.py index eed7100..9bfaffe 100644 --- a/nfs4.0/servertests/st_lookup.py +++ b/nfs4.0/servertests/st_lookup.py @@ -1,6 +1,6 @@ from xdrdef.nfs4_const import * -from environment import check, get_invalid_utf8strings -import rpc +from .environment import check, get_invalid_utf8strings +import rpc.rpc as rpc import nfs_ops op = nfs_ops.NFS4ops() diff --git a/nfs4.0/servertests/st_lookupp.py b/nfs4.0/servertests/st_lookupp.py index 13c1553..7c38600 100644 --- a/nfs4.0/servertests/st_lookupp.py +++ b/nfs4.0/servertests/st_lookupp.py @@ -1,5 +1,5 @@ from xdrdef.nfs4_const import * -from environment import check, get_invalid_utf8strings +from .environment import check, get_invalid_utf8strings import nfs_ops op = nfs_ops.NFS4ops() diff --git a/nfs4.0/servertests/st_nverify.py b/nfs4.0/servertests/st_nverify.py index 4185970..e2a8130 100644 --- a/nfs4.0/servertests/st_nverify.py +++ b/nfs4.0/servertests/st_nverify.py @@ -1,5 +1,5 @@ from xdrdef.nfs4_const import * -from environment import check, get_invalid_clientid, makeStaleId +from .environment import check, get_invalid_clientid, makeStaleId import nfs_ops op = nfs_ops.NFS4ops() diff --git a/nfs4.0/servertests/st_open.py b/nfs4.0/servertests/st_open.py index b4af81c..9f5d1aa 100644 --- a/nfs4.0/servertests/st_open.py +++ b/nfs4.0/servertests/st_open.py @@ -1,5 +1,5 @@ from xdrdef.nfs4_const import * -from environment import check, checkdict, get_invalid_utf8strings +from .environment import check, checkdict, get_invalid_utf8strings from nfs4lib import get_bitnumattr_dict # Any test that uses create_confirm should depend on this test diff --git a/nfs4.0/servertests/st_openconfirm.py b/nfs4.0/servertests/st_openconfirm.py index 3b5b98f..631855a 100644 --- a/nfs4.0/servertests/st_openconfirm.py +++ b/nfs4.0/servertests/st_openconfirm.py @@ -1,6 +1,6 @@ from xdrdef.nfs4_const import * from xdrdef.nfs4_type import stateid4 -from environment import check, makeStaleId +from .environment import check, makeStaleId import nfs_ops op = nfs_ops.NFS4ops() diff --git a/nfs4.0/servertests/st_opendowngrade.py b/nfs4.0/servertests/st_opendowngrade.py index 213b2dd..2180223 100644 --- a/nfs4.0/servertests/st_opendowngrade.py +++ b/nfs4.0/servertests/st_opendowngrade.py @@ -1,5 +1,5 @@ from xdrdef.nfs4_const import * -from environment import check, makeStaleId +from .environment import check, makeStaleId def testRegularOpen(t, env): """OPENDOWNGRADE on regular file diff --git a/nfs4.0/servertests/st_putfh.py b/nfs4.0/servertests/st_putfh.py index ba9ce27..6560f2e 100644 --- a/nfs4.0/servertests/st_putfh.py +++ b/nfs4.0/servertests/st_putfh.py @@ -1,5 +1,5 @@ from xdrdef.nfs4_const import * -from environment import check +from .environment import check import nfs_ops op = nfs_ops.NFS4ops() diff --git a/nfs4.0/servertests/st_putpubfh.py b/nfs4.0/servertests/st_putpubfh.py index 0149b9d..1514fde 100644 --- a/nfs4.0/servertests/st_putpubfh.py +++ b/nfs4.0/servertests/st_putpubfh.py @@ -1,5 +1,5 @@ from xdrdef.nfs4_const import * -from environment import check +from .environment import check import nfs_ops op = nfs_ops.NFS4ops() diff --git a/nfs4.0/servertests/st_putrootfh.py b/nfs4.0/servertests/st_putrootfh.py index dd47f58..b13c694 100644 --- a/nfs4.0/servertests/st_putrootfh.py +++ b/nfs4.0/servertests/st_putrootfh.py @@ -1,5 +1,5 @@ from xdrdef.nfs4_const import * -from environment import check +from .environment import check import nfs_ops op = nfs_ops.NFS4ops() diff --git a/nfs4.0/servertests/st_read.py b/nfs4.0/servertests/st_read.py index 15f8795..1eb996c 100644 --- a/nfs4.0/servertests/st_read.py +++ b/nfs4.0/servertests/st_read.py @@ -1,6 +1,6 @@ from xdrdef.nfs4_const import * -from environment import check, makeBadID, makeBadIDganesha, makeStaleId -import rpc +from .environment import check, makeBadID, makeBadIDganesha, makeStaleId +import rpc.rpc as rpc def _compare(t, res, expect, eof=True): def shorten(str): diff --git a/nfs4.0/servertests/st_readdir.py b/nfs4.0/servertests/st_readdir.py index 798b2d0..b9a8a4d 100644 --- a/nfs4.0/servertests/st_readdir.py +++ b/nfs4.0/servertests/st_readdir.py @@ -1,6 +1,6 @@ from xdrdef.nfs4_const import * from nfs4lib import get_attr_name -from environment import check +from .environment import check def _compare(t, entries, expect, attrlist=[]): names = [e.name for e in entries] diff --git a/nfs4.0/servertests/st_readlink.py b/nfs4.0/servertests/st_readlink.py index 8b905d0..d8e3ea1 100644 --- a/nfs4.0/servertests/st_readlink.py +++ b/nfs4.0/servertests/st_readlink.py @@ -1,5 +1,5 @@ from xdrdef.nfs4_const import * -from environment import check +from .environment import check import nfs_ops op = nfs_ops.NFS4ops() diff --git a/nfs4.0/servertests/st_reboot.py b/nfs4.0/servertests/st_reboot.py index 16cb008..2a03e60 100644 --- a/nfs4.0/servertests/st_reboot.py +++ b/nfs4.0/servertests/st_reboot.py @@ -1,5 +1,5 @@ from xdrdef.nfs4_const import * -from environment import check +from .environment import check import os import nfs_ops op = nfs_ops.NFS4ops() diff --git a/nfs4.0/servertests/st_releaselockowner.py b/nfs4.0/servertests/st_releaselockowner.py index 17dfe1a..8021ddf 100644 --- a/nfs4.0/servertests/st_releaselockowner.py +++ b/nfs4.0/servertests/st_releaselockowner.py @@ -1,6 +1,6 @@ from xdrdef.nfs4_const import * from xdrdef.nfs4_type import lock_owner4 -from environment import check +from .environment import check import nfs_ops op = nfs_ops.NFS4ops() diff --git a/nfs4.0/servertests/st_remove.py b/nfs4.0/servertests/st_remove.py index 5f531f4..a9c397f 100644 --- a/nfs4.0/servertests/st_remove.py +++ b/nfs4.0/servertests/st_remove.py @@ -1,5 +1,5 @@ from xdrdef.nfs4_const import * -from environment import check, get_invalid_utf8strings +from .environment import check, get_invalid_utf8strings import nfs_ops op = nfs_ops.NFS4ops() diff --git a/nfs4.0/servertests/st_rename.py b/nfs4.0/servertests/st_rename.py index 8f41763..3a7fa1e 100644 --- a/nfs4.0/servertests/st_rename.py +++ b/nfs4.0/servertests/st_rename.py @@ -1,5 +1,5 @@ from xdrdef.nfs4_const import * -from environment import check, get_invalid_utf8strings +from .environment import check, get_invalid_utf8strings import nfs_ops op = nfs_ops.NFS4ops() diff --git a/nfs4.0/servertests/st_renew.py b/nfs4.0/servertests/st_renew.py index 3a9f774..679363c 100644 --- a/nfs4.0/servertests/st_renew.py +++ b/nfs4.0/servertests/st_renew.py @@ -1,5 +1,5 @@ from xdrdef.nfs4_const import * -from environment import check +from .environment import check import nfs_ops op = nfs_ops.NFS4ops() diff --git a/nfs4.0/servertests/st_replay.py b/nfs4.0/servertests/st_replay.py index 81b8332..3eba563 100644 --- a/nfs4.0/servertests/st_replay.py +++ b/nfs4.0/servertests/st_replay.py @@ -1,5 +1,5 @@ from xdrdef.nfs4_const import * -from environment import check +from .environment import check from xdrdef.nfs4_type import * import nfs_ops op = nfs_ops.NFS4ops() diff --git a/nfs4.0/servertests/st_restorefh.py b/nfs4.0/servertests/st_restorefh.py index 839079f..e5db09a 100644 --- a/nfs4.0/servertests/st_restorefh.py +++ b/nfs4.0/servertests/st_restorefh.py @@ -1,5 +1,5 @@ from xdrdef.nfs4_const import * -from environment import check +from .environment import check import nfs_ops op = nfs_ops.NFS4ops() diff --git a/nfs4.0/servertests/st_savefh.py b/nfs4.0/servertests/st_savefh.py index eef810c..c574718 100644 --- a/nfs4.0/servertests/st_savefh.py +++ b/nfs4.0/servertests/st_savefh.py @@ -1,5 +1,5 @@ from xdrdef.nfs4_const import * -from environment import check +from .environment import check import nfs_ops op = nfs_ops.NFS4ops() diff --git a/nfs4.0/servertests/st_secinfo.py b/nfs4.0/servertests/st_secinfo.py index eb874b1..6c828bf 100644 --- a/nfs4.0/servertests/st_secinfo.py +++ b/nfs4.0/servertests/st_secinfo.py @@ -1,5 +1,5 @@ from xdrdef.nfs4_const import * -from environment import check, get_invalid_utf8strings +from .environment import check, get_invalid_utf8strings import nfs_ops op = nfs_ops.NFS4ops() diff --git a/nfs4.0/servertests/st_setattr.py b/nfs4.0/servertests/st_setattr.py index aa7123b..edf8caa 100644 --- a/nfs4.0/servertests/st_setattr.py +++ b/nfs4.0/servertests/st_setattr.py @@ -1,5 +1,5 @@ from xdrdef.nfs4_const import * -from environment import check, get_invalid_utf8strings +from .environment import check, get_invalid_utf8strings from nfs4lib import bitmap2list, dict2fattr from xdrdef.nfs4_type import nfstime4, settime4 import nfs_ops diff --git a/nfs4.0/servertests/st_setclientid.py b/nfs4.0/servertests/st_setclientid.py index 7f42d2d..6ad91f8 100644 --- a/nfs4.0/servertests/st_setclientid.py +++ b/nfs4.0/servertests/st_setclientid.py @@ -1,5 +1,5 @@ from xdrdef.nfs4_const import * -from environment import check +from .environment import check import os import struct, time import nfs_ops diff --git a/nfs4.0/servertests/st_setclientidconfirm.py b/nfs4.0/servertests/st_setclientidconfirm.py index 51f7981..4ecf635 100644 --- a/nfs4.0/servertests/st_setclientidconfirm.py +++ b/nfs4.0/servertests/st_setclientidconfirm.py @@ -1,5 +1,5 @@ from xdrdef.nfs4_const import * -from environment import check +from .environment import check import os import nfs_ops op = nfs_ops.NFS4ops() diff --git a/nfs4.0/servertests/st_spoof.py b/nfs4.0/servertests/st_spoof.py index 777985e..68778d4 100644 --- a/nfs4.0/servertests/st_spoof.py +++ b/nfs4.0/servertests/st_spoof.py @@ -1,5 +1,5 @@ from xdrdef.nfs4_const import * -from environment import check +from .environment import check def testSpoofUser(t, env): """SPOOF test, try to spoof user diff --git a/nfs4.0/servertests/st_verify.py b/nfs4.0/servertests/st_verify.py index 219d0a0..16d7c0c 100644 --- a/nfs4.0/servertests/st_verify.py +++ b/nfs4.0/servertests/st_verify.py @@ -1,5 +1,5 @@ from xdrdef.nfs4_const import * -from environment import check, get_invalid_clientid, makeStaleId +from .environment import check, get_invalid_clientid, makeStaleId import nfs_ops op = nfs_ops.NFS4ops() diff --git a/nfs4.0/servertests/st_write.py b/nfs4.0/servertests/st_write.py index 5b48153..70ff49e 100644 --- a/nfs4.0/servertests/st_write.py +++ b/nfs4.0/servertests/st_write.py @@ -1,8 +1,8 @@ from xdrdef.nfs4_const import * from xdrdef.nfs4_type import * -from environment import check, compareTimes, makeBadID, makeBadIDganesha, makeStaleId +from .environment import check, compareTimes, makeBadID, makeBadIDganesha, makeStaleId import struct -import rpc +import rpc.rpc as rpc import nfs_ops op = nfs_ops.NFS4ops() diff --git a/nfs4.0/testserver.py b/nfs4.0/testserver.py index 581dc3e..ebce58d 100755 --- a/nfs4.0/testserver.py +++ b/nfs4.0/testserver.py @@ -40,7 +40,7 @@ import testmod from optparse import OptionParser, OptionGroup, IndentedHelpFormatter import servertests.environment as environment import socket -import rpc +import rpc.rpc as rpc import pickle VERSION="0.2" # How/when update this? diff --git a/nfs4.1/client41tests/ct_reboot.py b/nfs4.1/client41tests/ct_reboot.py index 3bd241b..efbd74e 100644 --- a/nfs4.1/client41tests/ct_reboot.py +++ b/nfs4.1/client41tests/ct_reboot.py @@ -1,5 +1,5 @@ import os -from environment import fail +from .environment import fail def testReboot(t, env): """Test reboot diff --git a/nfs4.1/client41tests/environment.py b/nfs4.1/client41tests/environment.py index 933264c..09d07c2 100644 --- a/nfs4.1/client41tests/environment.py +++ b/nfs4.1/client41tests/environment.py @@ -12,7 +12,7 @@ import time import testmod from xdrdef.nfs4_const import * from xdrdef.nfs4_type import * -import rpc +import rpc.rpc as rpc import nfs4client import os import nfs4lib diff --git a/nfs4.1/dataserver.py b/nfs4.1/dataserver.py index af0e35a..f76ca5a 100644 --- a/nfs4.1/dataserver.py +++ b/nfs4.1/dataserver.py @@ -1,4 +1,4 @@ -import rpc +import rpc.rpc as rpc import nfs4lib import xdrdef.nfs4_type as type4 from xdrdef.nfs4_pack import NFS4Packer diff --git a/nfs4.1/nfs3client.py b/nfs4.1/nfs3client.py index 176765c..f98f691 100644 --- a/nfs4.1/nfs3client.py +++ b/nfs4.1/nfs3client.py @@ -1,5 +1,5 @@ import use_local # HACK so don't have to rebuild constantly -import rpc +import rpc.rpc as rpc import nfs4lib #from nfs4lib import NFS4Error, NFS4Replay, inc_u32 from xdrdef.sctrl_pack import SCTRLPacker, SCTRLUnpacker diff --git a/nfs4.1/nfs4client.py b/nfs4.1/nfs4client.py index 0588d7b..e8c649b 100644 --- a/nfs4.1/nfs4client.py +++ b/nfs4.1/nfs4client.py @@ -1,5 +1,5 @@ import use_local # HACK so don't have to rebuild constantly -import rpc +import rpc.rpc as rpc import nfs4lib from nfs4lib import NFS4Error, NFS4Replay, inc_u32 from xdrdef.nfs4_type import * diff --git a/nfs4.1/nfs4lib.py b/nfs4.1/nfs4lib.py index 20eae0f..d46706a 100644 --- a/nfs4.1/nfs4lib.py +++ b/nfs4.1/nfs4lib.py @@ -1,5 +1,5 @@ from __future__ import with_statement -import rpc +import rpc.rpc as rpc import xdrdef.nfs4_const from xdrdef.nfs4_pack import NFS4Packer, NFS4Unpacker import xdrdef.nfs4_type diff --git a/nfs4.1/nfs4proxy.py b/nfs4.1/nfs4proxy.py index efb6744..dc8fdd4 100755 --- a/nfs4.1/nfs4proxy.py +++ b/nfs4.1/nfs4proxy.py @@ -3,7 +3,7 @@ from __future__ import with_statement import use_local # HACK so don't have to rebuild constantly import nfs4lib from nfs4lib import inc_u32, NFS4Error, NFS4Replay -import rpc +import rpc.rpc as rpc from xdrdef.nfs4_const import * from xdrdef.nfs4_type import * from xdrdef.sctrl_pack import SCTRLPacker, SCTRLUnpacker diff --git a/nfs4.1/nfs4server.py b/nfs4.1/nfs4server.py index cd78082..767319d 100755 --- a/nfs4.1/nfs4server.py +++ b/nfs4.1/nfs4server.py @@ -3,7 +3,7 @@ from __future__ import with_statement import use_local # HACK so don't have to rebuild constantly import nfs4lib from nfs4lib import inc_u32, NFS4Error, NFS4Replay -import rpc +import rpc.rpc as rpc from xdrdef.nfs4_const import * from xdrdef.nfs4_type import * from xdrdef.sctrl_pack import SCTRLPacker, SCTRLUnpacker diff --git a/nfs4.1/nfs4state.py b/nfs4.1/nfs4state.py index 95f84df..f2cad04 100644 --- a/nfs4.1/nfs4state.py +++ b/nfs4.1/nfs4state.py @@ -9,7 +9,7 @@ from nfs4lib import NFS4Error from xdrdef.nfs4_type import * from xdrdef.nfs4_const import * import nfs_ops -import rpc +import rpc.rpc as rpc import logging log = logging.getLogger("nfs.server.state") diff --git a/nfs4.1/server41tests/environment.py b/nfs4.1/server41tests/environment.py index 360089e..9e1201f 100644 --- a/nfs4.1/server41tests/environment.py +++ b/nfs4.1/server41tests/environment.py @@ -12,7 +12,7 @@ import time import testmod from xdrdef.nfs4_const import * from xdrdef.nfs4_type import * -import rpc +import rpc.rpc as rpc import nfs4client import sys import os diff --git a/nfs4.1/server41tests/st_block.py b/nfs4.1/server41tests/st_block.py index 2041de3..3cfc1c6 100644 --- a/nfs4.1/server41tests/st_block.py +++ b/nfs4.1/server41tests/st_block.py @@ -2,7 +2,7 @@ from xdrdef.nfs4_const import * from xdrdef.nfs4_type import * import nfs_ops op = nfs_ops.NFS4ops() -from environment import check, fail, create_file +from .environment import check, fail, create_file from block import Packer as BlockPacker, Unpacker as BlockUnpacker, \ PNFS_BLOCK_READWRITE_DATA, pnfs_block_layoutupdate4, \ pnfs_block_extent4 diff --git a/nfs4.1/server41tests/st_compound.py b/nfs4.1/server41tests/st_compound.py index 3915dd8..ded5465 100644 --- a/nfs4.1/server41tests/st_compound.py +++ b/nfs4.1/server41tests/st_compound.py @@ -1,7 +1,7 @@ from xdrdef.nfs4_const import * import nfs_ops op = nfs_ops.NFS4ops() -from environment import check, fail, get_invalid_utf8strings +from .environment import check, fail, get_invalid_utf8strings from xdrdef.nfs4_type import * from rpc import RPCAcceptError, GARBAGE_ARGS, RPCTimeout from nfs4lib import NFS4Error, hash_oids, encrypt_oids, FancyNFS4Packer diff --git a/nfs4.1/server41tests/st_create_session.py b/nfs4.1/server41tests/st_create_session.py index 5018ec6..a638990 100644 --- a/nfs4.1/server41tests/st_create_session.py +++ b/nfs4.1/server41tests/st_create_session.py @@ -1,7 +1,7 @@ from xdrdef.nfs4_const import * import nfs_ops op = nfs_ops.NFS4ops() -from environment import check, fail, create_file, open_file +from .environment import check, fail, create_file, open_file from xdrdef.nfs4_type import * import random import nfs4lib diff --git a/nfs4.1/server41tests/st_current_stateid.py b/nfs4.1/server41tests/st_current_stateid.py index 819dfb1..58f6e9b 100644 --- a/nfs4.1/server41tests/st_current_stateid.py +++ b/nfs4.1/server41tests/st_current_stateid.py @@ -1,8 +1,8 @@ from st_create_session import create_session from xdrdef.nfs4_const import * -from environment import check, fail, create_file, open_file, close_file -from environment import open_create_file_op, use_obj +from .environment import check, fail, create_file, open_file, close_file +from .environment import open_create_file_op, use_obj from xdrdef.nfs4_type import open_owner4, openflag4, createhow4, open_claim4 from xdrdef.nfs4_type import creatverfattr, fattr4, stateid4, locker4, lock_owner4 from xdrdef.nfs4_type import open_to_lock_owner4 diff --git a/nfs4.1/server41tests/st_debug.py b/nfs4.1/server41tests/st_debug.py index 345fc77..3e3087d 100644 --- a/nfs4.1/server41tests/st_debug.py +++ b/nfs4.1/server41tests/st_debug.py @@ -1,6 +1,6 @@ from st_create_session import create_session from xdrdef.nfs4_const import * -from environment import check, fail, create_file, close_file +from .environment import check, fail, create_file, close_file from xdrdef.nfs4_type import open_owner4, openflag4, createhow4, open_claim4 import nfs_ops op = nfs_ops.NFS4ops() diff --git a/nfs4.1/server41tests/st_delegation.py b/nfs4.1/server41tests/st_delegation.py index cbabb85..4f05bf1 100644 --- a/nfs4.1/server41tests/st_delegation.py +++ b/nfs4.1/server41tests/st_delegation.py @@ -2,7 +2,7 @@ from st_create_session import create_session from st_open import open_claim4 from xdrdef.nfs4_const import * -from environment import check, fail, create_file, open_file, close_file +from .environment import check, fail, create_file, open_file, close_file from xdrdef.nfs4_type import * import nfs_ops op = nfs_ops.NFS4ops() diff --git a/nfs4.1/server41tests/st_destroy_clientid.py b/nfs4.1/server41tests/st_destroy_clientid.py index 25cc12a..50081b1 100644 --- a/nfs4.1/server41tests/st_destroy_clientid.py +++ b/nfs4.1/server41tests/st_destroy_clientid.py @@ -1,6 +1,6 @@ from st_create_session import create_session from xdrdef.nfs4_const import * -from environment import check, fail +from .environment import check, fail import nfs_ops op = nfs_ops.NFS4ops() import nfs4lib diff --git a/nfs4.1/server41tests/st_destroy_session.py b/nfs4.1/server41tests/st_destroy_session.py index c776617..c80c845 100644 --- a/nfs4.1/server41tests/st_destroy_session.py +++ b/nfs4.1/server41tests/st_destroy_session.py @@ -1,11 +1,11 @@ from st_create_session import create_session from xdrdef.nfs4_const import * -from environment import check, fail, create_file, open_file +from .environment import check, fail, create_file, open_file from xdrdef.nfs4_type import open_owner4, openflag4, createhow4, open_claim4 import nfs_ops op = nfs_ops.NFS4ops() import threading -import rpc +import rpc.rpc as rpc def testDestroy(t, env): """ diff --git a/nfs4.1/server41tests/st_exchange_id.py b/nfs4.1/server41tests/st_exchange_id.py index 9becec6..5a29634 100644 --- a/nfs4.1/server41tests/st_exchange_id.py +++ b/nfs4.1/server41tests/st_exchange_id.py @@ -2,7 +2,7 @@ from xdrdef.nfs4_const import * import nfs_ops op = nfs_ops.NFS4ops() import time -from environment import check, fail +from .environment import check, fail from xdrdef.nfs4_type import * from rpc import RPCAcceptError, GARBAGE_ARGS, RPCTimeout from nfs4lib import NFS4Error, hash_oids, encrypt_oids diff --git a/nfs4.1/server41tests/st_flex.py b/nfs4.1/server41tests/st_flex.py index 35be489..335b2c8 100644 --- a/nfs4.1/server41tests/st_flex.py +++ b/nfs4.1/server41tests/st_flex.py @@ -3,7 +3,7 @@ from xdrdef.nfs4_type import * from xdrdef.nfs4_pack import * import nfs_ops op = nfs_ops.NFS4ops() -from environment import check, fail, create_file, close_file, open_create_file_op +from .environment import check, fail, create_file, close_file, open_create_file_op from xdrdef.nfs4_pack import NFS4Packer as FlexPacker, \ NFS4Unpacker as FlexUnpacker from nfs4lib import FancyNFS4Packer, get_nfstime diff --git a/nfs4.1/server41tests/st_getdevicelist.py b/nfs4.1/server41tests/st_getdevicelist.py index edf5fe4..aff510e 100644 --- a/nfs4.1/server41tests/st_getdevicelist.py +++ b/nfs4.1/server41tests/st_getdevicelist.py @@ -1,6 +1,6 @@ from xdrdef.nfs4_const import * from xdrdef.nfs4_type import * -from environment import check, fail, use_obj, open_file, create_file, get_blocksize +from .environment import check, fail, use_obj, open_file, create_file, get_blocksize import nfs_ops op = nfs_ops.NFS4ops() from block import Packer as BlockPacker, Unpacker as BlockUnpacker, \ diff --git a/nfs4.1/server41tests/st_lookup.py b/nfs4.1/server41tests/st_lookup.py index 3899425..c46e7d2 100644 --- a/nfs4.1/server41tests/st_lookup.py +++ b/nfs4.1/server41tests/st_lookup.py @@ -1,5 +1,5 @@ from xdrdef.nfs4_const import * -from environment import check, fail +from .environment import check, fail import nfs_ops op = nfs_ops.NFS4ops() @@ -64,7 +64,7 @@ def testLongName(t, env): ############################################################## if 0: - from environment import check, get_invalid_utf8strings + from .environment import check, get_invalid_utf8strings def testDir(t, env): """LOOKUP testtree dir diff --git a/nfs4.1/server41tests/st_lookupp.py b/nfs4.1/server41tests/st_lookupp.py index 4c863a4..c91e39e 100644 --- a/nfs4.1/server41tests/st_lookupp.py +++ b/nfs4.1/server41tests/st_lookupp.py @@ -1,5 +1,5 @@ from xdrdef.nfs4_const import * -from environment import check, fail, use_obj +from .environment import check, fail, use_obj import nfs_ops op = nfs_ops.NFS4ops() diff --git a/nfs4.1/server41tests/st_open.py b/nfs4.1/server41tests/st_open.py index 473732d..ceca656 100644 --- a/nfs4.1/server41tests/st_open.py +++ b/nfs4.1/server41tests/st_open.py @@ -1,8 +1,8 @@ from st_create_session import create_session from xdrdef.nfs4_const import * -from environment import check, fail, create_file, open_file, close_file -from environment import open_create_file_op +from .environment import check, fail, create_file, open_file, close_file +from .environment import open_create_file_op from xdrdef.nfs4_type import open_owner4, openflag4, createhow4, open_claim4 from xdrdef.nfs4_type import creatverfattr, fattr4, stateid4, locker4, lock_owner4 from xdrdef.nfs4_type import open_to_lock_owner4 diff --git a/nfs4.1/server41tests/st_putfh.py b/nfs4.1/server41tests/st_putfh.py index e1d6320..f8bfa71 100644 --- a/nfs4.1/server41tests/st_putfh.py +++ b/nfs4.1/server41tests/st_putfh.py @@ -1,5 +1,5 @@ from xdrdef.nfs4_const import * -from environment import check, fail, use_obj, create_confirm, close_file +from .environment import check, fail, use_obj, create_confirm, close_file import nfs_ops op = nfs_ops.NFS4ops() diff --git a/nfs4.1/server41tests/st_reboot.py b/nfs4.1/server41tests/st_reboot.py index b19c343..b852ded 100644 --- a/nfs4.1/server41tests/st_reboot.py +++ b/nfs4.1/server41tests/st_reboot.py @@ -1,6 +1,6 @@ from xdrdef.nfs4_const import * from xdrdef.nfs4_type import * -from environment import check, fail, create_file, open_file, create_confirm +from .environment import check, fail, create_file, open_file, create_confirm import sys import os import nfs4lib diff --git a/nfs4.1/server41tests/st_reclaim_complete.py b/nfs4.1/server41tests/st_reclaim_complete.py index 642ada2..ee51843 100644 --- a/nfs4.1/server41tests/st_reclaim_complete.py +++ b/nfs4.1/server41tests/st_reclaim_complete.py @@ -1,6 +1,6 @@ from st_create_session import create_session from xdrdef.nfs4_const import * -from environment import check, fail, open_file, create_file, create_confirm +from .environment import check, fail, open_file, create_file, create_confirm import nfs_ops op = nfs_ops.NFS4ops() import nfs4lib diff --git a/nfs4.1/server41tests/st_rename.py b/nfs4.1/server41tests/st_rename.py index c7c2c20..3042909 100644 --- a/nfs4.1/server41tests/st_rename.py +++ b/nfs4.1/server41tests/st_rename.py @@ -1,5 +1,5 @@ from xdrdef.nfs4_const import * -from environment import check, fail, maketree, rename_obj, get_invalid_utf8strings, create_obj, create_confirm, link, use_obj, create_file +from .environment import check, fail, maketree, rename_obj, get_invalid_utf8strings, create_obj, create_confirm, link, use_obj, create_file import nfs_ops op = nfs_ops.NFS4ops() from xdrdef.nfs4_type import * diff --git a/nfs4.1/server41tests/st_secinfo.py b/nfs4.1/server41tests/st_secinfo.py index 008dc1e..d7f9557 100644 --- a/nfs4.1/server41tests/st_secinfo.py +++ b/nfs4.1/server41tests/st_secinfo.py @@ -1,6 +1,6 @@ from st_create_session import create_session from xdrdef.nfs4_const import * -from environment import check, fail, use_obj, bad_sessionid, create_file +from .environment import check, fail, use_obj, bad_sessionid, create_file from xdrdef.nfs4_type import channel_attrs4 import nfs_ops op = nfs_ops.NFS4ops() diff --git a/nfs4.1/server41tests/st_secinfo_no_name.py b/nfs4.1/server41tests/st_secinfo_no_name.py index 9cd6bd3..a044940 100644 --- a/nfs4.1/server41tests/st_secinfo_no_name.py +++ b/nfs4.1/server41tests/st_secinfo_no_name.py @@ -1,6 +1,6 @@ from st_create_session import create_session from xdrdef.nfs4_const import * -from environment import check, fail, bad_sessionid, create_file +from .environment import check, fail, bad_sessionid, create_file from xdrdef.nfs4_type import channel_attrs4 import nfs_ops op = nfs_ops.NFS4ops() diff --git a/nfs4.1/server41tests/st_sequence.py b/nfs4.1/server41tests/st_sequence.py index 25e5113..208160f 100644 --- a/nfs4.1/server41tests/st_sequence.py +++ b/nfs4.1/server41tests/st_sequence.py @@ -1,6 +1,6 @@ from st_create_session import create_session from xdrdef.nfs4_const import * -from environment import check, fail, bad_sessionid, create_file +from .environment import check, fail, bad_sessionid, create_file from xdrdef.nfs4_type import channel_attrs4 import nfs_ops op = nfs_ops.NFS4ops() diff --git a/nfs4.1/server41tests/st_sparse.py b/nfs4.1/server41tests/st_sparse.py index 6adf3d6..06be19e 100644 --- a/nfs4.1/server41tests/st_sparse.py +++ b/nfs4.1/server41tests/st_sparse.py @@ -1,6 +1,6 @@ from st_create_session import create_session from xdrdef.nfs4_const import * -from environment import check, fail, create_file +from .environment import check, fail, create_file import nfs_ops op = nfs_ops.NFS4ops() import nfs4lib diff --git a/nfs4.1/server41tests/st_trunking.py b/nfs4.1/server41tests/st_trunking.py index 684423d..72afa1f 100644 --- a/nfs4.1/server41tests/st_trunking.py +++ b/nfs4.1/server41tests/st_trunking.py @@ -1,7 +1,7 @@ from xdrdef.nfs4_const import * import nfs_ops op = nfs_ops.NFS4ops() -from environment import check, fail +from .environment import check, fail from xdrdef.nfs4_type import * import random import nfs4lib diff --git a/nfs4.1/server41tests/st_verify.py b/nfs4.1/server41tests/st_verify.py index 7fb8a47..64d6156 100644 --- a/nfs4.1/server41tests/st_verify.py +++ b/nfs4.1/server41tests/st_verify.py @@ -1,7 +1,7 @@ from xdrdef.nfs4_const import * import nfs_ops op = nfs_ops.NFS4ops() -from environment import check, get_invalid_clientid, makeStaleId, \ +from .environment import check, get_invalid_clientid, makeStaleId, \ do_getattrdict, use_obj def _try_mand(t, env, path): diff --git a/nfs4.1/testclient.py b/nfs4.1/testclient.py index 3665253..5d21eaa 100755 --- a/nfs4.1/testclient.py +++ b/nfs4.1/testclient.py @@ -33,7 +33,7 @@ import testmod from optparse import OptionParser, OptionGroup, IndentedHelpFormatter import client41tests.environment as environment import socket -import rpc +import rpc.rpc as rpc import pickle def parse_useparams(str): diff --git a/nfs4.1/testserver.py b/nfs4.1/testserver.py index 7818a5d..2becc13 100755 --- a/nfs4.1/testserver.py +++ b/nfs4.1/testserver.py @@ -37,7 +37,7 @@ import testmod from optparse import OptionParser, OptionGroup, IndentedHelpFormatter import server41tests.environment as environment import socket -import rpc +import rpc.rpc as rpc import pickle VERSION="0.2" # How/when update this? diff --git a/rpc/rpc.py b/rpc/rpc.py index af2b325..46c59bf 100644 --- a/rpc/rpc.py +++ b/rpc/rpc.py @@ -7,7 +7,7 @@ import logging from collections import deque as Deque from errno import EINPROGRESS, EWOULDBLOCK -import rpc_pack +import rpc.rpc_pack as rpc_pack from rpc_const import * from rpc_type import * From patchwork Tue Jul 24 07:33:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jianhong Yin X-Patchwork-Id: 10541429 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A33DD17FD for ; Tue, 24 Jul 2018 07:34:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8A36928759 for ; Tue, 24 Jul 2018 07:34:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7F1A12875E; Tue, 24 Jul 2018 07:34:33 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 224DF28759 for ; Tue, 24 Jul 2018 07:34:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388443AbeGXIji (ORCPT ); Tue, 24 Jul 2018 04:39:38 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:54840 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2388439AbeGXIji (ORCPT ); Tue, 24 Jul 2018 04:39:38 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E58397DAC7; Tue, 24 Jul 2018 07:34:31 +0000 (UTC) Received: from dhcp-12-115.nay.redhat.com (unknown [10.66.12.115]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5961E178B4; Tue, 24 Jul 2018 07:34:30 +0000 (UTC) From: jiyin@redhat.com To: bfields@redhat.com Cc: linux-nfs@vger.kernel.org, "Jianhong.Yin" Subject: [PATCH 20/24] pynfs: python3 support plan: fix 'dict' has no attribute 'iteritems' Date: Tue, 24 Jul 2018 15:33:38 +0800 Message-Id: <20180724073342.5738-20-jiyin@redhat.com> In-Reply-To: <20180724073342.5738-1-jiyin@redhat.com> References: <20180724073342.5738-1-jiyin@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Tue, 24 Jul 2018 07:34:31 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Tue, 24 Jul 2018 07:34:31 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'jiyin@redhat.com' RCPT:'' Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: "Jianhong.Yin" Signed-off-by: Jianhong Yin --- nfs4.0/lib/rpc/rpc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nfs4.0/lib/rpc/rpc.py b/nfs4.0/lib/rpc/rpc.py index 93f20dc..96d9aa7 100644 --- a/nfs4.0/lib/rpc/rpc.py +++ b/nfs4.0/lib/rpc/rpc.py @@ -519,7 +519,7 @@ class RPCServer(Server): for secname, sectype in {'none': AUTH_NONE, 'sys': AUTH_SYS, 'gss': RPCSEC_GSS, - }.iteritems(): + }.items(): if secname in supported: self.security[sectype] = supported[secname]() From patchwork Tue Jul 24 07:33:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jianhong Yin X-Patchwork-Id: 10541431 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id ACFD317FD for ; Tue, 24 Jul 2018 07:34:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 945702875C for ; Tue, 24 Jul 2018 07:34:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8915E28760; Tue, 24 Jul 2018 07:34:36 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 07E4A2875C for ; Tue, 24 Jul 2018 07:34:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388439AbeGXIjl (ORCPT ); Tue, 24 Jul 2018 04:39:41 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:53714 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2388442AbeGXIjl (ORCPT ); Tue, 24 Jul 2018 04:39:41 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1F87B40241D3; Tue, 24 Jul 2018 07:34:34 +0000 (UTC) Received: from dhcp-12-115.nay.redhat.com (unknown [10.66.12.115]) by smtp.corp.redhat.com (Postfix) with ESMTP id 87BF1178B3; Tue, 24 Jul 2018 07:34:32 +0000 (UTC) From: jiyin@redhat.com To: bfields@redhat.com Cc: linux-nfs@vger.kernel.org, "Jianhong.Yin" Subject: [PATCH 21/24] pynfs: python3 support plan: fix sort() fail and require python version Date: Tue, 24 Jul 2018 15:33:39 +0800 Message-Id: <20180724073342.5738-21-jiyin@redhat.com> In-Reply-To: <20180724073342.5738-1-jiyin@redhat.com> References: <20180724073342.5738-1-jiyin@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Tue, 24 Jul 2018 07:34:34 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Tue, 24 Jul 2018 07:34:34 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'jiyin@redhat.com' RCPT:'' Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: "Jianhong.Yin" Signed-off-by: Jianhong Yin --- nfs4.0/testserver.py | 6 +++--- nfs4.1/nfs4client.py | 2 +- nfs4.1/nfs4lib.py | 2 +- nfs4.1/testclient.py | 6 +++--- nfs4.1/testmod.py | 5 ++++- nfs4.1/testserver.py | 6 +++--- 6 files changed, 15 insertions(+), 12 deletions(-) diff --git a/nfs4.0/testserver.py b/nfs4.0/testserver.py index ebce58d..e4a6db7 100755 --- a/nfs4.0/testserver.py +++ b/nfs4.0/testserver.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # nfs4stest.py - nfsv4 server tester # -# Requires python 2.5 +# Requires python 2.7 # # Written by Fred Isaman # Copyright (C) 2004 University of Michigan, Center for @@ -26,8 +26,8 @@ import sys -if sys.hexversion < 0x02050000: - print("Requires python 2.5 or higher") +if sys.hexversion < 0x02070000: + print("Requires python 2.7 or higher") sys.exit(1) import os # Allow to be run stright from package root diff --git a/nfs4.1/nfs4client.py b/nfs4.1/nfs4client.py index e8c649b..be6b234 100644 --- a/nfs4.1/nfs4client.py +++ b/nfs4.1/nfs4client.py @@ -645,7 +645,7 @@ C.compound([C.bind_conn_to_session_op('0000000000000001', False, 3, False, 73, d """ PROGRAM COVERAGE -python2.5 ~/py_install/bin/coverage.py -x nfs4server.py +python2.7 ~/py_install/bin/coverage.py -x nfs4server.py coverage.py -a -d cover nfs4server.py run test suite """ diff --git a/nfs4.1/nfs4lib.py b/nfs4.1/nfs4lib.py index d46706a..5fed3ba 100644 --- a/nfs4.1/nfs4lib.py +++ b/nfs4.1/nfs4lib.py @@ -28,7 +28,7 @@ state00 = xdrdef.nfs4_type.stateid4(0, "\0" * 12) state11 = xdrdef.nfs4_type.stateid4(0xffffffff, "\xff" * 12) state01 = xdrdef.nfs4_type.stateid4(1, "\0" * 12) -import hashlib # Note this requires 2.5 or higher +import hashlib # Note this requires 2.7 or higher op4 = nfs_ops.NFS4ops() diff --git a/nfs4.1/testclient.py b/nfs4.1/testclient.py index 5d21eaa..19bd148 100755 --- a/nfs4.1/testclient.py +++ b/nfs4.1/testclient.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # nfs4stest.py - nfsv4 server tester # -# Requires python 2.5 +# Requires python 2.7 # # Written by Fred Isaman # Copyright (C) 2004 University of Michigan, Center for @@ -23,8 +23,8 @@ import use_local # HACK so don't have to rebuild constantly import sys -if sys.hexversion < 0x02050000: - print("Requires python 2.5 or higher") +if sys.hexversion < 0x02070000: + print("Requires python 2.7 or higher") sys.exit(1) import os diff --git a/nfs4.1/testmod.py b/nfs4.1/testmod.py index 6f576e2..68f7a5f 100644 --- a/nfs4.1/testmod.py +++ b/nfs4.1/testmod.py @@ -1,6 +1,6 @@ # testmod.py - run tests from a suite # -# Requires python 2.5 +# Requires python 2.7 # # Written by Fred Isaman # Copyright (C) 2004 University of Michigan, Center for @@ -157,6 +157,9 @@ class Test(object): else: return 1 + def __lt__(self, other): + return self.__cmp__(other) + def __str__(self): return "%-8s %s" % ( self.code, self.fullname) diff --git a/nfs4.1/testserver.py b/nfs4.1/testserver.py index 2becc13..249837e 100755 --- a/nfs4.1/testserver.py +++ b/nfs4.1/testserver.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # nfs4stest.py - nfsv4 server tester # -# Requires python 2.5 +# Requires python 2.7 # # Written by Fred Isaman # Copyright (C) 2004 University of Michigan, Center for @@ -27,8 +27,8 @@ import use_local # HACK so don't have to rebuild constantly import sys -if sys.hexversion < 0x02050000: - print("Requires python 2.5 or higher") +if sys.hexversion < 0x02070000: + print("Requires python 2.7 or higher") sys.exit(1) import os From patchwork Tue Jul 24 07:33:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jianhong Yin X-Patchwork-Id: 10541433 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EE772184F for ; Tue, 24 Jul 2018 07:34:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D52812875C for ; Tue, 24 Jul 2018 07:34:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C9D6428760; Tue, 24 Jul 2018 07:34:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 82DB52875C for ; Tue, 24 Jul 2018 07:34:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388442AbeGXIjn (ORCPT ); Tue, 24 Jul 2018 04:39:43 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:52780 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2388448AbeGXIjn (ORCPT ); Tue, 24 Jul 2018 04:39:43 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4E841402332F; Tue, 24 Jul 2018 07:34:36 +0000 (UTC) Received: from dhcp-12-115.nay.redhat.com (unknown [10.66.12.115]) by smtp.corp.redhat.com (Postfix) with ESMTP id B5854178B3; Tue, 24 Jul 2018 07:34:34 +0000 (UTC) From: jiyin@redhat.com To: bfields@redhat.com Cc: linux-nfs@vger.kernel.org, "Jianhong.Yin" Subject: [PATCH 22/24] pynfs: python3 support plan: fix ord() failure on python3 Date: Tue, 24 Jul 2018 15:33:40 +0800 Message-Id: <20180724073342.5738-22-jiyin@redhat.com> In-Reply-To: <20180724073342.5738-1-jiyin@redhat.com> References: <20180724073342.5738-1-jiyin@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Tue, 24 Jul 2018 07:34:36 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Tue, 24 Jul 2018 07:34:36 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'jiyin@redhat.com' RCPT:'' Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: "Jianhong.Yin" Signed-off-by: Jianhong Yin --- nfs4.0/nfs4lib.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/nfs4.0/nfs4lib.py b/nfs4.0/nfs4lib.py index 79e386e..82fa4d8 100644 --- a/nfs4.0/nfs4lib.py +++ b/nfs4.0/nfs4lib.py @@ -144,7 +144,10 @@ class CBServer(rpc.RPCServer): self.client = client rpc.RPCServer.__init__(self, prog=self.prog, vers=1, port=self.port) packed = struct.pack('>H', self.port) - self.dotport = '.%s.%s' % (ord(packed[0]), ord(packed[1])) + try: #for python2 + self.dotport = '.%s.%s' % (ord(packed[0]), ord(packed[1])) + except: #for python3 + self.dotport = '.%s.%s' % ((packed[0]), (packed[1])) self.nfs4packer = FancyNFS4Packer() self.nfs4unpacker = FancyNFS4Unpacker('') self.recall_lock = threading.Lock() From patchwork Tue Jul 24 07:33:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jianhong Yin X-Patchwork-Id: 10541437 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5699F17FD for ; Tue, 24 Jul 2018 07:34:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3AF9728759 for ; Tue, 24 Jul 2018 07:34:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2C7D828761; Tue, 24 Jul 2018 07:34:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CA47028759 for ; Tue, 24 Jul 2018 07:34:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388448AbeGXIjp (ORCPT ); Tue, 24 Jul 2018 04:39:45 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:52744 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2388453AbeGXIjp (ORCPT ); Tue, 24 Jul 2018 04:39:45 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7A8A7805A530; Tue, 24 Jul 2018 07:34:38 +0000 (UTC) Received: from dhcp-12-115.nay.redhat.com (unknown [10.66.12.115]) by smtp.corp.redhat.com (Postfix) with ESMTP id E3782178B3; Tue, 24 Jul 2018 07:34:36 +0000 (UTC) From: jiyin@redhat.com To: bfields@redhat.com Cc: linux-nfs@vger.kernel.org, "Jianhong.Yin" Subject: [PATCH 23/24] pynfs: python3 support plan: fix except multi exceptions in one line Date: Tue, 24 Jul 2018 15:33:41 +0800 Message-Id: <20180724073342.5738-23-jiyin@redhat.com> In-Reply-To: <20180724073342.5738-1-jiyin@redhat.com> References: <20180724073342.5738-1-jiyin@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Tue, 24 Jul 2018 07:34:38 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Tue, 24 Jul 2018 07:34:38 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'jiyin@redhat.com' RCPT:'' Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: "Jianhong.Yin" Signed-off-by: Jianhong Yin --- rpc/rpc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rpc/rpc.py b/rpc/rpc.py index 46c59bf..18ff9fd 100644 --- a/rpc/rpc.py +++ b/rpc/rpc.py @@ -613,7 +613,7 @@ class ConnectionHandler(object): msg_data = record[p.get_position():] # RPC payload # Remember length of the header msg.length = p.get_position() - except (rpc_pack.XDRError, EOFError), e: + except (rpc_pack.XDRError, EOFError) as e: log_t.warn("XDRError: %s, dropping packet" % e) log_t.debug("unpacking raised the following error", exc_info=True) self._notify_drop() From patchwork Tue Jul 24 07:33:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jianhong Yin X-Patchwork-Id: 10541439 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B6A6617FD for ; Tue, 24 Jul 2018 07:34:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9D4402875E for ; Tue, 24 Jul 2018 07:34:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 91EAA28763; Tue, 24 Jul 2018 07:34:42 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 389BB2875E for ; Tue, 24 Jul 2018 07:34:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388461AbeGXIjr (ORCPT ); Tue, 24 Jul 2018 04:39:47 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:54852 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2388455AbeGXIjr (ORCPT ); Tue, 24 Jul 2018 04:39:47 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DE8307DAC2; Tue, 24 Jul 2018 07:34:40 +0000 (UTC) Received: from dhcp-12-115.nay.redhat.com (unknown [10.66.12.115]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1C681178B7; Tue, 24 Jul 2018 07:34:38 +0000 (UTC) From: jiyin@redhat.com To: bfields@redhat.com Cc: linux-nfs@vger.kernel.org, "Jianhong.Yin" Subject: [PATCH 24/24] pynfs: python3 support plan: fix access class var in list comprehension Date: Tue, 24 Jul 2018 15:33:42 +0800 Message-Id: <20180724073342.5738-24-jiyin@redhat.com> In-Reply-To: <20180724073342.5738-1-jiyin@redhat.com> References: <20180724073342.5738-1-jiyin@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Tue, 24 Jul 2018 07:34:40 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Tue, 24 Jul 2018 07:34:40 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'jiyin@redhat.com' RCPT:'' Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: "Jianhong.Yin" see: https://stackoverflow.com/questions/13905741/accessing-class-variables-from-a-list-comprehension-in-the-class-definition Signed-off-by: Jianhong Yin --- Status: ''' all patches works fine on python-2.7 and build success on python-3.6 but because xdrlib issue https://bugs.python.org/issue9544 pynfs has not been able to run on python-3.6 now ''' nfs4.1/config.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/nfs4.1/config.py b/nfs4.1/config.py index b4a45d7..8779fe1 100644 --- a/nfs4.1/config.py +++ b/nfs4.1/config.py @@ -178,8 +178,9 @@ _invalid_ops = [ class OpsConfigServer(object): __metaclass__ = MetaConfig value = ['ERROR', 0, 0] # Note must have value == _opline(value) - attrs = [ConfigLine(name.lower()[3:], value, "Generic comment", _opline) - for name in nfs_opnum4.values()] + attrs = (lambda value=value: [ConfigLine(name.lower()[3:], value, "Generic comment", _opline) + for name in nfs_opnum4.values()])() + class Actions(object): __metaclass__ = MetaConfig