[reprotest] 01/01: Add a safety device to guard against typos
Ximin Luo
infinity0 at debian.org
Fri Sep 23 19:08:48 UTC 2016
This is an automated email from the git hooks/post-receive script.
infinity0 pushed a commit to branch master
in repository reprotest.
commit c0017ce4e88d8716627e8ec161c1d561e018016c
Author: Ximin Luo <infinity0 at debian.org>
Date: Fri Sep 23 21:08:29 2016 +0200
Add a safety device to guard against typos
---
reprotest/__init__.py | 3 +++
1 file changed, 3 insertions(+)
diff --git a/reprotest/__init__.py b/reprotest/__init__.py
index 93af791..7dbc65b 100644
--- a/reprotest/__init__.py
+++ b/reprotest/__init__.py
@@ -7,6 +7,7 @@ import configparser
import logging
import os
import pathlib
+import re
import subprocess
import sys
import tempfile
@@ -294,6 +295,8 @@ def build(script, source_root, dist_root, artifact_pattern, testbed, artifact_st
print(artifact_pattern)
# remove any existing artifact, in case the build script doesn't overwrite
# it e.g. like how make(1) sometimes works.
+ if re.search(r"""(^| )['"]*/""", artifact_pattern):
+ raise ValueError("artifact_pattern is possibly dangerous; refusing to continue")
testbed.check_exec(
['sh', '-ec', 'cd "%s" && rm -rf %s' %
(source_root, artifact_pattern)])
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/reprotest.git
More information about the Reproducible-commits
mailing list