mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2024-12-22 06:17:50 +00:00
updated instances of octal literals to use the format 0o123 for python3 compatibility
This commit is contained in:
parent
7511b5956b
commit
129ef22185
1
newsfragments/3015.other
Normal file
1
newsfragments/3015.other
Normal file
@ -0,0 +1 @@
|
||||
Updated instances of octal literals to use the format 0o123 for Python3 compatibility.
|
@ -1,18 +1,20 @@
|
||||
docs/
|
||||
integration/
|
||||
misc/build_helpers/check-build.py
|
||||
misc/build_helpers/gen-package-table.py
|
||||
misc/build_helpers/run-deprecations.py
|
||||
misc/build_helpers/show-tool-versions.py
|
||||
misc/build_helpers/test-osx-pkg.py
|
||||
misc/coding_tools/check-debugging.py
|
||||
misc/coding_tools/check-umids.py
|
||||
misc/coding_tools/coverage2el.py
|
||||
misc/coding_tools/find-trailing-spaces.py
|
||||
misc/coding_tools/fixshebangs.py
|
||||
misc/coding_tools/graph-deps.py
|
||||
misc/incident-gatherer/classify_tahoe.py
|
||||
misc/operations_helpers/provisioning/provisioning.py
|
||||
misc/operations_helpers/provisioning/reliability.py
|
||||
misc/operations_helpers/provisioning/run.py
|
||||
misc/operations_helpers/provisioning/test_provisioning.py
|
||||
misc/operations_helpers/provisioning/util.py
|
||||
misc/operations_helpers/provisioning/web_reliability.py
|
||||
misc/operations_helpers/spacetime/diskwatcher.py
|
||||
misc/coding_tools/make-canary-files.py
|
||||
misc/incident-gatherer/
|
||||
misc/operations_helpers/
|
||||
misc/simulators/
|
||||
release-tools/
|
||||
setup.py
|
||||
src/allmydata/_auto_deps.py
|
||||
@ -48,11 +50,14 @@ src/allmydata/mutable/publish.py
|
||||
src/allmydata/mutable/repairer.py
|
||||
src/allmydata/mutable/servermap.py
|
||||
src/allmydata/nodemaker.py
|
||||
src/allmydata/node.py
|
||||
src/allmydata/scripts/admin.py
|
||||
src/allmydata/scripts/cli.py
|
||||
src/allmydata/scripts/common.py
|
||||
src/allmydata/scripts/create_node.py
|
||||
src/allmydata/scripts/default_nodedir.py
|
||||
src/allmydata/scripts/__init__.py
|
||||
src/allmydata/scripts/magic_folder_cli.py
|
||||
src/allmydata/scripts/stats_gatherer.py
|
||||
src/allmydata/scripts/tahoe_add_alias.py
|
||||
src/allmydata/scripts/tahoe_backup.py
|
||||
@ -61,8 +66,13 @@ src/allmydata/scripts/tahoe_restart.py
|
||||
src/allmydata/scripts/tahoe_run.py
|
||||
src/allmydata/scripts/tahoe_start.py
|
||||
src/allmydata/scripts/tahoe_status.py
|
||||
src/allmydata/storage_client.py
|
||||
src/allmydata/stats.py
|
||||
src/allmydata/storage/
|
||||
src/allmydata/test/bench_dirnode.py
|
||||
src/allmydata/test/check_grid.py
|
||||
src/allmydata/test/check_load.py
|
||||
src/allmydata/test/check_memory.py
|
||||
src/allmydata/test/check_speed.py
|
||||
src/allmydata/test/cli/common.py
|
||||
src/allmydata/test/cli/__init__.py
|
||||
src/allmydata/test/cli/test_alias.py
|
||||
@ -71,6 +81,7 @@ src/allmydata/test/cli/test_daemonize.py
|
||||
src/allmydata/test/cli/test_invite.py
|
||||
src/allmydata/test/cli/test_start.py
|
||||
src/allmydata/test/cli/test_status.py
|
||||
src/allmydata/test/common_util.py
|
||||
src/allmydata/test/common_web.py
|
||||
src/allmydata/test/eliotutil.py
|
||||
src/allmydata/test/__init__.py
|
||||
@ -85,7 +96,10 @@ src/allmydata/test/mutable/test_interoperability.py
|
||||
src/allmydata/test/mutable/test_multiple_encodings.py
|
||||
src/allmydata/test/mutable/test_multiple_versions.py
|
||||
src/allmydata/test/mutable/test_repair.py
|
||||
src/allmydata/test/mutable/test_roundtrip.py
|
||||
src/allmydata/test/mutable/test_servermap.py
|
||||
src/allmydata/test/mutable/test_update.py
|
||||
src/allmydata/test/mutable/test_version.py
|
||||
src/allmydata/test/mutable/util.py
|
||||
src/allmydata/test/plugins/tahoe_lafs_dropin.py
|
||||
src/allmydata/test/status.py
|
||||
@ -98,6 +112,7 @@ src/allmydata/test/test_connections.py
|
||||
src/allmydata/test/test_eliotutil.py
|
||||
src/allmydata/test/test_encode.py
|
||||
src/allmydata/test/test_filenode.py
|
||||
src/allmydata/test/test_ftp.py
|
||||
src/allmydata/test/test_happiness.py
|
||||
src/allmydata/test/test_helper.py
|
||||
src/allmydata/test/test_hung_server.py
|
||||
@ -108,9 +123,11 @@ src/allmydata/test/test_inotify.py
|
||||
src/allmydata/test/test_introducer.py
|
||||
src/allmydata/test/test_iputil.py
|
||||
src/allmydata/test/test_json_metadata.py
|
||||
src/allmydata/test/test_magic_folder.py
|
||||
src/allmydata/test/test_magicpath.py
|
||||
src/allmydata/test/test_multi_introducers.py
|
||||
src/allmydata/test/test_netstring.py
|
||||
src/allmydata/test/test_node.py
|
||||
src/allmydata/test/test_no_network.py
|
||||
src/allmydata/test/test_observer.py
|
||||
src/allmydata/test/test_runner.py
|
||||
@ -121,7 +138,11 @@ src/allmydata/test/test_uri.py
|
||||
src/allmydata/test/test_version.py
|
||||
src/allmydata/test/web/common.py
|
||||
src/allmydata/test/web/__init__.py
|
||||
src/allmydata/test/web/matchers.py
|
||||
src/allmydata/test/web/test_grid.py
|
||||
src/allmydata/test/web/test_introducer.py
|
||||
src/allmydata/test/web/test_logs.py
|
||||
src/allmydata/test/web/test_private.py
|
||||
src/allmydata/test/web/test_root.py
|
||||
src/allmydata/test/web/test_token.py
|
||||
src/allmydata/test/web/test_util.py
|
||||
@ -149,6 +170,7 @@ src/allmydata/util/nummedobj.py
|
||||
src/allmydata/util/observer.py
|
||||
src/allmydata/util/pipeline.py
|
||||
src/allmydata/util/pkgresutil.py
|
||||
src/allmydata/util/pollmixin.py
|
||||
src/allmydata/util/progress.py
|
||||
src/allmydata/util/repeatable_random.py
|
||||
src/allmydata/util/rrefutil.py
|
||||
@ -157,9 +179,10 @@ src/allmydata/util/statistics.py
|
||||
src/allmydata/util/tor_provider.py
|
||||
src/allmydata/util/verlib.py
|
||||
src/allmydata/util/yamlutil.py
|
||||
src/allmydata/_version.py
|
||||
src/allmydata/watchdog/
|
||||
src/allmydata/web/
|
||||
src/allmydata/webish.py
|
||||
src/allmydata/windows/__init__.py
|
||||
src/allmydata/windows/tahoesvc.py
|
||||
static/tahoe.py
|
||||
ws_client.py
|
||||
|
@ -217,7 +217,7 @@ class Handler(object):
|
||||
# Twisted-15.0.0 expects a
|
||||
# twisted.python.filepath.Permissions , and calls its
|
||||
# .shorthand() method. This provides both.
|
||||
value = IntishPermissions(0600)
|
||||
value = IntishPermissions(0o600)
|
||||
elif key == "hardlinks":
|
||||
value = 1
|
||||
elif key == "modified":
|
||||
|
@ -283,10 +283,10 @@ def fix_magic_folder_config(yaml_fname, name, config):
|
||||
|
||||
# make sure directory for magic folder exists
|
||||
dir_fp = to_filepath(config['directory'])
|
||||
umask = config.setdefault('umask', 0077)
|
||||
umask = config.setdefault('umask', 0o077)
|
||||
|
||||
try:
|
||||
os.mkdir(dir_fp.path, 0777 & (~ umask))
|
||||
os.mkdir(dir_fp.path, 0o777 & (~ umask))
|
||||
except OSError as e:
|
||||
if EEXIST != e.errno:
|
||||
# Report some unknown problem.
|
||||
@ -1645,9 +1645,9 @@ class WriteFileMixin(object):
|
||||
replacement_path_u = abspath_u + u".tmp" # FIXME more unique
|
||||
|
||||
initial_path_u = os.path.dirname(abspath_u)
|
||||
fileutil.make_dirs_with_absolute_mode(local_path_u, initial_path_u, (~ self._umask) & 0777)
|
||||
fileutil.make_dirs_with_absolute_mode(local_path_u, initial_path_u, (~ self._umask) & 0o777)
|
||||
fileutil.write(replacement_path_u, file_contents)
|
||||
os.chmod(replacement_path_u, (~ self._umask) & 0666)
|
||||
os.chmod(replacement_path_u, (~ self._umask) & 0o666)
|
||||
|
||||
# FUDGE_SECONDS is used to determine if another process has
|
||||
# written to the same file concurrently. This is described in
|
||||
|
@ -214,7 +214,7 @@ def _populate_attrs(childnode, metadata, size=None):
|
||||
if childnode and childnode.is_unknown():
|
||||
perms = 0
|
||||
elif childnode and IDirectoryNode.providedBy(childnode):
|
||||
perms = S_IFDIR | 0777
|
||||
perms = S_IFDIR | 0o777
|
||||
else:
|
||||
# For files, omit the size if we don't immediately know it.
|
||||
if childnode and size is None:
|
||||
@ -222,11 +222,11 @@ def _populate_attrs(childnode, metadata, size=None):
|
||||
if size is not None:
|
||||
_assert(isinstance(size, (int, long)) and not isinstance(size, bool), size=size)
|
||||
attrs['size'] = size
|
||||
perms = S_IFREG | 0666
|
||||
perms = S_IFREG | 0o666
|
||||
|
||||
if metadata:
|
||||
if metadata.get('no-write', False):
|
||||
perms &= S_IFDIR | S_IFREG | 0555 # clear 'w' bits
|
||||
perms &= S_IFDIR | S_IFREG | 0o555 # clear 'w' bits
|
||||
|
||||
# See webapi.txt for what these times mean.
|
||||
# We would prefer to omit atime, but SFTP version 3 can only
|
||||
|
@ -784,7 +784,7 @@ class Node(service.MultiService):
|
||||
# need to send a pid to the foolscap log here.
|
||||
twlog.msg("My pid: %s" % os.getpid())
|
||||
try:
|
||||
os.chmod("twistd.pid", 0644)
|
||||
os.chmod("twistd.pid", 0o644)
|
||||
except EnvironmentError:
|
||||
pass
|
||||
|
||||
|
@ -426,7 +426,7 @@ def create_node(config):
|
||||
else:
|
||||
print(" {}: [sensitive data; see tahoe.cfg]".format(k), file=out)
|
||||
|
||||
fileutil.make_dirs(os.path.join(basedir, "private"), 0700)
|
||||
fileutil.make_dirs(os.path.join(basedir, "private"), 0o700)
|
||||
with open(os.path.join(basedir, "tahoe.cfg"), "w") as c:
|
||||
yield write_node_config(c, config)
|
||||
write_client_config(c, config)
|
||||
@ -465,7 +465,7 @@ def create_introducer(config):
|
||||
os.mkdir(basedir)
|
||||
write_tac(basedir, "introducer")
|
||||
|
||||
fileutil.make_dirs(os.path.join(basedir, "private"), 0700)
|
||||
fileutil.make_dirs(os.path.join(basedir, "private"), 0o700)
|
||||
with open(os.path.join(basedir, "tahoe.cfg"), "w") as c:
|
||||
yield write_node_config(c, config)
|
||||
|
||||
|
@ -466,7 +466,7 @@ class Backup(GridTestMixin, CLITestMixin, StallMixin, unittest.TestCase):
|
||||
|
||||
# This is necessary for the temp files to be correctly removed
|
||||
def _cleanup(self):
|
||||
os.chmod(os.path.join(source, "foo.txt"), 0644)
|
||||
os.chmod(os.path.join(source, "foo.txt"), 0o644)
|
||||
d.addCallback(_cleanup)
|
||||
d.addErrback(_cleanup)
|
||||
|
||||
@ -501,7 +501,7 @@ class Backup(GridTestMixin, CLITestMixin, StallMixin, unittest.TestCase):
|
||||
|
||||
# This is necessary for the temp files to be correctly removed
|
||||
def _cleanup(self):
|
||||
os.chmod(os.path.join(source, "test"), 0655)
|
||||
os.chmod(os.path.join(source, "test"), 0o655)
|
||||
d.addCallback(_cleanup)
|
||||
d.addErrback(_cleanup)
|
||||
return d
|
||||
|
@ -194,7 +194,7 @@ def create_no_network_client(basedir):
|
||||
does no actual networking but has the same API.
|
||||
"""
|
||||
basedir = abspath_expanduser_unicode(unicode(basedir))
|
||||
fileutil.make_dirs(os.path.join(basedir, "private"), 0700)
|
||||
fileutil.make_dirs(os.path.join(basedir, "private"), 0o700)
|
||||
|
||||
from allmydata.client import read_config
|
||||
config = read_config(basedir, u'client.port')
|
||||
|
@ -94,12 +94,12 @@ class Handler(GridTestMixin, ReallyEqualMixin, unittest.TestCase):
|
||||
|
||||
expected_root = [
|
||||
('loop',
|
||||
[0, True, ftpd.IntishPermissions(0600), 1, self.FALL_OF_BERLIN_WALL, 'alice', 'alice', '??']),
|
||||
[0, True, ftpd.IntishPermissions(0o600), 1, self.FALL_OF_BERLIN_WALL, 'alice', 'alice', '??']),
|
||||
('immutable',
|
||||
[23, False, ftpd.IntishPermissions(0600), 1, self.TURN_OF_MILLENIUM, 'alice', 'alice', '??']),
|
||||
[23, False, ftpd.IntishPermissions(0o600), 1, self.TURN_OF_MILLENIUM, 'alice', 'alice', '??']),
|
||||
('mutable',
|
||||
# timestamp should be 0 if no timestamp metadata is present
|
||||
[0, False, ftpd.IntishPermissions(0600), 1, 0, 'alice', 'alice', '??'])]
|
||||
[0, False, ftpd.IntishPermissions(0o600), 1, 0, 'alice', 'alice', '??'])]
|
||||
|
||||
d.addCallback(lambda root: self._compareDirLists(root, expected_root))
|
||||
|
||||
|
@ -2281,23 +2281,23 @@ class MockTest(SingleMagicFolderTestMixin, AsyncTestCase):
|
||||
readonly_dircap = n.get_readonly_uri()
|
||||
|
||||
self.shouldFail(ValueError, 'does not exist', 'does not exist',
|
||||
MagicFolder, client, upload_dircap, '', doesnotexist, magicfolderdb, 0077, 'default')
|
||||
MagicFolder, client, upload_dircap, '', doesnotexist, magicfolderdb, 0o077, 'default')
|
||||
self.shouldFail(ValueError, 'is not a directory', 'is not a directory',
|
||||
MagicFolder, client, upload_dircap, '', not_a_dir, magicfolderdb, 0077, 'default')
|
||||
MagicFolder, client, upload_dircap, '', not_a_dir, magicfolderdb, 0o077, 'default')
|
||||
self.shouldFail(AssertionError, 'bad upload.dircap', 'does not refer to a directory',
|
||||
MagicFolder, client, 'bad', '', errors_dir, magicfolderdb, 0077, 'default')
|
||||
MagicFolder, client, 'bad', '', errors_dir, magicfolderdb, 0o077, 'default')
|
||||
self.shouldFail(AssertionError, 'non-directory upload.dircap', 'does not refer to a directory',
|
||||
MagicFolder, client, 'URI:LIT:foo', '', errors_dir, magicfolderdb, 0077, 'default')
|
||||
MagicFolder, client, 'URI:LIT:foo', '', errors_dir, magicfolderdb, 0o077, 'default')
|
||||
self.shouldFail(AssertionError, 'readonly upload.dircap', 'is not a writecap to a directory',
|
||||
MagicFolder, client, readonly_dircap, '', errors_dir, magicfolderdb, 0077, 'default')
|
||||
MagicFolder, client, readonly_dircap, '', errors_dir, magicfolderdb, 0o077, 'default')
|
||||
self.shouldFail(AssertionError, 'collective dircap', 'is not a readonly cap to a directory',
|
||||
MagicFolder, client, upload_dircap, upload_dircap, errors_dir, magicfolderdb, 0077, 'default')
|
||||
MagicFolder, client, upload_dircap, upload_dircap, errors_dir, magicfolderdb, 0o077, 'default')
|
||||
|
||||
def _not_implemented():
|
||||
raise NotImplementedError("blah")
|
||||
self.patch(magic_folder, 'get_inotify_module', _not_implemented)
|
||||
self.shouldFail(NotImplementedError, 'unsupported', 'blah',
|
||||
MagicFolder, client, upload_dircap, '', errors_dir, magicfolderdb, 0077, 'default')
|
||||
MagicFolder, client, upload_dircap, '', errors_dir, magicfolderdb, 0o077, 'default')
|
||||
d.addCallback(_check_errors)
|
||||
return d.result
|
||||
|
||||
@ -2310,7 +2310,7 @@ class MockTest(SingleMagicFolderTestMixin, AsyncTestCase):
|
||||
pass
|
||||
|
||||
writefile = TestWriteFileMixin()
|
||||
writefile._umask = 0077
|
||||
writefile._umask = 0o077
|
||||
|
||||
# create a file with name "foobar" with content "foo"
|
||||
# write downloaded file content "bar" into "foobar" with is_conflict = False
|
||||
|
@ -299,7 +299,7 @@ class TestCase(testutil.SignalMixin, unittest.TestCase):
|
||||
privdir = os.path.join(basedir, "private")
|
||||
st = os.stat(privdir)
|
||||
bits = stat.S_IMODE(st[stat.ST_MODE])
|
||||
self.failUnless(bits & 0001 == 0, bits)
|
||||
self.failUnless(bits & 0o001 == 0, bits)
|
||||
|
||||
@defer.inlineCallbacks
|
||||
def test_logdir_is_str(self):
|
||||
|
@ -293,16 +293,16 @@ class Handler(GridTestMixin, ShouldFailMixin, ReallyEqualMixin, unittest.TestCas
|
||||
|
||||
gross = u"gro\u00DF".encode("utf-8")
|
||||
expected_root = [
|
||||
('empty_lit_dir', r'dr-xr-xr-x .* 0 .* empty_lit_dir$', {'permissions': S_IFDIR | 0555}),
|
||||
(gross, r'-rw-rw-rw- .* 1010 .* '+gross+'$', {'permissions': S_IFREG | 0666, 'size': 1010}),
|
||||
('empty_lit_dir', r'dr-xr-xr-x .* 0 .* empty_lit_dir$', {'permissions': S_IFDIR | 0o555}),
|
||||
(gross, r'-rw-rw-rw- .* 1010 .* '+gross+'$', {'permissions': S_IFREG | 0o666, 'size': 1010}),
|
||||
# The fall of the Berlin wall may have been on 9th or 10th November 1989 depending on the gateway's timezone.
|
||||
#('loop', r'drwxrwxrwx .* 0 Nov (09|10) 1989 loop$', {'permissions': S_IFDIR | 0777}),
|
||||
('loop', r'drwxrwxrwx .* 0 .* loop$', {'permissions': S_IFDIR | 0777}),
|
||||
('mutable', r'-rw-rw-rw- .* 0 .* mutable$', {'permissions': S_IFREG | 0666}),
|
||||
('readonly', r'-r--r--r-- .* 0 .* readonly$', {'permissions': S_IFREG | 0444}),
|
||||
('small', r'-rw-rw-rw- .* 10 .* small$', {'permissions': S_IFREG | 0666, 'size': 10}),
|
||||
('small2', r'-rw-rw-rw- .* 26 .* small2$', {'permissions': S_IFREG | 0666, 'size': 26}),
|
||||
('tiny_lit_dir', r'dr-xr-xr-x .* 0 .* tiny_lit_dir$', {'permissions': S_IFDIR | 0555}),
|
||||
('loop', r'drwxrwxrwx .* 0 .* loop$', {'permissions': S_IFDIR | 0o777}),
|
||||
('mutable', r'-rw-rw-rw- .* 0 .* mutable$', {'permissions': S_IFREG | 0o666}),
|
||||
('readonly', r'-r--r--r-- .* 0 .* readonly$', {'permissions': S_IFREG | 0o444}),
|
||||
('small', r'-rw-rw-rw- .* 10 .* small$', {'permissions': S_IFREG | 0o666, 'size': 10}),
|
||||
('small2', r'-rw-rw-rw- .* 26 .* small2$', {'permissions': S_IFREG | 0o666, 'size': 26}),
|
||||
('tiny_lit_dir', r'dr-xr-xr-x .* 0 .* tiny_lit_dir$', {'permissions': S_IFDIR | 0o555}),
|
||||
('unknown', r'\?--------- .* 0 .* unknown$', {'permissions': 0}),
|
||||
]
|
||||
|
||||
@ -320,20 +320,20 @@ class Handler(GridTestMixin, ShouldFailMixin, ReallyEqualMixin, unittest.TestCas
|
||||
|
||||
# The UTC epoch may either be in Jan 1 1970 or Dec 31 1969 depending on the gateway's timezone.
|
||||
expected_tiny_lit = [
|
||||
('short', r'-r--r--r-- .* 8 (Jan 01 1970|Dec 31 1969) short$', {'permissions': S_IFREG | 0444, 'size': 8}),
|
||||
('short', r'-r--r--r-- .* 8 (Jan 01 1970|Dec 31 1969) short$', {'permissions': S_IFREG | 0o444, 'size': 8}),
|
||||
]
|
||||
|
||||
d.addCallback(lambda ign: self.handler.openDirectory("tiny_lit_dir"))
|
||||
d.addCallback(lambda res: self._compareDirLists(res, expected_tiny_lit))
|
||||
|
||||
d.addCallback(lambda ign: self.handler.getAttrs("small", True))
|
||||
d.addCallback(lambda attrs: self._compareAttributes(attrs, {'permissions': S_IFREG | 0666, 'size': 10}))
|
||||
d.addCallback(lambda attrs: self._compareAttributes(attrs, {'permissions': S_IFREG | 0o666, 'size': 10}))
|
||||
|
||||
d.addCallback(lambda ign: self.handler.setAttrs("small", {}))
|
||||
d.addCallback(lambda res: self.failUnlessReallyEqual(res, None))
|
||||
|
||||
d.addCallback(lambda ign: self.handler.getAttrs("small", True))
|
||||
d.addCallback(lambda attrs: self._compareAttributes(attrs, {'permissions': S_IFREG | 0666, 'size': 10}))
|
||||
d.addCallback(lambda attrs: self._compareAttributes(attrs, {'permissions': S_IFREG | 0o666, 'size': 10}))
|
||||
|
||||
d.addCallback(lambda ign:
|
||||
self.shouldFailWithSFTPError(sftp.FX_OP_UNSUPPORTED, "setAttrs size",
|
||||
@ -408,10 +408,10 @@ class Handler(GridTestMixin, ShouldFailMixin, ReallyEqualMixin, unittest.TestCas
|
||||
rf.readChunk, 11, 1))
|
||||
|
||||
d2.addCallback(lambda ign: rf.getAttrs())
|
||||
d2.addCallback(lambda attrs: self._compareAttributes(attrs, {'permissions': S_IFREG | 0666, 'size': 10}))
|
||||
d2.addCallback(lambda attrs: self._compareAttributes(attrs, {'permissions': S_IFREG | 0o666, 'size': 10}))
|
||||
|
||||
d2.addCallback(lambda ign: self.handler.getAttrs("small", followLinks=0))
|
||||
d2.addCallback(lambda attrs: self._compareAttributes(attrs, {'permissions': S_IFREG | 0666, 'size': 10}))
|
||||
d2.addCallback(lambda attrs: self._compareAttributes(attrs, {'permissions': S_IFREG | 0o666, 'size': 10}))
|
||||
|
||||
d2.addCallback(lambda ign:
|
||||
self.shouldFailWithSFTPError(sftp.FX_PERMISSION_DENIED, "writeChunk on read-only handle denied",
|
||||
@ -460,10 +460,10 @@ class Handler(GridTestMixin, ShouldFailMixin, ReallyEqualMixin, unittest.TestCas
|
||||
rf.readChunk, 1011, 1))
|
||||
|
||||
d2.addCallback(lambda ign: rf.getAttrs())
|
||||
d2.addCallback(lambda attrs: self._compareAttributes(attrs, {'permissions': S_IFREG | 0666, 'size': 1010}))
|
||||
d2.addCallback(lambda attrs: self._compareAttributes(attrs, {'permissions': S_IFREG | 0o666, 'size': 1010}))
|
||||
|
||||
d2.addCallback(lambda ign: self.handler.getAttrs(gross, followLinks=0))
|
||||
d2.addCallback(lambda attrs: self._compareAttributes(attrs, {'permissions': S_IFREG | 0666, 'size': 1010}))
|
||||
d2.addCallback(lambda attrs: self._compareAttributes(attrs, {'permissions': S_IFREG | 0o666, 'size': 1010}))
|
||||
|
||||
d2.addCallback(lambda ign:
|
||||
self.shouldFailWithSFTPError(sftp.FX_PERMISSION_DENIED, "writeChunk on read-only handle denied",
|
||||
@ -669,10 +669,10 @@ class Handler(GridTestMixin, ShouldFailMixin, ReallyEqualMixin, unittest.TestCas
|
||||
d2.addCallback(lambda ign: wf.writeChunk(13, "abc"))
|
||||
|
||||
d2.addCallback(lambda ign: wf.getAttrs())
|
||||
d2.addCallback(lambda attrs: self._compareAttributes(attrs, {'permissions': S_IFREG | 0666, 'size': 16}))
|
||||
d2.addCallback(lambda attrs: self._compareAttributes(attrs, {'permissions': S_IFREG | 0o666, 'size': 16}))
|
||||
|
||||
d2.addCallback(lambda ign: self.handler.getAttrs("newfile", followLinks=0))
|
||||
d2.addCallback(lambda attrs: self._compareAttributes(attrs, {'permissions': S_IFREG | 0666, 'size': 16}))
|
||||
d2.addCallback(lambda attrs: self._compareAttributes(attrs, {'permissions': S_IFREG | 0o666, 'size': 16}))
|
||||
|
||||
d2.addCallback(lambda ign: wf.setAttrs({}))
|
||||
|
||||
@ -903,15 +903,15 @@ class Handler(GridTestMixin, ShouldFailMixin, ReallyEqualMixin, unittest.TestCas
|
||||
def _write_mutable_setattr(wf):
|
||||
d2 = wf.writeChunk(8, "read-only link from parent")
|
||||
|
||||
d2.addCallback(lambda ign: self.handler.setAttrs("mutable", {'permissions': 0444}))
|
||||
d2.addCallback(lambda ign: self.handler.setAttrs("mutable", {'permissions': 0o444}))
|
||||
|
||||
d2.addCallback(lambda ign: self.root.get(u"mutable"))
|
||||
d2.addCallback(lambda node: self.failUnless(node.is_readonly()))
|
||||
|
||||
d2.addCallback(lambda ign: wf.getAttrs())
|
||||
d2.addCallback(lambda attrs: self.failUnlessReallyEqual(attrs['permissions'], S_IFREG | 0666))
|
||||
d2.addCallback(lambda attrs: self.failUnlessReallyEqual(attrs['permissions'], S_IFREG | 0o666))
|
||||
d2.addCallback(lambda ign: self.handler.getAttrs("mutable", followLinks=0))
|
||||
d2.addCallback(lambda attrs: self.failUnlessReallyEqual(attrs['permissions'], S_IFREG | 0444))
|
||||
d2.addCallback(lambda attrs: self.failUnlessReallyEqual(attrs['permissions'], S_IFREG | 0o444))
|
||||
|
||||
d2.addCallback(lambda ign: wf.close())
|
||||
return d2
|
||||
@ -932,16 +932,16 @@ class Handler(GridTestMixin, ShouldFailMixin, ReallyEqualMixin, unittest.TestCas
|
||||
def _write_mutable2_setattr(wf):
|
||||
d2 = wf.writeChunk(7, "2")
|
||||
|
||||
d2.addCallback(lambda ign: wf.setAttrs({'permissions': 0444, 'size': 8}))
|
||||
d2.addCallback(lambda ign: wf.setAttrs({'permissions': 0o444, 'size': 8}))
|
||||
|
||||
# The link isn't made read-only until the file is closed.
|
||||
d2.addCallback(lambda ign: self.root.get(u"mutable2"))
|
||||
d2.addCallback(lambda node: self.failIf(node.is_readonly()))
|
||||
|
||||
d2.addCallback(lambda ign: wf.getAttrs())
|
||||
d2.addCallback(lambda attrs: self.failUnlessReallyEqual(attrs['permissions'], S_IFREG | 0444))
|
||||
d2.addCallback(lambda attrs: self.failUnlessReallyEqual(attrs['permissions'], S_IFREG | 0o444))
|
||||
d2.addCallback(lambda ign: self.handler.getAttrs("mutable2", followLinks=0))
|
||||
d2.addCallback(lambda attrs: self.failUnlessReallyEqual(attrs['permissions'], S_IFREG | 0666))
|
||||
d2.addCallback(lambda attrs: self.failUnlessReallyEqual(attrs['permissions'], S_IFREG | 0o666))
|
||||
|
||||
d2.addCallback(lambda ign: wf.close())
|
||||
return d2
|
||||
@ -1387,7 +1387,7 @@ class Handler(GridTestMixin, ShouldFailMixin, ReallyEqualMixin, unittest.TestCas
|
||||
d.addCallback(lambda ign:
|
||||
self.shouldFailWithSFTPError(sftp.FX_PERMISSION_DENIED, "makeDirectory newdir2 permissions:0444 denied",
|
||||
self.handler.makeDirectory, "newdir2",
|
||||
{'permissions': 0444}))
|
||||
{'permissions': 0o444}))
|
||||
|
||||
d.addCallback(lambda ign: self.failUnlessEqual(sftpd.all_heisenfiles, {}))
|
||||
d.addCallback(lambda ign: self.failUnlessEqual(self.handler._heisenfiles, {}))
|
||||
|
@ -413,7 +413,7 @@ class Asserts(unittest.TestCase):
|
||||
self.failUnlessEqual("postcondition: othermsg: 'message2' <type 'str'>", m)
|
||||
|
||||
class FileUtil(ReallyEqualMixin, unittest.TestCase):
|
||||
def mkdir(self, basedir, path, mode=0777):
|
||||
def mkdir(self, basedir, path, mode=0o777):
|
||||
fn = os.path.join(basedir, path)
|
||||
fileutil.make_dirs(fn, mode)
|
||||
|
||||
@ -433,16 +433,16 @@ class FileUtil(ReallyEqualMixin, unittest.TestCase):
|
||||
d = os.path.join(basedir, "doomed")
|
||||
self.mkdir(d, "a/b")
|
||||
self.touch(d, "a/b/1.txt")
|
||||
self.touch(d, "a/b/2.txt", 0444)
|
||||
self.touch(d, "a/b/2.txt", 0o444)
|
||||
self.touch(d, "a/b/3.txt", 0)
|
||||
self.mkdir(d, "a/c")
|
||||
self.touch(d, "a/c/1.txt")
|
||||
self.touch(d, "a/c/2.txt", 0444)
|
||||
self.touch(d, "a/c/2.txt", 0o444)
|
||||
self.touch(d, "a/c/3.txt", 0)
|
||||
os.chmod(os.path.join(d, "a/c"), 0444)
|
||||
os.chmod(os.path.join(d, "a/c"), 0o444)
|
||||
self.mkdir(d, "a/d")
|
||||
self.touch(d, "a/d/1.txt")
|
||||
self.touch(d, "a/d/2.txt", 0444)
|
||||
self.touch(d, "a/d/2.txt", 0o444)
|
||||
self.touch(d, "a/d/3.txt", 0)
|
||||
os.chmod(os.path.join(d, "a/d"), 0)
|
||||
|
||||
@ -632,17 +632,17 @@ class FileUtil(ReallyEqualMixin, unittest.TestCase):
|
||||
workdir = fileutil.abspath_expanduser_unicode(u"test_make_dirs_with_absolute_mode")
|
||||
fileutil.make_dirs(workdir)
|
||||
abspath = fileutil.abspath_expanduser_unicode(u"a/b/c/d", base=workdir)
|
||||
fileutil.make_dirs_with_absolute_mode(workdir, abspath, 0766)
|
||||
new_mode = os.stat(os.path.join(workdir, "a", "b", "c", "d")).st_mode & 0777
|
||||
self.failUnlessEqual(new_mode, 0766)
|
||||
new_mode = os.stat(os.path.join(workdir, "a", "b", "c")).st_mode & 0777
|
||||
self.failUnlessEqual(new_mode, 0766)
|
||||
new_mode = os.stat(os.path.join(workdir, "a", "b")).st_mode & 0777
|
||||
self.failUnlessEqual(new_mode, 0766)
|
||||
new_mode = os.stat(os.path.join(workdir, "a")).st_mode & 0777
|
||||
self.failUnlessEqual(new_mode, 0766)
|
||||
new_mode = os.stat(workdir).st_mode & 0777
|
||||
self.failIfEqual(new_mode, 0766)
|
||||
fileutil.make_dirs_with_absolute_mode(workdir, abspath, 0o766)
|
||||
new_mode = os.stat(os.path.join(workdir, "a", "b", "c", "d")).st_mode & 0o777
|
||||
self.failUnlessEqual(new_mode, 0o766)
|
||||
new_mode = os.stat(os.path.join(workdir, "a", "b", "c")).st_mode & 0o777
|
||||
self.failUnlessEqual(new_mode, 0o766)
|
||||
new_mode = os.stat(os.path.join(workdir, "a", "b")).st_mode & 0o777
|
||||
self.failUnlessEqual(new_mode, 0o766)
|
||||
new_mode = os.stat(os.path.join(workdir, "a")).st_mode & 0o777
|
||||
self.failUnlessEqual(new_mode, 0o766)
|
||||
new_mode = os.stat(workdir).st_mode & 0o777
|
||||
self.failIfEqual(new_mode, 0o766)
|
||||
|
||||
def test_create_long_path(self):
|
||||
"""
|
||||
|
@ -172,7 +172,7 @@ def is_ancestor_path(parent, dirname):
|
||||
return False
|
||||
return True
|
||||
|
||||
def make_dirs(dirname, mode=0777):
|
||||
def make_dirs(dirname, mode=0o777):
|
||||
"""
|
||||
An idempotent version of os.makedirs(). If the dir already exists, do
|
||||
nothing and return without raising an exception. If this call creates the
|
||||
|
Loading…
Reference in New Issue
Block a user