aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Duskett <Adamduskett@outlook.com>2017-10-10 18:00:30 -0400
committerJason Zaman <jason@perfinion.com>2017-10-29 20:59:08 +0800
commit7d6bc428460407eec6715b9aa2d303cc3a8f36a1 (patch)
tree8ed9f09c7b92172dfe6ed5af0445efa85adf9984 /support
parentdevices: Module version bump. (diff)
downloadhardened-refpolicy-7d6bc428460407eec6715b9aa2d303cc3a8f36a1.tar.gz
hardened-refpolicy-7d6bc428460407eec6715b9aa2d303cc3a8f36a1.tar.bz2
hardened-refpolicy-7d6bc428460407eec6715b9aa2d303cc3a8f36a1.zip
fix regex escape sequence error.
python3.6 will error out with the message "invalid escape sequence" in genhomedircon.py. This patch fixes these errors by turning the string in the into a raw string.
Diffstat (limited to 'support')
-rw-r--r--support/genhomedircon.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/support/genhomedircon.py b/support/genhomedircon.py
index 036f5cc93..6662f412a 100644
--- a/support/genhomedircon.py
+++ b/support/genhomedircon.py
@@ -189,13 +189,13 @@ def oldgenhomedircon(filecontextdir, filecontext):
addme = 1
for regex in prefix_regex:
#match a trailing (/*)? which is actually a bug in rpc_pipefs
- regex = re.sub("\(/\*\)\?$", "", regex)
+ regex = re.sub(r"\(/\*\)\?$", "", regex)
#match a trailing .+
- regex = re.sub("\.+$", "", regex)
+ regex = re.sub(r"\.+$", "", regex)
#match a trailing .*
- regex = re.sub("\.\*$", "", regex)
+ regex = re.sub(r"\.\*$", "", regex)
#strip a (/.*)? which matches anything trailing to a /*$ which matches trailing /'s
- regex = re.sub("\(\/\.\*\)\?", "", regex)
+ regex = re.sub(r"\(\/\.\*\)\?", "", regex)
regex = regex + "/*$"
if re.search(regex, potential, 0):
addme = 0
@@ -391,13 +391,13 @@ class selinuxConfig:
exists=1
for regex in prefix_regex:
#match a trailing (/*)? which is actually a bug in rpc_pipefs
- regex = re.sub("\(/\*\)\?$", "", regex)
+ regex = re.sub(r"\(/\*\)\?$", "", regex)
#match a trailing .+
- regex = re.sub("\.+$", "", regex)
+ regex = re.sub(r"\.+$", "", regex)
#match a trailing .*
- regex = re.sub("\.\*$", "", regex)
+ regex = re.sub(r"\.\*$", "", regex)
#strip a (/.*)? which matches anything trailing to a /*$ which matches trailing /'s
- regex = re.sub("\(\/\.\*\)\?", "", regex)
+ regex = re.sub(r"\(\/\.\*\)\?", "", regex)
regex = regex + "/*$"
if re.search(regex, home, 0):
exists = 0