@xxfogs IMHO yes, but this is what I’ve done before editing the file in question, create a backup of the file I’m going to modify before modifying the file in question.
cp -pi mailinabox/management/mail_log.py mailinabox/management/mail_log.py.orig
If setup.sh fails, just copy or move the original file over the modifed and rerun setup.sh
How to copy:
cp -pi mailinabox/management/mail_log.py.orig mailinabox/management/mail_log.py
Which will ask you for confirmation before overwriting target file.
How to move:
mv -i mailinabox/management/mail_log.py.orig mailinabox/management/mail_log.py
Which will also ask you for confirmation before overwriting target file.
Or the more brutal method, if there is nothing else to do, destroy the “mailinabox” directory recursively, e.g. all the files and directories in “mailinabox” and “mailinabox” directory it self, and rerun setup.sh.
Keep the same file extension when creating backup files, so you can find the files you’ve modified:
How to find files that have ‘.orig’ extension
find mailinabox/ -type f -name '*.orig' -print
Output of the find command in my case:
mailinabox/management/mail_log.py.orig
And you can also see what changes you’ve made:
diff -u mailinabox/management/mail_log.py.orig mailinabox/management/mail_log.py
Output of the diff command:
--- mailinabox/management/mail_log.py.orig 2024-04-02 08:39:21.613010269 +0300
+++ mailinabox/management/mail_log.py 2024-04-10 21:59:20.023801981 +0300
@@ -679,7 +679,7 @@
data_accum[col] += d[row]
try:
- if None not in {latest, earliest}:
+ if None not in [latest, earliest]: # noqa PLR6201
vert_pos = len(line)
e = earliest[row]
l = latest[row]
@@ -732,7 +732,7 @@
else:
header += l.rjust(max(5, len(l) + 1, col_widths[col]))
- if None not in {latest, earliest}:
+ if None not in [latest, earliest]: # noqa PLR6201
header += " │ timespan "
lines.insert(0, header.rstrip())
@@ -757,7 +757,7 @@
footer += temp.format(data_accum[row])
try:
- if None not in {latest, earliest}:
+ if None not in [latest, earliest]: # noqa PLR6201
max_l = max(latest)
min_e = min(earliest)
timespan = relativedelta(max_l, min_e)