Commit c0017ce4 authored by Ximin Luo's avatar Ximin Luo

Add a safety device to guard against typos

parent 46866143
......@@ -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
# remove any existing artifact, in case the build script doesn't overwrite
# it e.g. like how make(1) sometimes works.
if"""(^| )['"]*/""", artifact_pattern):
raise ValueError("artifact_pattern is possibly dangerous; refusing to continue")
['sh', '-ec', 'cd "%s" && rm -rf %s' %
(source_root, artifact_pattern)])
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment