@@ -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 """
@@ -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):
@@ -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
@@ -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)
@@ -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):
@@ -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):
@@ -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
@@ -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)
@@ -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
@@ -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")
@@ -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, [])
@@ -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")
###########################################
@@ -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)
@@ -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
@@ -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, [])
@@ -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):
@@ -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),
@@ -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
@@ -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):
@@ -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):
@@ -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