Skip to content

Fix invalid escape sequences#922

Merged
mattrose merged 1 commit intognome-terminator:masterfrom
meator:fix-invalid-escape-sequences
Jun 20, 2024
Merged

Fix invalid escape sequences#922
mattrose merged 1 commit intognome-terminator:masterfrom
meator:fix-invalid-escape-sequences

Conversation

@meator
Copy link
Copy Markdown
Contributor

@meator meator commented Jun 19, 2024

Hello. I am a Void Linux package maintainer and I have noticed that terminator produces the following syntax warnings when issuing python3 -m compileall:

./usr/lib/python3.12/site-packages/terminatorlib/plugins/maven.py:35: SyntaxWarning: invalid escape sequence '\-'
  maven_filters['apache_maven_plugin_artifact_id'] = 'maven\-(%(apache_maven_plugin_shortname)s)\-plugin' % maven_filters
./usr/lib/python3.12/site-packages/terminatorlib/plugins/maven.py:36: SyntaxWarning: invalid escape sequence '\-'
  maven_filters['codehaus_maven_plugin_artifact_id'] = '(%(codehaus_maven_plugin_shortname)s)\-maven\-plugin' % maven_filters
./usr/lib/python3.12/site-packages/terminatorlib/plugins/maven.py:37: SyntaxWarning: invalid escape sequence '\.'
  maven_filters['maven_plugin_version'] = '[a-zA-Z0-9\.-]+'
./usr/lib/python3.12/site-packages/terminatorlib/plugins/mousefree_url_handler.py:54: SyntaxWarning: invalid escape sequence '\:'
  searchtext  = "https?\:\/\/[^\s]+[\/\w]"
./usr/lib/python3.12/site-packages/terminatorlib/plugins/url_handlers.py:16: SyntaxWarning: invalid escape sequence '\s'
  match = '\\b(lp|LP):?\s?#?[0-9]+(,\s*#?[0-9]+)*\\b'
./usr/lib/python3.12/site-packages/terminatorlib/plugins/url_handlers.py:39: SyntaxWarning: invalid escape sequence '\+'
  match = '\\b((lp|LP):%(project)s(/%(series)s)?|(lp|LP):%(group)s/(%(project)s|\+junk)/%(branch)s)\\b' % lpfilters

This pull request fixes them.

It looks like I'm not the only one who has noticed this problem:

resolves #920

@ScottMcCormack Does this pull request fix the issue for you? Your issue is related to version 2.1.3, so the warnings might be slightly different on master.

These escape sequences cause SyntaxWarnings in some environments.
@mattrose
Copy link
Copy Markdown
Member

Huh, I actually resolved a bunch of them in #886 but apparently I didn't catch them all. I'll pull this down and merge it in, thanks!

@mattrose
Copy link
Copy Markdown
Member

How did you get those warnings? I tried to reproduce this on master and I didn't get any SyntaxWarnings at all. did you just run python3 -m compileall in the terminator dir?

@mattrose
Copy link
Copy Markdown
Member

Gonna merge this in, but still curious as to how you were able to generate those syntax warnings.

@mattrose mattrose merged commit d163314 into gnome-terminator:master Jun 20, 2024
@meator
Copy link
Copy Markdown
Contributor Author

meator commented Jun 20, 2024

I have discovered this issue because the XBPS package manager used by Void Linux has a trigger for byte compiling python packages.

There are likely better ways to reproduce this, but I used the following method to reproduce it manually:

cd terminator
python3 setup.py install --root="$PWD/dest"
cd dest
python3 -m compileall -f -q .

Older versions of Python do not print these warnings. I used Python 3.12.3.

@mminot-yseop
Copy link
Copy Markdown

Hi there @mattrose and everyone.

I ran just now into the related issue (#920) on the same OS as the issue creator (Ubuntu 24), with exactly the same logs, and there are a couple of things about this fix that I’d like to better understand. Please excuse me if my questions are stupid, but:

  • It seems that version 2.1.4 fixes this, but at the time of writing this, apt sticks to 2.1.3 for Ubuntu 24.04 (https://packages.ubuntu.com/noble/terminator). Are there any plans to provide 2.1.3 for 24.04?
  • I don’t understand how severe the consequences of those syntax issues are. Does it partly break Terminator’s setup? I get the No such file or directory: '/etc/xdg/terminator/config' error when launching Terminator after this installation (kinda like in Terminator v2.1.3 Errors on macOS Ventura #787, but just the parts about the XDG config) and I can’t figure out whether this is a related or unrelated issue, nor whether it is safe to use Terminator in this potentially-broken-setup state.

Thanks.

@meator
Copy link
Copy Markdown
Contributor Author

meator commented Apr 16, 2025

I am not a maintainer nor a contributor of gnome-terminator, but I might still be able to answer some of your questions @mminot-yseop:

This is outside the control of terminator. Ubuntu decides which versions of packages it wishes to ship. To quote the Ubuntu documentation (particularly the backports section, which is only partially relevant here, but I like its description of the versioning process):

When Ubuntu releases a new version of its OS every 6 months, that release is largely frozen in time. While the software that is part of that release will get bug fixes and security patches, new major releases of software and the new features that come with them will not be available.

I wasn't able to find any terminator 2.1.4 backport for Ubuntu 24.04 "noble", so the only solution which doesn't require manual tinkering with apt repositories is to update to Ubuntu 24.10 "oracular" which provides terminator v2.1.4.

  • I don’t understand how severe the consequences of those syntax issues are. Does it partly break Terminator’s setup? I get the No such file or directory: '/etc/xdg/terminator/config' error when launching Terminator after this installation (kinda like in Terminator v2.1.3 Errors on macOS Ventura #787, but just the parts about the XDG config) and I can’t figure out whether this is a related or unrelated issue, nor whether it is safe to use Terminator in this potentially-broken-setup state.

This issue is inconsequential and can be mostly ignored. It's unlikely that it caused the issues you're describing.

@mminot-yseop
Copy link
Copy Markdown

Thanks a lot for the detailed answer.
Indeed, Terminator has been working basically as usual despite the installation issues. As for the errors on startup, they seem to have disappeared now. I cannot tell whether this is because Terminator created required config files and directories automatically or if it is the consequence of other package upgrades, though (some of my packages were initially outdated because I naively assumed that the Ubuntu installer ended up doing an automatic apt upgrade 😅).

@mattrose
Copy link
Copy Markdown
Member

Chiming in here late to say that you can update to the latest version from my PPA here: https://launchpad.net/~mattrose/+archive/ubuntu/terminator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SyntaxWarning raised during apt install

3 participants