0001-fix-regex-escape-sequence-error.patch 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. From 6c9cc47e6cc9c6e67b1b822f7a1a2e1f6d836118 Mon Sep 17 00:00:00 2001
  2. From: Adam Duskett <Adamduskett@outlook.com>
  3. Date: Tue, 10 Oct 2017 18:00:30 -0400
  4. Subject: [PATCH] fix regex escape sequence error.
  5. python3.6 will error out with the message "invalid escape sequence"
  6. in genhomedircon.py. This patch fixes these errors by turning the string
  7. in the into a raw string.
  8. Upstream status: accepted
  9. Signed-off-by: Adam Duskett <aduskett@gmail.com>
  10. ---
  11. support/genhomedircon.py | 16 ++++++++--------
  12. 1 file changed, 8 insertions(+), 8 deletions(-)
  13. diff --git a/support/genhomedircon.py b/support/genhomedircon.py
  14. index 036f5cc9..6662f412 100644
  15. --- a/support/genhomedircon.py
  16. +++ b/support/genhomedircon.py
  17. @@ -189,13 +189,13 @@ def oldgenhomedircon(filecontextdir, filecontext):
  18. addme = 1
  19. for regex in prefix_regex:
  20. #match a trailing (/*)? which is actually a bug in rpc_pipefs
  21. - regex = re.sub("\(/\*\)\?$", "", regex)
  22. + regex = re.sub(r"\(/\*\)\?$", "", regex)
  23. #match a trailing .+
  24. - regex = re.sub("\.+$", "", regex)
  25. + regex = re.sub(r"\.+$", "", regex)
  26. #match a trailing .*
  27. - regex = re.sub("\.\*$", "", regex)
  28. + regex = re.sub(r"\.\*$", "", regex)
  29. #strip a (/.*)? which matches anything trailing to a /*$ which matches trailing /'s
  30. - regex = re.sub("\(\/\.\*\)\?", "", regex)
  31. + regex = re.sub(r"\(\/\.\*\)\?", "", regex)
  32. regex = regex + "/*$"
  33. if re.search(regex, potential, 0):
  34. addme = 0
  35. @@ -391,13 +391,13 @@ class selinuxConfig:
  36. exists=1
  37. for regex in prefix_regex:
  38. #match a trailing (/*)? which is actually a bug in rpc_pipefs
  39. - regex = re.sub("\(/\*\)\?$", "", regex)
  40. + regex = re.sub(r"\(/\*\)\?$", "", regex)
  41. #match a trailing .+
  42. - regex = re.sub("\.+$", "", regex)
  43. + regex = re.sub(r"\.+$", "", regex)
  44. #match a trailing .*
  45. - regex = re.sub("\.\*$", "", regex)
  46. + regex = re.sub(r"\.\*$", "", regex)
  47. #strip a (/.*)? which matches anything trailing to a /*$ which matches trailing /'s
  48. - regex = re.sub("\(\/\.\*\)\?", "", regex)
  49. + regex = re.sub(r"\(\/\.\*\)\?", "", regex)
  50. regex = regex + "/*$"
  51. if re.search(regex, home, 0):
  52. exists = 0
  53. --
  54. 2.13.6