From: Calum Mackay <calum.mackay@oracle.com>
To: NeilBrown <neilb@suse.de>, Bruce Fields <bfields@fieldses.org>,
Jeff Layton <jlayton@kernel.org>
Cc: Calum Mackay <calum.mackay@oracle.com>,
Linux NFS Mailing List <linux-nfs@vger.kernel.org>
Subject: Re: [PATCH pynfs] rpc.py: Don't try to subscript an exception.
Date: Thu, 30 Mar 2023 16:33:10 +0100 [thread overview]
Message-ID: <bc0c344b-8939-d55e-85c5-168b85e974d5@oracle.com> (raw)
In-Reply-To: <167996453785.8106.14290228013263156210@noble.neil.brown.name>
[-- Attachment #1.1: Type: text/plain, Size: 1672 bytes --]
On 28/03/2023 1:48 am, NeilBrown wrote:
>
> As far as I can tell python3 has never supported subscripting of
> exceptions.
> So don't try to...
>
> Signed-off-by: NeilBrown <neilb@suse.de>
Thanks very much Neil.
I still don't quite have a repo ready, but will apply this (and others)
as soon as I do.
cheers,
calum.
> ---
> nfs4.0/lib/rpc/rpc.py | 2 +-
> rpc/rpc.py | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/nfs4.0/lib/rpc/rpc.py b/nfs4.0/lib/rpc/rpc.py
> index 24a7fc72eff0..585db3551f73 100644
> --- a/nfs4.0/lib/rpc/rpc.py
> +++ b/nfs4.0/lib/rpc/rpc.py
> @@ -227,7 +227,7 @@ class RPCClient(object):
> sock.bind(('', port))
> return
> except socket.error as why:
> - if why[0] == errno.EADDRINUSE:
> + if why.errno == errno.EADDRINUSE:
> port += 1
> else:
> print("Could not use low port")
> diff --git a/rpc/rpc.py b/rpc/rpc.py
> index 1fe285aa2b5b..814de4e08bc9 100644
> --- a/rpc/rpc.py
> +++ b/rpc/rpc.py
> @@ -846,7 +846,7 @@ class ConnectionHandler(object):
> s.bind(('', using))
> return
> except socket.error as why:
> - if why[0] == errno.EADDRINUSE:
> + if why.errno == errno.EADDRINUSE:
> using += 1
> if port < 1024 <= using:
> # If we ask for a secure port, make sure we don't
--
Calum Mackay
Linux Kernel Engineering
Oracle Linux and Virtualisation
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]
prev parent reply other threads:[~2023-03-30 17:39 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-28 0:48 [PATCH pynfs] rpc.py: Don't try to subscript an exception NeilBrown
2023-03-28 15:25 ` Frank Filz
2023-03-30 15:33 ` Calum Mackay [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=bc0c344b-8939-d55e-85c5-168b85e974d5@oracle.com \
--to=calum.mackay@oracle.com \
--cc=bfields@fieldses.org \
--cc=jlayton@kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=neilb@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).