[prev in list] [next in list] [prev in thread] [next in thread]
List: subversion-commits
Subject: svn commit: r1721174 - /subversion/trunk/tools/backup/hot-backup.py.in
From: danielsh () apache ! org
Date: 2015-12-21 15:00:41
Message-ID: 20151221150041.C9F423A0051 () svn01-us-west ! apache ! org
[Download RAW message or body]
Author: danielsh
Date: Mon Dec 21 15:00:41 2015
New Revision: 1721174
URL: http://svn.apache.org/viewvc?rev=1721174&view=rev
Log:
hot-backup.py: Housekeeping.
* tools/backup/hot-backup.py.in: Escape positional arguments and regexp injects.
Modified:
subversion/trunk/tools/backup/hot-backup.py.in
Modified: subversion/trunk/tools/backup/hot-backup.py.in
URL: http://svn.apache.org/viewvc/subversion/trunk/tools/backup/hot-backup.py.in?rev=1721174&r1=1721173&r2=1721174&view=diff
==============================================================================
--- subversion/trunk/tools/backup/hot-backup.py.in (original)
+++ subversion/trunk/tools/backup/hot-backup.py.in Mon Dec 21 15:00:41 2015
@@ -198,7 +198,7 @@ def get_youngest_revision():
"""Examine the repository REPO_DIR using the svnlook binary
specified by SVNLOOK, and return the youngest revision."""
- p = subprocess.Popen([svnlook, 'youngest', repo_dir],
+ p = subprocess.Popen([svnlook, 'youngest', '--', repo_dir],
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
@@ -245,7 +245,7 @@ backup_subdir = os.path.join(backup_dir,
# rather than start from 1 and increment because the starting
# increments may have already been removed due to num_backups.
-regexp = re.compile("^" + repo + "-" + youngest +
+regexp = re.compile("^" + re.escape(repo) + "-" + re.escape(youngest) +
"(-(?P<increment>[0-9]+))?" + ext_re + "$")
directory_list = os.listdir(backup_dir)
young_list = [x for x in directory_list if regexp.search(x)]
@@ -262,8 +262,8 @@ if young_list:
### copied last.
print("Backing up repository to '" + backup_subdir + "'...")
-err_code = subprocess.call([svnadmin, "hotcopy", repo_dir,
- backup_subdir, "--clean-logs"])
+err_code = subprocess.call([svnadmin, "hotcopy", "--clean-logs",
+ '--', repo_dir, backup_subdir])
if err_code != 0:
sys.stderr.write("Unable to backup the repository.\n")
sys.stderr.flush()
@@ -274,7 +274,7 @@ else:
### Step 4: Verify the hotcopy
if verify_copy:
print("Verifying backup...")
- err_code = subprocess.call([svnadmin, "verify", "--quiet", backup_subdir])
+ err_code = subprocess.call([svnadmin, "verify", "--quiet", '--', backup_subdir])
if err_code != 0:
sys.stderr.write("Backup verification failed.\n")
sys.stderr.flush()
@@ -340,7 +340,7 @@ if archive_type:
### NUM_BACKUPS.
if num_backups > 0:
- regexp = re.compile("^" + repo + "-[0-9]+(-[0-9]+)?" + ext_re + "$")
+ regexp = re.compile("^" + re.escape(repo) + "-[0-9]+(-[0-9]+)?" + ext_re + "$")
directory_list = os.listdir(backup_dir)
old_list = [x for x in directory_list if regexp.search(x)]
old_list.sort(comparator)
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic