From a629bf1860431853722f5e0e9eaf19e9b556cd22 Mon Sep 17 00:00:00 2001
From: Peng Yan <peng.yan@windriver.com>
Date: Tue, 22 Apr 2025 18:56:37 +0800
Subject: [PATCH 1/1] Fix the invalid escape sequence warning for python3

---
 debian/patches/invalid_escape_sequence | 79 ++++++++++++++++++++++++++
 debian/patches/series                  |  1 +
 2 files changed, 80 insertions(+)
 create mode 100644 debian/patches/invalid_escape_sequence

diff --git a/debian/patches/invalid_escape_sequence b/debian/patches/invalid_escape_sequence
new file mode 100644
index 0000000..9fdf404
--- /dev/null
+++ b/debian/patches/invalid_escape_sequence
@@ -0,0 +1,79 @@
+Description: fix the invalid escape sequence warning for python3
+Author: Peng Yan <peng.yan@windriver.com>
+Last-Update: 2025-04-22
+
+--- a/dstat
++++ b/dstat
+@@ -758,7 +758,7 @@
+     def __init__(self):
+         self.nick = ('read', 'writ')
+         self.type = 'b'
+-        self.diskfilter = re.compile('^([hsv]d[a-z]+\d+|cciss/c\d+d\d+p\d+|dm-\d+|md\d+|mmcblk\d+p\d0|VxVM\d+)$')
++        self.diskfilter = re.compile(r'^([hsv]d[a-z]+\d+|cciss/c\d+d\d+p\d+|dm-\d+|md\d+|mmcblk\d+p\d0|VxVM\d+)$')
+         self.open('/proc/diskstats')
+         self.cols = 2
+ 
+@@ -844,7 +844,7 @@
+     def __init__(self):
+         self.nick = ('read', 'writ')
+         self.type = 'b'
+-        self.diskfilter = re.compile('^([hsv]d[a-z]+\d+|cciss/c\d+d\d+p\d+|dm-\d+|md\d+|mmcblk\d+p\d0|VxVM\d+)$')
++        self.diskfilter = re.compile(r'^([hsv]d[a-z]+\d+|cciss/c\d+d\d+p\d+|dm-\d+|md\d+|mmcblk\d+p\d0|VxVM\d+)$')
+         self.open('/proc/partitions')
+         if self.fd and not self.discover:
+             raise Exception('Kernel has no per-partition I/O accounting [CONFIG_BLK_STATS], use at least 2.4.20')
+@@ -929,8 +929,8 @@
+     def __init__(self):
+         self.nick = ('read', 'writ')
+         self.type = 'b'
+-        self.diskfilter = re.compile('^([hsv]d[a-z]+\d+|cciss/c\d+d\d+p\d+|dm-\d+|md\d+|mmcblk\d+p\d0|VxVM\d+)$')
+-        self.regexp = re.compile('^\((\d+),(\d+)\):\(\d+,\d+,(\d+),\d+,(\d+)\)$')
++        self.diskfilter = re.compile(r'^([hsv]d[a-z]+\d+|cciss/c\d+d\d+p\d+|dm-\d+|md\d+|mmcblk\d+p\d0|VxVM\d+)$')
++        self.regexp = re.compile(r'^\((\d+),(\d+)\):\(\d+,\d+,(\d+),\d+,(\d+)\)$')
+         self.open('/proc/stat')
+         self.cols = 2
+ 
+@@ -1181,7 +1181,7 @@
+         self.type = 'f'
+         self.width = 5
+         self.scale = 1000
+-        self.diskfilter = re.compile('^([hsv]d[a-z]+\d+|cciss/c\d+d\d+p\d+|dm-\d+|md\d+|mmcblk\d+p\d0|VxVM\d+)$')
++        self.diskfilter = re.compile(r'^([hsv]d[a-z]+\d+|cciss/c\d+d\d+p\d+|dm-\d+|md\d+|mmcblk\d+p\d0|VxVM\d+)$')
+         self.open('/proc/diskstats')
+         self.cols = 2
+ 
+@@ -1327,7 +1327,7 @@
+     def __init__(self):
+         self.nick = ('recv', 'send')
+         self.type = 'b'
+-        self.totalfilter = re.compile('^(lo|bond\d+|face|.+\.\d+)$')
++        self.totalfilter = re.compile(r'^(lo|bond\d+|face|.+\.\d+)$')
+         self.open('/proc/net/dev')
+         self.cols = 2
+ 
+@@ -2332,7 +2332,7 @@
+ 
+     # Fallback 2
+     try:
+-        search = re.compile('^cpu\d+')
++        search = re.compile(r'^cpu\d+')
+         cpunr = 0
+         for line in dopen('/proc/stat').readlines():
+             if search.match(line):
+@@ -2349,14 +2349,14 @@
+ ### FIXME: Add scsi support too and improve
+ def sysfs_dev(device):
+     "Convert sysfs device names into device names"
+-    m = re.match('ide/host(\d)/bus(\d)/target(\d)/lun(\d)/disc', device)
++    m = re.match(r'ide/host(\d)/bus(\d)/target(\d)/lun(\d)/disc', device)
+     if m:
+         l = m.groups()
+         # ide/host0/bus0/target0/lun0/disc -> 0 -> hda
+         # ide/host0/bus1/target0/lun0/disc -> 2 -> hdc
+         nr = int(l[1]) * 2 + int(l[3])
+         return 'hd' + chr(ord('a') + nr)
+-    m = re.match('cciss/(c\dd\d)', device)
++    m = re.match(r'cciss/(c\dd\d)', device)
+     if m:
+         l = m.groups()
+         return l[0]
diff --git a/debian/patches/series b/debian/patches/series
index 711dffc..4c2b2ab 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -7,3 +7,4 @@ name_error
 docs_no_make_clean
 extract-print-plugin-name
 make-test-no-plugins
+invalid_escape_sequence
-- 
2.17.1

