Fix: r-qualifiers missing from strings with backslashes

There are raw-string qualifiers missing from strings with backslashes
all over the place, fix that.

Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
Jan Lindemann 2025-11-02 08:19:34 +01:00
commit 17bbc88b86
8 changed files with 10 additions and 10 deletions

View file

@ -70,7 +70,7 @@ class Machine(ABC): # export
@property
def exe_basename(self):
return re.sub('\.py$', '', os.path.basename(self.exe_path))
return re.sub(r'\.py$', '', os.path.basename(self.exe_path))
@property
def tmpdir(self):

View file

@ -17,7 +17,7 @@ from ...Connection import Connection
from ...conn.Fifos import Fifos as ConnFifos
from . import Invocation
_ifupdown_script="""#!/bin/bash
_ifupdown_script=r"""#!/bin/bash
#echo exit for test purposes; exit 1
goodbye()
@ -220,7 +220,7 @@ class Machine(MachineBase): # export
self.__task = None
async def __await_monitor_prompt(self, act_timeout=2.):
if await expect(self.monitor, regex='\(qemu\) ', subject="Qemu monitor prompt",
if await expect(self.monitor, regex=r'\(qemu\) ', subject="Qemu monitor prompt",
act_timeout=act_timeout) is None:
raise Exception("timed out waiting for Qemu monitor prompt")
@ -306,7 +306,7 @@ class Machine(MachineBase): # export
return self.__invocation
def net_helper_path(self, up):
if re.search('ifup\|ifdown', self.exe_basename):
if re.search(r'ifup\|ifdown', self.exe_basename):
return None
if not self.__net_helper:
slog_m(INFO, "config = >%s<" % self.invocation.helper_config)

View file

@ -78,7 +78,7 @@ class Audit(ListCmd): # export
self.__multi_regex = [
('match', r'type=SYSCALL'),
('sub', r'0x[0-9a-f]+', '0x<ptr>'),
('sub', 'type=SYSCALL msg=audit\([^)+]\) *:', '')
('sub', r'type=SYSCALL msg=audit\([^)+]\) *:', '')
]
super().__init__(*args, **kwargs)

View file

@ -7,6 +7,6 @@ class CheckMounts(GrepLog): # export
def __init__(self, mounts, act_timeout=2, total_timeout=None):
regexes = []
for mount in mounts:
regexes.append('^{} \+{} \+'.format(*mount))
regexes.append(r'^{} \+{} \+'.format(*mount))
super().__init__(regex=regexes, log_glob='/proc/mounts',
act_timeout=act_timeout, total_timeout=total_timeout)

View file

@ -6,5 +6,5 @@ class ConfigUpdater(GrepLog): # export
def __init__(self, regex = None, log_glob=None, act_timeout=2, total_timeout=None):
if regex is None:
regex = 'Configuration updated (version=.*)\|Configuration (version=.*) is up-to-date (target-version=.*)'
regex = r'Configuration updated (version=.*)\|Configuration (version=.*) is up-to-date (target-version=.*)'
super().__init__(regex=regex, log_glob=log_glob, act_timeout=act_timeout, total_timeout=total_timeout)

View file

@ -11,7 +11,7 @@ class LsofNet(ListCmd): # export
# COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
# systemd 1 root 42u IPv4 9763 0t0 TCP * : 222 (LISTEN)
# confd.smp 1190 root 77u IPv4 27916 0t0 TCP *:ssh (LISTEN)
"^ *(\S+) +([0-9]+) +(\S+) +(\S+) +(\S+) +([0-9]+) +(\S+) +(UDP|TCP) +([^: ])+:([0-9a-z]+) +(\(LISTEN\))",
r"^ *(\S+) +([0-9]+) +(\S+) +(\S+) +(\S+) +([0-9]+) +(\S+) +(UDP|TCP) +([^: ])+:([0-9a-z]+) +(\(LISTEN\))",
[ 'cmd', 'pid', 'user','fd', 'type', 'device','size/off','prot', 'addr', 'port', 'attrib' ],
[ 'cmd', 'user', 'prot', 'addr', 'port' ],
[ 'prot', 'port' ]

View file

@ -9,7 +9,7 @@ class LsofUds(ListCmd): # export
r'lsof +c 15 -U',
# COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
# systemd 1 root 45u unix 0xeeb45200 0t0 9856 /run/systemd/journal/stdout type=STREAM
"^ *(\S+) +([0-9]+) +(\S+) +(\S+) +(\S+) +(0x[0-9a-f]+) +(\S+) +([0-9]+) +(\S+) +type=(\S+)",
r"^ *(\S+) +([0-9]+) +(\S+) +(\S+) +(\S+) +(0x[0-9a-f]+) +(\S+) +([0-9]+) +(\S+) +type=(\S+)",
[ 'cmd', 'pid', 'user','fd', 'type', 'device', 'size/off','node', 'path', 'socktype' ],
[ 'cmd', 'user', 'path', 'socktype' ],
[ 'cmd', 'path' ],

View file

@ -10,7 +10,7 @@ class MountList(ListCmd): # export
#r"/bin/cat /proc/mounts | sed 's/,*size=[0-9]\+[a-z]*//g; s/,*nr_inodes=[0-9]\+//g; s/,,*/,/g'",
r"/bin/cat /proc/mounts",
# proc /proc proc rw,relatime 0 0
"^ *([a-zA-Z0-9/:]+) (/[a-zA-Z0-9/]+) +(\S+) +(\S+) +([0-9]+) +([0-9]+)",
r"^ *([a-zA-Z0-9/:]+) (/[a-zA-Z0-9/]+) +(\S+) +(\S+) +([0-9]+) +([0-9]+)",
[ 'dev', 'mp', 'type','opts','dump', 'fsck'],
[ 'dev', 'mp', 'type','opts' ],
[ 'mp', ]