salt icon indicating copy to clipboard operation
salt copied to clipboard

[Bug]: Regression: [salt.modules.aptpkg] WTFSON <re.Match object

Open OrangeDog opened this issue 2 months ago • 5 comments

What happened?

Updated from 3006.14 to 3006.17.

During highstate, multiple errors are logged for each apt repository:

2025-11-24 12:25:21,745 ERROR (126032361854784) [salt.modules.aptpkg] WTFSON <re.Match object; span=(4, 71), match='[arch=amd64 signed-by=/etc/apt/keyrings/zabbix-ar> 2025-11-24 12:25:21,745 ERROR (126032361854784) [salt.modules.aptpkg] WTFSON <re.Match object; span=(4, 69), match='[arch=amd64 signed-by=/etc/apt/keyrings/salt-arch>

However, no states themselves fail.

Example state:

salt repo:
  pkgrepo.managed:
    - name: >
        deb [arch=amd64 signed-by=/etc/apt/keyrings/salt-archive-keyring.gpg]
        http://packages.broadcom.com/artifactory/saltproject-deb/
        stable main
    - file: /etc/apt/sources.list.d/salt.list
    - clean_file: true
    - key_url: https://packages.broadcom.com/artifactory/api/security/keypair/SaltProjectKey/public
    - aptkey: false

Example file:

# cat /etc/apt/sources.list.d/salt.list
deb [arch=amd64 signed-by=/etc/apt/keyrings/salt-archive-keyring.gpg] http://packages.broadcom.com/artifactory/saltproject-deb/ stable main

Type of salt install

Official deb

Major version

3006.x

What supported OS are you seeing the problem on? Can select multiple. (If bug appears on an unsupported OS, please open a GitHub Discussion instead)

ubuntu-24.04

salt --versions-report output

Salt Version:
          Salt: 3006.17

Python Version:
        Python: 3.10.19 (main, Oct 30 2025, 04:53:28) [GCC 11.2.0]

Dependency Versions:
          cffi: 1.17.1
      cherrypy: 18.10.0
  cryptography: 42.0.5
      dateutil: 2.8.1
     docker-py: Not Installed
         gitdb: Not Installed
     gitpython: Not Installed
        Jinja2: 3.1.6
       libgit2: 1.9.1
  looseversion: 1.0.2
      M2Crypto: Not Installed
          Mako: Not Installed
       msgpack: 1.0.2
  msgpack-pure: Not Installed
  mysql-python: Not Installed
     packaging: 24.0
     pycparser: 2.21
      pycrypto: Not Installed
  pycryptodome: 3.19.1
        pygit2: 1.18.2
  python-gnupg: 0.4.8
        PyYAML: 6.0.1
         PyZMQ: 23.2.0
        relenv: 0.21.2
         smmap: Not Installed
       timelib: 0.3.0
       Tornado: 4.5.3
           ZMQ: 4.3.4

System Versions:
          dist: ubuntu 24.04.3 noble
        locale: utf-8
       machine: x86_64
       release: 6.8.0-88-generic
        system: Linux
       version: Ubuntu 24.04.3 noble

OrangeDog avatar Nov 24 '25 12:11 OrangeDog

Same issue here with Debian 11, Debian 12, and Debian 13 after upgrade from 3006.16 to 3006.17.

RolandRosenfeld avatar Nov 24 '25 15:11 RolandRosenfeld

This comes from salt/modules/aptpkg.py:

def _get_opts(line):
    """
    Return all opts in [] for a repo line
    """
    get_opts = re.search(r"\[(.*=.*?)\]", line)
    log.error("WTFSON %s", get_opts)

For me this looks as someone added some debug code and forgot to remove it afterwards. This seems to be from https://github.com/saltstack/salt/commit/1f25d23e10efdff10d685d9157fe6c0f81aa9456

@dwoz: looks a little bit like a last minute commit without removing the debug error log output...

RolandRosenfeld avatar Nov 24 '25 16:11 RolandRosenfeld

To get rid of the errors in the output I use the following Salt state:

{% if grains.saltversion in ["3006.17"] %}
/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/aptpkg.py:
  file.comment:
    - regex: '^    log\.error\(\"WTFSON'
{% endif %}

RolandRosenfeld avatar Nov 24 '25 16:11 RolandRosenfeld

I'm also getting this. New install of 3007.9 (Chlorine) on new Debian 13.2 Trixie VM, from pkgrepo.managed. I suspect it's the [] in my signed-by being interpreted as a regex.

In my case, I'm using sudo salt-call --local, and the stdout says this is an [ERROR ], but the state succeeds.

Also, WTFSON? 😁

chruck avatar Nov 25 '25 22:11 chruck

Just double-checking, the original commit 1f25d23e10efdff10d685d9157fe6c0f81aa9456 added a few more MEH's in the same file:

https://github.com/saltstack/salt/commit/1f25d23e10efdff10d685d9157fe6c0f81aa9456#diff-4942e96e878c10bcad53f5ade902cb904c79835fc642e8a476876afeff18009fR2245

I'd say, they should also be scrubbed.

bascht avatar Dec 05 '25 08:12 bascht