[Bug 2071678] Re: Python syntax warnings on installation

Nathan Teodosio 2071678 at bugs.launchpad.net
Fri Aug 9 07:43:28 UTC 2024


This patch addresses the syntax errors.

In the process of fixing them, the procedure in pkworker.py

--->
            for filename in values:
                if filename.startswith("/"):
                    pattern = "^%s$" % filename[1:].replace("/", "\/")
                else:
                    pattern = "\\/%s$" % filename
                filenames_regex.append(pattern)
            cmd = ["/usr/bin/apt-file", "--regexp", "--non-interactive",
                   "--package-only", "find", "|".join(filenames_regex)]
<---

confuses me.

1. /usr/bin/apt-file does not have a --non-interactive flag in 24.10.

2. The slash "/" is not a meta-character in regular expressions, so why
is that snippet replacing it with "\/"? Note that

--->   
% apt-file --regexp find '\/usr\/bin\/mv'
% apt-file --regexp find '/usr/bin/mv'
canna-utils: /usr/bin/mvdic
coreutils: /usr/bin/mv
libwww-mediawiki-client-perl: /usr/bin/mvs
samba: /usr/bin/mvxattr
<---

Anyway, I'm not touching that, just fixing the syntax errors.

** Patch added: "invalid-escapes.patch"
   https://bugs.launchpad.net/ubuntu/+source/aptdaemon/+bug/2071678/+attachment/5804016/+files/invalid-escapes.patch

** Changed in: aptdaemon (Ubuntu)
     Assignee: (unassigned) => Nathan Teodosio (nteodosio)

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to aptdaemon in Ubuntu.
https://bugs.launchpad.net/bugs/2071678

Title:
  Python syntax warnings on installation

Status in aptdaemon package in Ubuntu:
  Confirmed

Bug description:
  This concerns python3-aptdaemon 1.1.1+bzr982-0ubuntu44 in Ubuntu
  noble.

  During installation, I see this:

  Setting up python3-aptdaemon (1.1.1+bzr982-0ubuntu44) ...
  /usr/lib/python3/dist-packages/aptdaemon/core.py:96: SyntaxWarning: invalid escape sequence '\-'
    REGEX_VALID_PACKAGENAME = "^[a-z0-9][a-z0-9\-+.]+(:[a-z0-9]+)?$"
  /usr/lib/python3/dist-packages/aptdaemon/core.py:99: SyntaxWarning: invalid escape sequence '\-'
    REGEX_VALID_VERSION = "^[0-9][0-9.+\-A-Za-z:~]*$"
  /usr/lib/python3/dist-packages/aptdaemon/core.py:101: SyntaxWarning: invalid escape sequence '\-'
    REGEX_VALID_RELEASE = "^[a-zA-Z0-9_\-\.]+$"
  /usr/lib/python3/dist-packages/aptdaemon/progress.py:57: SyntaxWarning: invalid escape sequence '\['
    REGEX_ANSI_ESCAPE_CODE = chr(27) + "\[[;?0-9]*[A-Za-z]"
  /usr/lib/python3/dist-packages/aptdaemon/progress.py:667: SyntaxWarning: invalid escape sequence '\s'
    match = re.match("\s*\'(.*)\'\s*\'(.*)\'.*", message_raw)
  /usr/lib/python3/dist-packages/aptdaemon/progress.py:791: SyntaxWarning: invalid escape sequence '\s'
    match = re.match("\s*\'(.*)\'\s*\'(.*)\'.*", status[3])
  /usr/lib/python3/dist-packages/aptdaemon/worker/aptworker.py:462: SyntaxWarning: invalid escape sequence '\S'
    if re.match("(http|https|ftp)://\S+?:\S+?@\S+", uri):
  /usr/lib/python3/dist-packages/aptdaemon/worker/pkworker.py:89: SyntaxWarning: invalid escape sequence '\d'
    MATCH_CVE = "CVE-\d{4}-\d{4}"
  /usr/lib/python3/dist-packages/aptdaemon/worker/pkworker.py:325: SyntaxWarning: invalid escape sequence '\/'
    pattern = "^%s$" % filename[1:].replace("/", "\/")
  /usr/lib/python3/dist-packages/aptdaemon/worker/pkworker.py:327: SyntaxWarning: invalid escape sequence '\/'
    pattern = "\/%s$" % filename
  /usr/lib/python3/dist-packages/aptdaemon/worker/pkworker.py:350: SyntaxWarning: invalid escape sequence '\/'
    pattern = "^%s$" % filename.replace("/", "\/")
  /usr/lib/python3/dist-packages/aptdaemon/worker/pkworker.py:352: SyntaxWarning: invalid escape sequence '\/'
    pattern = ".*\/%s$" % filename
  /usr/lib/python3/dist-packages/aptdaemon/worker/pkworker.py:661: SyntaxWarning: invalid escape sequence '\+'
    "(?P<date>.+) (?P<offset>[-\+][0-9]+)$",

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/aptdaemon/+bug/2071678/+subscriptions




More information about the foundations-bugs mailing list