phusion / baseimage-docker

A minimal Ubuntu base image modified for Docker-friendliness
http://phusion.github.io/baseimage-docker/
MIT License
8.96k stars 1.09k forks source link

Prevent 'invalid escape sequence' errors in newer Python versions #637

Closed MrSerth closed 7 months ago

MrSerth commented 7 months ago

Description of the change

This PR changes two additional occurrences of RegEx character classes to work with upcoming Python versions

Benefits

The existing code continues to work with Python 3.12+. Otherwise, the following error is returned:

/sbin/my_init:25: SyntaxWarning: invalid escape sequence '\W'
  SHENV_NAME_WHITELIST_REGEX = re.compile('\W')
/sbin/my_init:96: SyntaxWarning: invalid escape sequence '\Z'
  value = re.sub('\n\Z', '', f.read())

Possible drawbacks

None, backward compatible change.

Applicable issues

None

Additional information

None