#1144982 python3.14 says /sbin/rpcctl:47: SyntaxWarning: 'return' in a 'finally' block

Package:
nfs-common
Source:
nfs-common
Description:
NFS support files common to client and server
Submitter:
Trent W. Buck
Date:
2026-09-23 07:07:02 UTC
Severity:
normal
Tags:
#1144982#5
Date:
2026-08-21 07:14:59 UTC
From:
To:
Debian 14 / python 3.14 now complains about rpcctl.

    root@hera:/# rpcctl --help
    /sbin/rpcctl:47: SyntaxWarning: 'return' in a 'finally' block
      return res
    [...]

    root@hera:/# sed -n -e '38,48p' /sbin/rpcctl

    def read_info_file(path):
        """Read an xprt or xprt switch information file."""
        res = collections.defaultdict(int)
        try:
            with open(path) as info:
                lines = [line.split("=", 1) for line in info if "=" in line]
                res.update({key: int(val.strip()) for (key, val) in lines})
        finally:
            return res

Based on https://github.com/iritkatriel/finally#:~:text=contains%20only%20a%20return
I think the correct fix is this edit:

        -finally:
        -    return res
        +return res

See also:

https://docs.python.org/3/whatsnew/3.14.html#pep-765-control-flow-in-finally-blocks
https://peps.python.org/pep-0765/

#1144982#12
Date:
2026-08-22 14:41:42 UTC
From:
To:
Trent W. Buck reported that when using rpcctl with Python 3.14
version, a SyntaxWarning warning is issued on the use of return in the
finally block in the read_info_file function.

Replace the finally clause with an except BaseException, and dedent the
return by one level up.

Reported-by: "Trent W. Buck" <trentbuck@gmail.com>
Link: https://docs.python.org/3/whatsnew/3.14.html#pep-765-control-flow-in-finally-blocks
Closes: https://bugs.debian.org/1144982
Signed-off-by: Salvatore Bonaccorso <carnil@debian.org>
---
 tools/rpcctl/rpcctl.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tools/rpcctl/rpcctl.py b/tools/rpcctl/rpcctl.py
index 29ae7d26f50e..42e238ca1c52 100755
--- a/tools/rpcctl/rpcctl.py
+++ b/tools/rpcctl/rpcctl.py
@@ -43,8 +43,9 @@ def read_info_file(path):
         with open(path) as info:
             lines = [line.split("=", 1) for line in info if "=" in line]
             res.update({key: int(val.strip()) for (key, val) in lines})
-    finally:
-        return res
+    except BaseException:
+        pass
+    return res


 class Xprt:

#1144982#19
Date:
2026-08-22 15:11:39 UTC
From:
To:
Hi,

Including Anna's oracle.com address.

Regards,
Salvatore

#1144982#24
Date:
2026-08-31 22:57:26 UTC
From:
To:
steved.
#1144982#29
Date:
2026-08-31 22:57:50 UTC
From:
To:
steved.
#1144982#34
Date:
2026-08-31 22:58:43 UTC
From:
To:
steved.
#1144982#41
Date:
2026-09-23 07:05:06 UTC
From:
To:
We believe that the bug you reported is fixed in the latest version of
nfs-utils, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 1144982@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Salvatore Bonaccorso <carnil@debian.org> (supplier of updated nfs-utils package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@ftp-master.debian.org)
Format: 1.8
Date: Wed, 23 Sep 2026 07:54:34 +0200
Source: nfs-utils
Architecture: source
Version: 1:3.1.1-1
Distribution: unstable
Urgency: medium
Maintainer: Debian kernel team <debian-kernel@lists.debian.org>
Changed-By: Salvatore Bonaccorso <carnil@debian.org>
Closes: 1144982
Changes:
 nfs-utils (1:3.1.1-1) unstable; urgency=medium
 .
   * New upstream version 3.1.1
     - rpcctl: SyntaxWarning: 'return' in a 'finally' block (Closes: #1144982)
   * debian/control: Bump Debhelper compat level to 14
   * debian/control: Drop use of substvars which are automatically replaced
Checksums-Sha1:
 071f3f1b09ff067210d79fcaa51b08dd40ebce17 2667 nfs-utils_3.1.1-1.dsc
 c1f970ef2cf265e3c0eba5975666992c47c820d5 774380 nfs-utils_3.1.1.orig.tar.xz
 0b7b76ae63177bffb1f33e00e28baab9cccdcdd2 50404 nfs-utils_3.1.1-1.debian.tar.xz
Checksums-Sha256:
 09b40965ca3586b520726b8dc44b50f367549fddafd0e8fd7787851673b33159 2667 nfs-utils_3.1.1-1.dsc
 7dbc05eb8b32828b322872b759a62cb3979cb4118f344dd8616813d1390e84e0 774380 nfs-utils_3.1.1.orig.tar.xz
 38747223dd347cbe9ec4262c7a4f7b13e29c6891a6c56f2d462770ad9cea7239 50404 nfs-utils_3.1.1-1.debian.tar.xz
Files:
 40d7ceeb4df9dca23a82ec4d74ab4965 2667 net optional nfs-utils_3.1.1-1.dsc
 24b69355dd92c51acc9dda7b178e1390 774380 net optional nfs-utils_3.1.1.orig.tar.xz
 916f50ca84d6f1cb491df7e9463b3539 50404 net optional nfs-utils_3.1.1-1.debian.tar.xz
-----BEGIN PGP SIGNATURE-----

iQKmBAEBCgCQFiEERkRAmAjBceBVMd3uBUy48xNDz0QFAmqzd01fFIAAAAAALgAo
aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDQ2
NDQ0MDk4MDhDMTcxRTA1NTMxRERFRTA1NENCOEYzMTM0M0NGNDQSHGNhcm5pbEBk
ZWJpYW4ub3JnAAoJEAVMuPMTQ89EKR4P/A2Wi7ZDXfyYjbamGOT5ipGr8TFR5/EF
zE+GjsR6KXJsNITn5f+cz8Bq3R0sRym138EkDeYHPYuts+UUASCEB9WNBS5B4w85
S2kamKd3ILGZ+Nrd1TXnmUI2ewoUFC6abk0YOKjRxur1884jgnb3PCvsVTz2HGJU
4BL0P61+xPf5edcD0sJE1JMJr/EoTLJ3Y0kKZLkvu3iuwwOsqZGoWli/L3fCJ5dW
HrW9KxLZlfZCNpTKyBfUFQ8EJOztP5eF7RZPpA8SJ+mP6Q1HDmO0uWPLB6YxUaNA
tDUHoQL1ZZh3b56ojfCr8KQU4IKMM9QVgBKe3u6jRuzYHrML5lVVWYqgzNyzG8zn
sI74ysoo12JSc/OyNC7IDLCx7IgfbZpdVW59xOcy8mpy/cEBAQSIUZmIkhHsPqaR
nElM7K4ZR06QTSxnZ5LrPTv0rwgCjAvLrYrKFEhHiPaSihX3kOT4RUQxZVmSW+C6
Fz45tBbDkzOuTQjfOC6QWiMSLvfr56gVhCxrSqUYuldZYE1CAnpgV2jP97RWSmMU
WuIC0UAllodtSjZRWeIpajzqXiLO4L7AwZ1dZgMCvRxKg2UeHOts5v0aWNIkK5Dw
Y9le4xO4eCGyaDWMV49Ikd8odE0e8pWixOa1HDJrXz0MFL60uLlwd4Estnj1Bf/2
Gee/HFp82R9R
=oQrE
-----END PGP SIGNATURE-----