#1095036 systemctl: Syntax Warning: invalid escape sequence '\w'

Package:
systemctl
Source:
systemctl
Submitter:
Andrew Bower
Date:
2025-02-28 12:27:03 UTC
Severity:
normal
Tags:
#1095036#5
Date:
2025-02-02 21:50:56 UTC
From:
To:
Dear Maintainer,

Any invocation of systemctl results in 8 lines of warnings that have been
introduced to Python in some recent version.

# systemctl status
/usr/bin/systemctl:1541: SyntaxWarning: invalid escape sequence '\w'
  expanded = re.sub("[$](\w+)", lambda m: get_env1(m), cmd.replace("\\\n",""))
/usr/bin/systemctl:1543: SyntaxWarning: invalid escape sequence '\w'
  new_text = re.sub("[$][{](\w+)[}]", lambda m: get_env2(m), expanded)
/usr/bin/systemctl:1628: SyntaxWarning: invalid escape sequence '\w'
  cmd3 = re.sub("[$](\w+)", lambda m: get_env1(m), cmd2)
/usr/bin/systemctl:1631: SyntaxWarning: invalid escape sequence '\w'
  newcmd += [ re.sub("[$][{](\w+)[}]", lambda m: get_env2(m), part) ]

Reporting from sid but I have seen this on bookworm, too.

I've raised this as 'minor' but it's pretty annoying and easy to fix.

Thanks!

#1095036#10
Date:
2025-02-22 22:48:00 UTC
From:
To:
Control: tags -1 patch

Although ostensibly minor, I think this level of warning (since Python
3.12) is excessive and could be more serious if it obscured error output
in logs. I therefore think this is worth fixing, even if packaging a
newer upstream would be too much work for now.

I attach a patch which applies a backport of the upstream fix.

Thanks,

Andrew

#1095036#17
Date:
2025-02-22 22:48:00 UTC
From:
To:
Control: tags -1 patch

Although ostensibly minor, I think this level of warning (since Python
3.12) is excessive and could be more serious if it obscured error output
in logs. I therefore think this is worth fixing, even if packaging a
newer upstream would be too much work for now.

I attach a patch which applies a backport of the upstream fix.

Thanks,

Andrew

#1095036#22
Date:
2025-02-22 22:56:19 UTC
From:
To:
Now actually attached - MUA operator error.
#1095036#27
Date:
2025-02-27 21:09:04 UTC
From:
To:
Hi Dmitry,

Would you mind if I tried to prepare a sponsored NMU to your package
with this fix?

I'm sorry I don't think I'm in a position to contribute and test a new
upstream version but I think that this patch is low risk and would be
rather nice to have for users in Trixie with the new Python version!

Thanks,

Andrew

#1095036#30
Date:
2025-02-28 12:23:30 UTC
From:
To:
Hello,

Bug #1095036 in docker-systemctl-replacement reported by you has been fixed in the
Git repository and is awaiting an upload. You can see the commit
message below and you can check the diff of the fix at:

https://salsa.debian.org/debian/docker-systemctl-replacement/-/commit/e142daaab78c6878bb49b4ff0c09b94b611cd8a3
Avoid 8 lines of warning on every invocation since Python 3.12
that potentially obscured more important issues in log output.
------------------------------------------------------------------------

(this message was generated automatically)
-- 
Greetings

https://bugs.debian.org/1095036

#1095036#35
Date:
2025-02-28 12:23:30 UTC
From:
To:
Hello,

Bug #1095036 in docker-systemctl-replacement reported by you has been fixed in the
Git repository and is awaiting an upload. You can see the commit
message below and you can check the diff of the fix at:

https://salsa.debian.org/debian/docker-systemctl-replacement/-/commit/1317da3353731b3ad283be56dee37f8cb9e909a1
------------------------------------------------------------------------
Merge branch 'regex-quoting' into 'master'

Backport upstream fix for regex quoting. (Closes: #1095036)

See merge request debian/docker-systemctl-replacement!2
------------------------------------------------------------------------

(this message was generated automatically)
-- 
Greetings

https://bugs.debian.org/1095036