Skip to content

ntp-chronyd, ntp-ntpd: SyntaxError: f-string: unmatched '(' on python 3.11 #952

@wwuck

Description

@wwuck

This issue respects the following points:

Which variant of the Monitoring Plugins do you use?

  • .rpm/.deb package from repo.linuxfabrik.ch
  • Compiled for Windows from download.linuxfabrik.ch
  • Source Code from GitHub

Bug description

I upgraded to monitoring-plugins v2.2.0 today and I am getting a SyntaxError when running ntp-chronyd on python 3.11.

I don't see this error when running on python 3.13.

Steps to reproduce - Plugin call

/usr/lib64/nagios/plugins/ntp-chronyd

Steps to reproduce - Data

# /usr/lib64/nagios/plugins/ntp-chronyd
  File "/usr/lib64/nagios/plugins/ntp-chronyd", line 161
    f'Stratum is {stratum}'
                           ^
SyntaxError: f-string: unmatched '('
$ flake8 ntp-chronyd
ntp-chronyd:161:36: E999 SyntaxError: f-string: unmatched '('

Environment

# apt policy python3
python3:
  Installed: 3.11.2-1+b1
  Candidate: 3.11.2-1+b1
  Version table:
 *** 3.11.2-1+b1 500
        500 http://deb.devuan.org/merged daedalus/main amd64 Packages
        100 /var/lib/dpkg/status

I can also reproduce the error with python3.11.13 installed from pyenv and the python:3.11 docker image.

Plugin Version

ntp-chronyd: v2025091501 by Linuxfabrik GmbH, Zurich/Switzerland

Python version

3.11.2 and 3.11.13

List of Python modules

root@9e4cc4c736a2:/# python3 -c "help('modules')"

Please wait a moment while I gather a list of all available modules...

/usr/local/lib/python3.11/site-packages/_distutils_hack/__init__.py:33: UserWarning: Setuptools is replacing distutils.
  warnings.warn("Setuptools is replacing distutils.")
__future__          _testimportmultiple getopt              secrets
__hello__           _testinternalcapi   getpass             select
__phello__          _testmultiphase     gettext             selectors
_abc                _thread             glob                setuptools
_aix_support        _threading_local    graphlib            shelve
_ast                _tkinter            grp                 shlex
_asyncio            _tokenize           gzip                shutil
_bisect             _tracemalloc        hashlib             signal
_blake2             _typing             heapq               site
_bootsubprocess     _uuid               hmac                smtpd
_bz2                _warnings           html                smtplib
_codecs             _weakref            http                sndhdr
_codecs_cn          _weakrefset         idlelib             socket
_codecs_hk          _xxsubinterpreters  imaplib             socketserver
_codecs_iso2022     _xxtestfuzz         imghdr              spwd
_codecs_jp          _zoneinfo           imp                 sqlite3
_codecs_kr          abc                 importlib           sre_compile
_codecs_tw          aifc                inspect             sre_constants
_collections        antigravity         io                  sre_parse
_collections_abc    argparse            ipaddress           ssl
_compat_pickle      array               itertools           stat
_compression        ast                 json                statistics
_contextvars        asynchat            keyword             string
_crypt              asyncio             lib2to3             stringprep
_csv                asyncore            linecache           struct
_ctypes             atexit              locale              subprocess
_ctypes_test        audioop             logging             sunau
_curses             base64              lzma                symtable
_curses_panel       bdb                 mailbox             sys
_datetime           binascii            mailcap             sysconfig
_dbm                bisect              marshal             syslog
_decimal            builtins            math                tabnanny
_distutils_hack     bz2                 mimetypes           tarfile
_elementtree        cProfile            mmap                telnetlib
_functools          calendar            modulefinder        tempfile
_gdbm               cgi                 multiprocessing     termios
_hashlib            cgitb               netrc               textwrap
_heapq              chunk               nntplib             this
_imp                cmath               ntpath              threading
_io                 cmd                 nturl2path          time
_json               code                numbers             timeit
_locale             codecs              opcode              tkinter
_lsprof             codeop              operator            token
_lzma               collections         optparse            tokenize
_markupbase         colorsys            os                  tomllib
_md5                compileall          ossaudiodev         trace
_multibytecodec     concurrent          pathlib             traceback
_multiprocessing    configparser        pdb                 tracemalloc
_opcode             contextlib          pickle              tty
_operator           contextvars         pickletools         turtle
_osx_support        copy                pip                 turtledemo
_pickle             copyreg             pipes               types
_posixshmem         crypt               pkg_resources       typing
_posixsubprocess    csv                 pkgutil             unicodedata
_py_abc             ctypes              platform            unittest
_pydecimal          curses              plistlib            urllib
_pyio               dataclasses         poplib              uu
_queue              datetime            posix               uuid
_random             dbm                 posixpath           venv
_sha1               decimal             pprint              warnings
_sha256             difflib             profile             wave
_sha3               dis                 pstats              weakref
_sha512             distutils           pty                 webbrowser
_signal             doctest             pwd                 wheel
_sitebuiltins       email               py_compile          wsgiref
_socket             encodings           pyclbr              xdrlib
_sqlite3            ensurepip           pydoc               xml
_sre                enum                pydoc_data          xmlrpc
_ssl                errno               pyexpat             xxlimited
_stat               faulthandler        queue               xxlimited_35
_statistics         fcntl               quopri              xxsubtype
_string             filecmp             random              zipapp
_strptime           fileinput           re                  zipfile
_struct             fnmatch             readline            zipimport
_symtable           fractions           reprlib             zlib
_sysconfigdata__linux_x86_64-linux-gnu ftplib              resource            zoneinfo
_testbuffer         functools           rlcompleter
_testcapi           gc                  runpy
_testclinic         genericpath         sched

Enter any module name to get more help.  Or, type "modules spam" to search
for modules whose name or summary contain the string "spam".

Additional Information

Also tested with latest commit 74c281b

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions