You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2016/05/08 14:15:43 UTC
svn commit: r1742826 - in /subversion/trunk: subversion/tests/cmdline/
subversion/tests/cmdline/svntest/ tools/client-side/
tools/server-side/svnpubsub/
Author: stefan2
Date: Sun May 8 14:15:43 2016
New Revision: 1742826
URL: http://svn.apache.org/viewvc?rev=1742826&view=rev
Log:
Replace "magic" octal permission values with symbolic ones. That improves
readability as well as portability between Python 2 and 3.
Changes outside our build & test scripts may be incomplete.
* subversion/tests/cmdline/svntest/main.py
(S_ALL_READ, S_ALL_WRITE, S_ALL_EXEC,
S_ALL_RW, S_ALL_RX, S_ALL_RWX): Define constants for frequently used
permission patterns.
(safe_rmtree,
_post_create_repos,
create_python_hook_script): Use symbolic constants and combinations
thereof for permission values.
* subversion/tests/cmdline/autoprop_tests.py
* subversion/tests/cmdline/basic_tests.py
* subversion/tests/cmdline/import_tests.py
* subversion/tests/cmdline/prop_tests.py
* subversion/tests/cmdline/revert_tests.py
* subversion/tests/cmdline/schedule_tests.py
* subversion/tests/cmdline/special_tests.py
* subversion/tests/cmdline/svnadmin_tests.py
* subversion/tests/cmdline/svnfsfs_tests.py
* subversion/tests/cmdline/svntest/actions.py
* subversion/tests/cmdline/upgrade_tests.py
* tools/client-side/change-svn-wc-format.py
* tools/server-side/svnpubsub/daemonize.py
* tools/server-side/svnpubsub/svnwcsub.py
(): Same. Also, import the stats module where needed.
Modified:
subversion/trunk/subversion/tests/cmdline/autoprop_tests.py
subversion/trunk/subversion/tests/cmdline/basic_tests.py
subversion/trunk/subversion/tests/cmdline/import_tests.py
subversion/trunk/subversion/tests/cmdline/prop_tests.py
subversion/trunk/subversion/tests/cmdline/revert_tests.py
subversion/trunk/subversion/tests/cmdline/schedule_tests.py
subversion/trunk/subversion/tests/cmdline/special_tests.py
subversion/trunk/subversion/tests/cmdline/svnadmin_tests.py
subversion/trunk/subversion/tests/cmdline/svnfsfs_tests.py
subversion/trunk/subversion/tests/cmdline/svntest/actions.py
subversion/trunk/subversion/tests/cmdline/svntest/main.py
subversion/trunk/subversion/tests/cmdline/upgrade_tests.py
subversion/trunk/tools/client-side/change-svn-wc-format.py
subversion/trunk/tools/server-side/svnpubsub/daemonize.py
subversion/trunk/tools/server-side/svnpubsub/svnwcsub.py
Modified: subversion/trunk/subversion/tests/cmdline/autoprop_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/autoprop_tests.py?rev=1742826&r1=1742825&r2=1742826&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/autoprop_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/autoprop_tests.py Sun May 8 14:15:43 2016
@@ -25,7 +25,7 @@
######################################################################
# General modules
-import os, logging
+import os, logging, stat
logger = logging.getLogger()
@@ -634,7 +634,8 @@ def svn_prop_inheritable_autoprops_add_v
# addition will notice the executable bits and set svn:executable
# again, which is not what we are here to test.
if os.name == 'posix':
- os.chmod(os.path.join(sbox.wc_dir, 'D', 'rip.bat'), 0664)
+ os.chmod(os.path.join(sbox.wc_dir, 'D', 'rip.bat'),
+ svntest.main.S_ALL_READ | stat.S_IWUSR | stat.S_IWGRP)
os.chdir(sbox.wc_dir)
svntest.main.run_svn(None, 'add', '.', '--force', '--no-auto-props',
Modified: subversion/trunk/subversion/tests/cmdline/basic_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/basic_tests.py?rev=1742826&r1=1742825&r2=1742826&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/basic_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/basic_tests.py Sun May 8 14:15:43 2016
@@ -394,8 +394,9 @@ def basic_commit_corruption(sbox):
mu_saved_tb_path = mu_tb_path + "-saved"
tb_dir_saved_mode = os.stat(tb_dir_path)[stat.ST_MODE]
mu_tb_saved_mode = os.stat(mu_tb_path)[stat.ST_MODE]
- os.chmod(tb_dir_path, 0777) ### What's a more portable way to do this?
- os.chmod(mu_tb_path, 0666) ### Would rather not use hardcoded numbers.
+ ### What's a more portable way to do this?
+ os.chmod(tb_dir_path, svntest.main.S_ALL_RWX)
+ os.chmod(mu_tb_path, svntest.main.S_ALL_RW)
shutil.copyfile(mu_tb_path, mu_saved_tb_path)
svntest.main.file_append(mu_tb_path, 'Aaagggkkk, corruption!')
os.chmod(tb_dir_path, tb_dir_saved_mode)
@@ -407,8 +408,8 @@ def basic_commit_corruption(sbox):
"svn: E200014: Checksum")
# Restore the uncorrupted text base.
- os.chmod(tb_dir_path, 0777)
- os.chmod(mu_tb_path, 0666)
+ os.chmod(tb_dir_path, svntest.main.S_ALL_RWX)
+ os.chmod(mu_tb_path, svntest.main.S_ALL_RW)
os.remove(mu_tb_path)
os.rename(mu_saved_tb_path, mu_tb_path)
os.chmod(tb_dir_path, tb_dir_saved_mode)
@@ -480,8 +481,8 @@ def basic_update_corruption(sbox):
mu_saved_tb_path = mu_tb_path + "-saved"
tb_dir_saved_mode = os.stat(tb_dir_path)[stat.ST_MODE]
mu_tb_saved_mode = os.stat(mu_tb_path)[stat.ST_MODE]
- os.chmod(tb_dir_path, 0777)
- os.chmod(mu_tb_path, 0666)
+ os.chmod(tb_dir_path, svntest.main.S_ALL_RWX)
+ os.chmod(mu_tb_path, svntest.main.S_ALL_RW)
shutil.copyfile(mu_tb_path, mu_saved_tb_path)
svntest.main.file_append(mu_tb_path, 'Aiyeeeee, corruption!\nHelp!\n')
os.chmod(tb_dir_path, tb_dir_saved_mode)
@@ -499,8 +500,8 @@ def basic_update_corruption(sbox):
"svn: E155017: Checksum")
# Restore the uncorrupted text base.
- os.chmod(tb_dir_path, 0777)
- os.chmod(mu_tb_path, 0666)
+ os.chmod(tb_dir_path, svntest.main.S_ALL_RWX)
+ os.chmod(mu_tb_path, svntest.main.S_ALL_RW)
os.remove(mu_tb_path)
os.rename(mu_saved_tb_path, mu_tb_path)
os.chmod(tb_dir_path, tb_dir_saved_mode)
@@ -1556,7 +1557,7 @@ def basic_add_ignores(sbox):
foo_c_path = os.path.join(dir_path, 'foo.c')
foo_o_path = os.path.join(dir_path, 'foo.o')
- os.mkdir(dir_path, 0755)
+ os.mkdir(dir_path, svntest.main.S_ALL_RX | stat.S_IWUSR)
open(foo_c_path, 'w')
open(foo_o_path, 'w')
@@ -1607,7 +1608,7 @@ def basic_add_no_ignores(sbox):
foo_lo_path = os.path.join(dir_path, 'foo.lo')
foo_rej_path = os.path.join(dir_path, 'foo.rej')
- os.mkdir(dir_path, 0755)
+ os.mkdir(dir_path, svntest.main.S_ALL_RX | stat.S_IWUSR)
open(foo_c_path, 'w')
open(foo_o_path, 'w')
open(foo_lo_path, 'w')
@@ -1636,9 +1637,9 @@ def basic_add_parents(sbox):
omicron_path = os.path.join(Y_path, 'omicron')
# Create some unversioned directories
- os.mkdir(X_path, 0755)
- os.mkdir(Y_path, 0755)
- os.mkdir(Z_path, 0755)
+ os.mkdir(X_path, svntest.main.S_ALL_RX | stat.S_IWUSR)
+ os.mkdir(Y_path, svntest.main.S_ALL_RX | stat.S_IWUSR)
+ os.mkdir(Z_path, svntest.main.S_ALL_RX | stat.S_IWUSR)
# Create new files
z = open(zeta_path, 'w')
Modified: subversion/trunk/subversion/tests/cmdline/import_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/import_tests.py?rev=1742826&r1=1742825&r2=1742826&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/import_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/import_tests.py Sun May 8 14:15:43 2016
@@ -25,7 +25,7 @@
######################################################################
# General modules
-import re, os.path, sys
+import re, os.path, sys, stat
# Our testing module
import svntest
@@ -70,11 +70,11 @@ def import_executable(sbox):
svntest.main.file_append(path, "some text")
# set executable bits
- os.chmod(all_path, 0777)
- os.chmod(none_path, 0666)
- os.chmod(user_path, 0766)
- os.chmod(group_path, 0676)
- os.chmod(other_path, 0667)
+ os.chmod(all_path, svntest.main.S_ALL_RWX)
+ os.chmod(none_path, svntest.main.S_ALL_RW)
+ os.chmod(user_path, svntest.main.S_ALL_RW | stat.S_IXUSR)
+ os.chmod(group_path, svntest.main.S_ALL_RW | stat.S_IXGRP)
+ os.chmod(other_path, svntest.main.S_ALL_RW | stat.S_IXOTH)
# import new files into repository
url = sbox.repo_url
@@ -149,7 +149,7 @@ def import_ignores(sbox):
foo_c_path = os.path.join(dir_path, 'foo.c')
foo_o_path = os.path.join(dir_path, 'foo.o')
- os.mkdir(dir_path, 0755)
+ os.mkdir(dir_path, svntest.main.S_ALL_RX | stat.S_IWUSR)
open(foo_c_path, 'w')
open(foo_o_path, 'w')
@@ -213,7 +213,7 @@ def import_no_ignores(sbox):
foo_lo_path = os.path.join(dir_path, 'foo.lo')
foo_rej_path = os.path.join(dir_path, 'foo.rej')
- os.mkdir(dir_path, 0755)
+ os.mkdir(dir_path, svntest.main.S_ALL_RX | stat.S_IWUSR)
open(foo_c_path, 'w')
open(foo_o_path, 'w')
open(foo_lo_path, 'w')
@@ -326,7 +326,7 @@ enable-auto-props = yes
imp_dir_path = 'dir'
imp_file_path = os.path.join(imp_dir_path, file_name)
- os.mkdir(imp_dir_path, 0755)
+ os.mkdir(imp_dir_path, svntest.main.S_ALL_RX | stat.S_IWUSR)
svntest.main.file_write(imp_file_path, "This is file test.dsp.\n")
svntest.actions.run_and_verify_svn(None, [], 'import',
@@ -378,7 +378,7 @@ enable-auto-props = yes
imp_dir_path = 'dir2'
imp_file_path = os.path.join(imp_dir_path, file_name)
- os.mkdir(imp_dir_path, 0755)
+ os.mkdir(imp_dir_path, svntest.main.S_ALL_RX | stat.S_IWUSR)
svntest.main.file_append_binary(imp_file_path,
"This is file test.txt.\n" + \
"The second line.\r\n" + \
Modified: subversion/trunk/subversion/tests/cmdline/prop_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/prop_tests.py?rev=1742826&r1=1742825&r2=1742826&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/prop_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/prop_tests.py Sun May 8 14:15:43 2016
@@ -750,7 +750,7 @@ def copy_inherits_special_props(sbox):
# copied file.
if os.name == 'posix':
sbox.simple_propset('svn:executable', 'on', 'new_file1.bin')
- os.chmod(new_path1, 0644)
+ os.chmod(new_path1, svntest.main.S_ALL_READ | stat.S_IWUSR)
# Commit the file
sbox.simple_commit()
Modified: subversion/trunk/subversion/tests/cmdline/revert_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/revert_tests.py?rev=1742826&r1=1742825&r2=1742826&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/revert_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/revert_tests.py Sun May 8 14:15:43 2016
@@ -1132,7 +1132,7 @@ def revert_permissions_only(sbox):
check_executability(path, False)
- os.chmod(sbox.ospath('A/B/E/alpha'), 0444) # read-only
+ os.chmod(sbox.ospath('A/B/E/alpha'), svntest.main.S_ALL_READ) # read-only
is_readonly(sbox.ospath('A/B/E/alpha'))
expected_output = ["Reverted '%s'\n" % sbox.ospath('A/B/E/alpha')]
svntest.actions.run_and_verify_svn(expected_output, [],
@@ -1140,7 +1140,7 @@ def revert_permissions_only(sbox):
is_writable(sbox.ospath('A/B/E/alpha'))
if svntest.main.is_posix_os():
- os.chmod(sbox.ospath('A/B/E/beta'), 0777) # executable
+ os.chmod(sbox.ospath('A/B/E/beta'), svntest.main.S_ALL_RWX) # executable
is_executable(sbox.ospath('A/B/E/beta'))
expected_output = ["Reverted '%s'\n" % sbox.ospath('A/B/E/beta')]
svntest.actions.run_and_verify_svn(expected_output, [],
@@ -1165,7 +1165,7 @@ def revert_permissions_only(sbox):
expected_output,
expected_status)
- os.chmod(sbox.ospath('A/B/E/alpha'), 0666) # not read-only
+ os.chmod(sbox.ospath('A/B/E/alpha'), svntest.main.S_ALL_RW) # not read-only
is_writable(sbox.ospath('A/B/E/alpha'))
expected_output = ["Reverted '%s'\n" % sbox.ospath('A/B/E/alpha')]
svntest.actions.run_and_verify_svn(expected_output, [],
@@ -1173,7 +1173,7 @@ def revert_permissions_only(sbox):
is_readonly(sbox.ospath('A/B/E/alpha'))
if svntest.main.is_posix_os():
- os.chmod(sbox.ospath('A/B/E/beta'), 0666) # not executable
+ os.chmod(sbox.ospath('A/B/E/beta'), svntest.main.S_ALL_RW) # not executable
is_non_executable(sbox.ospath('A/B/E/beta'))
expected_output = ["Reverted '%s'\n" % sbox.ospath('A/B/E/beta')]
svntest.actions.run_and_verify_svn(expected_output, [],
Modified: subversion/trunk/subversion/tests/cmdline/schedule_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/schedule_tests.py?rev=1742826&r1=1742825&r2=1742826&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/schedule_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/schedule_tests.py Sun May 8 14:15:43 2016
@@ -26,7 +26,7 @@
######################################################################
# General modules
-import os, logging
+import os, logging, stat
logger = logging.getLogger()
@@ -198,11 +198,11 @@ def add_executable(sbox):
'propget', "svn:executable", file_ospath)
test_cases = [
- ("all_exe", 0777, 1),
- ("none_exe", 0666, 0),
- ("user_exe", 0766, 1),
- ("group_exe", 0676, 0),
- ("other_exe", 0667, 0),
+ ("all_exe", svntest.main.S_ALL_RWX, 1),
+ ("none_exe", svntest.main.S_ALL_RW, 0),
+ ("user_exe", svntest.main.S_ALL_RW | stat.S_IXUSR, 1),
+ ("group_exe", svntest.main.S_ALL_RW | stat.S_IXGRP, 0),
+ ("other_exe", svntest.main.S_ALL_RW | stat.S_IXOTH, 0),
]
for test_case in test_cases:
runTest(sbox.wc_dir, *test_case)
Modified: subversion/trunk/subversion/tests/cmdline/special_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/special_tests.py?rev=1742826&r1=1742825&r2=1742826&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/special_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/special_tests.py Sun May 8 14:15:43 2016
@@ -25,7 +25,7 @@
######################################################################
# General modules
-import sys, os, re, copy
+import sys, os, re, copy, stat
# Our testing module
import svntest
@@ -972,7 +972,7 @@ def replace_symlinks(sbox):
'A/D/Hx/psi.sh',
]:
file_write(wc(p), '#!/bin/sh\necho "hello, svn!"\n')
- os.chmod(wc(p), 0775)
+ os.chmod(wc(p), svntest.main.S_ALL_RW | stat.S_IXUSR)
sbox.simple_add(p)
if not svntest.main.is_posix_os():
sbox.simple_propset('svn:executable', 'X', p)
Modified: subversion/trunk/subversion/tests/cmdline/svnadmin_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/svnadmin_tests.py?rev=1742826&r1=1742825&r2=1742826&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/svnadmin_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/svnadmin_tests.py Sun May 8 14:15:43 2016
@@ -246,7 +246,7 @@ def patch_format(repo_dir, shard_size):
processed_lines.append(line)
new_contents = "\n".join(processed_lines)
- os.chmod(format_path, 0666)
+ os.chmod(format_path, svntest.main.S_ALL_RW)
open(format_path, 'wb').write(new_contents)
def is_sharded(repo_dir):
@@ -3172,7 +3172,7 @@ def load_no_svndate_r0(sbox):
def hotcopy_read_only(sbox):
"'svnadmin hotcopy' a read-only source repository"
sbox.build()
- svntest.main.chmod_tree(sbox.repo_dir, 0, 0222)
+ svntest.main.chmod_tree(sbox.repo_dir, 0, svntest.main.S_ALL_WRITE)
backup_dir, backup_url = sbox.add_repo_path('backup')
exit_code, output, errput = svntest.main.run_svnadmin("hotcopy",
@@ -3180,7 +3180,8 @@ def hotcopy_read_only(sbox):
backup_dir)
# r/o repos are hard to clean up. Make it writable again.
- svntest.main.chmod_tree(sbox.repo_dir, 0222, 0222)
+ svntest.main.chmod_tree(sbox.repo_dir, svntest.main.S_ALL_WRITE,
+ svntest.main.S_ALL_WRITE)
if errput:
logger.warn("Error: hotcopy failed")
raise SVNUnexpectedStderr(errput)
Modified: subversion/trunk/subversion/tests/cmdline/svnfsfs_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/svnfsfs_tests.py?rev=1742826&r1=1742825&r2=1742826&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/svnfsfs_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/svnfsfs_tests.py Sun May 8 14:15:43 2016
@@ -93,7 +93,7 @@ def patch_format(repo_dir, shard_size):
processed_lines.append(line)
new_contents = "\n".join(processed_lines)
- os.chmod(format_path, 0666)
+ os.chmod(format_path, svntest.main.S_ALL_RW)
open(format_path, 'wb').write(new_contents)
######################################################################
Modified: subversion/trunk/subversion/tests/cmdline/svntest/actions.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/svntest/actions.py?rev=1742826&r1=1742825&r2=1742826&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/svntest/actions.py (original)
+++ subversion/trunk/subversion/tests/cmdline/svntest/actions.py Sun May 8 14:15:43 2016
@@ -166,7 +166,7 @@ def guarantee_greek_repository(path, min
sys.exit(1)
# make the repos world-writeable, for mod_dav_svn's sake.
- main.chmod_tree(path, 0666, 0666)
+ main.chmod_tree(path, main.S_ALL_RW, main.S_ALL_RW)
# give the repository a unique UUID
run_and_verify_svnadmin([], [], 'setuuid', path)
Modified: subversion/trunk/subversion/tests/cmdline/svntest/main.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/svntest/main.py?rev=1742826&r1=1742825&r2=1742826&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/svntest/main.py (original)
+++ subversion/trunk/subversion/tests/cmdline/svntest/main.py Sun May 8 14:15:43 2016
@@ -147,6 +147,19 @@ stack_trace_regexp = r'(?:.*subversion[\
os.environ['LC_ALL'] = 'C'
######################################################################
+# Permission constants used with e.g. chmod() and open().
+# Define them here at a central location, so people aren't tempted to
+# use octal literals which are not portable between Python 2 and 3.
+
+S_ALL_READ = stat.S_IRUSR | stat.S_IRGRP | stat.S_IROTH
+S_ALL_WRITE = stat.S_IWUSR | stat.S_IWGRP | stat.S_IWOTH
+S_ALL_EXEC = stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH
+
+S_ALL_RW = S_ALL_READ | S_ALL_WRITE
+S_ALL_RX = S_ALL_READ | S_ALL_EXEC
+S_ALL_RWX = S_ALL_READ | S_ALL_WRITE | S_ALL_EXEC
+
+######################################################################
# The locations of the svn binaries.
# Use --bin to override these defaults.
def P(relpath,
@@ -902,7 +915,7 @@ def safe_rmtree(dirname, retry=0):
"""Remove the tree at DIRNAME, making it writable first.
If DIRNAME is a symlink, only remove the symlink, not its target."""
def rmtree(dirname):
- chmod_tree(dirname, 0666, 0666)
+ chmod_tree(dirname, S_ALL_RW, S_ALL_RW)
shutil.rmtree(dirname)
if os.path.islink(dirname):
@@ -1005,7 +1018,7 @@ def _post_create_repos(path, minor_versi
new_contents = new_contents[:-1]
# replace it
- os.chmod(format_file_path, 0666)
+ os.chmod(format_file_path, S_ALL_RW)
file_write(format_file_path, new_contents, 'wb')
# post-commit
@@ -1022,7 +1035,7 @@ def _post_create_repos(path, minor_versi
% repr([svnadmin_binary, 'pack', abs_path]))
# make the repos world-writeable, for mod_dav_svn's sake.
- chmod_tree(path, 0666, 0666)
+ chmod_tree(path, S_ALL_RW, S_ALL_RW)
def _unpack_precooked_repos(path, template):
testdir = os.path.dirname(os.path.abspath(os.path.dirname(__file__)))
@@ -1199,7 +1212,7 @@ def create_python_hook_script(hook_path,
else:
# For all other platforms
file_write(hook_path, "#!%s\n%s" % (sys.executable, hook_script_code))
- os.chmod(hook_path, 0755)
+ os.chmod(hook_path, S_ALL_RW | stat.S_IXUSR)
def create_http_connection(url, debuglevel=9):
"""Create an http(s) connection to the host specified by URL.
Modified: subversion/trunk/subversion/tests/cmdline/upgrade_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/upgrade_tests.py?rev=1742826&r1=1742825&r2=1742826&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/upgrade_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/upgrade_tests.py Sun May 8 14:15:43 2016
@@ -36,6 +36,7 @@ import sys
import tarfile
import tempfile
import logging
+import stat
logger = logging.getLogger()
@@ -390,7 +391,7 @@ def xml_entries_relocate(path, from_url,
adm_name = svntest.main.get_admin_name()
entries = os.path.join(path, adm_name, 'entries')
txt = open(entries).read().replace('url="' + from_url, 'url="' + to_url)
- os.chmod(entries, 0777)
+ os.chmod(entries, svntest.main.S_ALL_RWX)
open(entries, 'w').write(txt)
for dirent in os.listdir(path):
@@ -408,7 +409,7 @@ def simple_entries_replace(path, from_ur
adm_name = svntest.main.get_admin_name()
entries = os.path.join(path, adm_name, 'entries')
txt = open(entries).read().replace(from_url, to_url)
- os.chmod(entries, 0777)
+ os.chmod(entries, svntest.main.S_ALL_RWX)
open(entries, 'wb').write(txt)
for dirent in os.listdir(path):
@@ -1462,14 +1463,15 @@ def auto_analyze(sbox):
# svntest.main.chmod_tree will not reset it.)
for path, subdirs, files in os.walk(sbox.wc_dir):
for d in subdirs:
- os.chmod(os.path.join(path, d), 0555)
+ os.chmod(os.path.join(path, d), svntest.main.S_ALL_RX)
for f in files:
- os.chmod(os.path.join(path, f), 0444)
+ os.chmod(os.path.join(path, f), svntest.main.S_ALL_READ)
state = svntest.actions.get_virginal_state(sbox.wc_dir, 1)
svntest.actions.run_and_verify_status(sbox.wc_dir, state)
- svntest.main.chmod_tree(sbox.wc_dir, 0666, 0022)
+ svntest.main.chmod_tree(sbox.wc_dir, svntest.main.S_ALL_RW,
+ stat.S_IWGRP | stat.S_IWOTH)
state = svntest.actions.get_virginal_state(sbox.wc_dir, 1)
svntest.actions.run_and_verify_status(sbox.wc_dir, state)
Modified: subversion/trunk/tools/client-side/change-svn-wc-format.py
URL: http://svn.apache.org/viewvc/subversion/trunk/tools/client-side/change-svn-wc-format.py?rev=1742826&r1=1742825&r2=1742826&view=diff
==============================================================================
--- subversion/trunk/tools/client-side/change-svn-wc-format.py (original)
+++ subversion/trunk/tools/client-side/change-svn-wc-format.py Sun May 8 14:15:43 2016
@@ -24,6 +24,7 @@
import sys
import os
import getopt
+import stat
try:
my_getopt = getopt.gnu_getopt
except AttributeError:
@@ -265,11 +266,11 @@ class Entries:
assert len(str(format_nbr)) <= self.format_nbr_bytes
format_string = '%0' + str(self.format_nbr_bytes) + 'd'
- os.chmod(self.path, 0600)
+ os.chmod(self.path, stat.S_IRUSR | stat.S_IWUSR)
output = open(self.path, "r+", 0)
output.write(format_string % format_nbr)
output.close()
- os.chmod(self.path, 0400)
+ os.chmod(self.path, stat.S_IRUSR)
class Entry:
"Describes an entry in a WC."
@@ -334,14 +335,14 @@ class Format:
if os.path.exists(self.path):
if verbosity >= 1:
print("%s will be updated." % self.path)
- os.chmod(self.path,0600)
+ os.chmod(self.path, stat.S_IRUSR | stat.S_IWUSR)
else:
if verbosity >= 1:
print("%s does not exist, creating it." % self.path)
format = open(self.path, "w")
format.write(format_string % format_nbr)
format.close()
- os.chmod(self.path, 0400)
+ os.chmod(self.path, stat.S_IRUSR)
class LocalException(Exception):
"""Root of local exception class hierarchy."""
Modified: subversion/trunk/tools/server-side/svnpubsub/daemonize.py
URL: http://svn.apache.org/viewvc/subversion/trunk/tools/server-side/svnpubsub/daemonize.py?rev=1742826&r1=1742825&r2=1742826&view=diff
==============================================================================
--- subversion/trunk/tools/server-side/svnpubsub/daemonize.py (original)
+++ subversion/trunk/tools/server-side/svnpubsub/daemonize.py Sun May 8 14:15:43 2016
@@ -24,6 +24,7 @@ import os
import signal
import sys
import time
+import stat
import multiprocessing # requires Python 2.6
@@ -179,7 +180,8 @@ class Daemon(object):
os.remove(self.pidfile)
except OSError:
pass
- fd = os.open(self.pidfile, os.O_WRONLY | os.O_CREAT | os.O_EXCL, 0444)
+ fd = os.open(self.pidfile, os.O_WRONLY | os.O_CREAT | os.O_EXCL,
+ stat.S_IRUSR | stat.S_IRGRP | stat.S_IROTH)
os.write(fd, '%d\n' % pid)
os.close(fd)
Modified: subversion/trunk/tools/server-side/svnpubsub/svnwcsub.py
URL: http://svn.apache.org/viewvc/subversion/trunk/tools/server-side/svnpubsub/svnwcsub.py?rev=1742826&r1=1742825&r2=1742826&view=diff
==============================================================================
--- subversion/trunk/tools/server-side/svnpubsub/svnwcsub.py (original)
+++ subversion/trunk/tools/server-side/svnpubsub/svnwcsub.py Sun May 8 14:15:43 2016
@@ -47,6 +47,7 @@ import errno
import subprocess
import threading
import sys
+import stat
import os
import re
import posixpath
@@ -482,7 +483,7 @@ def handle_options(options):
except OSError:
pass
fd = os.open(options.pidfile, os.O_WRONLY | os.O_CREAT | os.O_EXCL,
- 0444)
+ stat.S_IRUSR | stat.S_IRGRP | stat.S_IROTH)
os.write(fd, '%d\n' % pid)
os.close(fd)
logging.info('pid %d written to %s', pid, options.pidfile)
RE: svn commit: r1742826 - in /subversion/trunk:
subversion/tests/cmdline/ subversion/tests/cmdline/svntest/
tools/client-side/ tools/server-side/svnpubsub/
Posted by Markus Schaber <m....@codesys.com>.
Hi,
From: Stefan Fuhrmann [mailto:stefan2@apache.org]
> On 10.05.2016 00:15, Daniel Shahaf wrote:
> > stefan2@apache.org wrote on Sun, May 08, 2016 at 14:15:43 -0000:
> >>
> >> #####################################################################
> >> #
> >> +# Permission constants used with e.g. chmod() and open().
> >> +# Define them here at a central location, so people aren't tempted
> >> +to # use octal literals which are not portable between Python 2 and 3.
> > For future reference, octal constants with leading "0o" work in both
> > py2 and py3:
> >
> >>>> 0o777 # works in py2 and py3
> >>>> 0777 # works in py2; syntax error in py3
> Interesting. The online source that I found made it seem like there was no
> compatible way and suggested decimals.
According to the "official" source, the syntax was to be backported to Python 2.6:
https://www.python.org/dev/peps/pep-3127/
The changelist of Python 2.6 seems to agree:
https://docs.python.org/2/whatsnew/2.6.html#pep-3127-integer-literal-support-and-syntax
> Anyway, using symbolic constants is certainly even better.
Throughout the code, yes, but even those could be defined in terms of octal literals. :-)
Best regards
Markus Schaber
CODESYS® a trademark of 3S-Smart Software Solutions GmbH
Inspiring Automation Solutions
3S-Smart Software Solutions GmbH
Dipl.-Inf. Markus Schaber | Product Development Core Technology
Memminger Str. 151 | 87439 Kempten | Germany
Tel. +49-831-54031-979 | Fax +49-831-54031-50
E-Mail: m.schaber@codesys.com | Web: http://www.codesys.com | CODESYS store: http://store.codesys.com
CODESYS forum: http://forum.codesys.com
Managing Directors: Dipl.Inf. Dieter Hess, Dipl.Inf. Manfred Werner | Trade register: Kempten HRB 6186 | Tax ID No.: DE 167014915
This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received
this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorised copying, disclosure
or distribution of the material in this e-mail is strictly forbidden.
RE: svn commit: r1742826 - in /subversion/trunk:
subversion/tests/cmdline/ subversion/tests/cmdline/svntest/
tools/client-side/ tools/server-side/svnpubsub/
Posted by Markus Schaber <m....@codesys.com>.
Hi,
From: Stefan Fuhrmann [mailto:stefan2@apache.org]
> On 10.05.2016 00:15, Daniel Shahaf wrote:
> > stefan2@apache.org wrote on Sun, May 08, 2016 at 14:15:43 -0000:
> >>
> >> #####################################################################
> >> #
> >> +# Permission constants used with e.g. chmod() and open().
> >> +# Define them here at a central location, so people aren't tempted
> >> +to # use octal literals which are not portable between Python 2 and 3.
> > For future reference, octal constants with leading "0o" work in both
> > py2 and py3:
> >
> >>>> 0o777 # works in py2 and py3
> >>>> 0777 # works in py2; syntax error in py3
> Interesting. The online source that I found made it seem like there was no
> compatible way and suggested decimals.
According to the "official" source, the syntax was to be backported to Python 2.6:
https://www.python.org/dev/peps/pep-3127/
The changelist of Python 2.6 seems to agree:
https://docs.python.org/2/whatsnew/2.6.html#pep-3127-integer-literal-support-and-syntax
> Anyway, using symbolic constants is certainly even better.
Throughout the code, yes, but even those could be defined in terms of octal literals. :-)
Best regards
Markus Schaber
CODESYS® a trademark of 3S-Smart Software Solutions GmbH
Inspiring Automation Solutions
3S-Smart Software Solutions GmbH
Dipl.-Inf. Markus Schaber | Product Development Core Technology
Memminger Str. 151 | 87439 Kempten | Germany
Tel. +49-831-54031-979 | Fax +49-831-54031-50
E-Mail: m.schaber@codesys.com | Web: http://www.codesys.com | CODESYS store: http://store.codesys.com
CODESYS forum: http://forum.codesys.com
Managing Directors: Dipl.Inf. Dieter Hess, Dipl.Inf. Manfred Werner | Trade register: Kempten HRB 6186 | Tax ID No.: DE 167014915
This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received
this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorised copying, disclosure
or distribution of the material in this e-mail is strictly forbidden.
Re: svn commit: r1742826 - in /subversion/trunk:
subversion/tests/cmdline/ subversion/tests/cmdline/svntest/
tools/client-side/ tools/server-side/svnpubsub/
Posted by Stefan Fuhrmann <st...@apache.org>.
On 10.05.2016 00:15, Daniel Shahaf wrote:
> stefan2@apache.org wrote on Sun, May 08, 2016 at 14:15:43 -0000:
>> ######################################################################
>> +# Permission constants used with e.g. chmod() and open().
>> +# Define them here at a central location, so people aren't tempted to
>> +# use octal literals which are not portable between Python 2 and 3.
> For future reference, octal constants with leading "0o" work in both py2
> and py3:
>
>>>> 0o777 # works in py2 and py3
>>>> 0777 # works in py2; syntax error in py3
Interesting. The online source that I found made it seem
like there was no compatible way and suggested decimals.
Anyway, using symbolic constants is certainly even better.
-- Stefan^2.
Re: svn commit: r1742826 - in /subversion/trunk:
subversion/tests/cmdline/ subversion/tests/cmdline/svntest/
tools/client-side/ tools/server-side/svnpubsub/
Posted by Stefan Fuhrmann <st...@apache.org>.
On 10.05.2016 00:15, Daniel Shahaf wrote:
> stefan2@apache.org wrote on Sun, May 08, 2016 at 14:15:43 -0000:
>> ######################################################################
>> +# Permission constants used with e.g. chmod() and open().
>> +# Define them here at a central location, so people aren't tempted to
>> +# use octal literals which are not portable between Python 2 and 3.
> For future reference, octal constants with leading "0o" work in both py2
> and py3:
>
>>>> 0o777 # works in py2 and py3
>>>> 0777 # works in py2; syntax error in py3
Interesting. The online source that I found made it seem
like there was no compatible way and suggested decimals.
Anyway, using symbolic constants is certainly even better.
-- Stefan^2.
Re: svn commit: r1742826 - in /subversion/trunk:
subversion/tests/cmdline/ subversion/tests/cmdline/svntest/
tools/client-side/ tools/server-side/svnpubsub/
Posted by Daniel Shahaf <da...@apache.org>.
stefan2@apache.org wrote on Sun, May 08, 2016 at 14:15:43 -0000:
> ######################################################################
> +# Permission constants used with e.g. chmod() and open().
> +# Define them here at a central location, so people aren't tempted to
> +# use octal literals which are not portable between Python 2 and 3.
For future reference, octal constants with leading "0o" work in both py2
and py3:
>>> 0o777 # works in py2 and py3
>>> 0777 # works in py2; syntax error in py3
Thanks for doing the py3 work!
Re: svn commit: r1742826 - in /subversion/trunk:
subversion/tests/cmdline/ subversion/tests/cmdline/svntest/
tools/client-side/ tools/server-side/svnpubsub/
Posted by Daniel Shahaf <da...@apache.org>.
stefan2@apache.org wrote on Sun, May 08, 2016 at 14:15:43 -0000:
> ######################################################################
> +# Permission constants used with e.g. chmod() and open().
> +# Define them here at a central location, so people aren't tempted to
> +# use octal literals which are not portable between Python 2 and 3.
For future reference, octal constants with leading "0o" work in both py2
and py3:
>>> 0o777 # works in py2 and py3
>>> 0777 # works in py2; syntax error in py3
Thanks for doing the py3 work!