Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp3654774rwl; Mon, 27 Mar 2023 17:59:43 -0700 (PDT) X-Google-Smtp-Source: AKy350bCP8E28zxZgv2xsQBQ1wPzueCcpHVfOY+313gCv7pQycFyIXyVhrlm++TAnx6GiDClbbZq X-Received: by 2002:a17:906:4e84:b0:930:e53e:759b with SMTP id v4-20020a1709064e8400b00930e53e759bmr14690182eju.11.1679965182915; Mon, 27 Mar 2023 17:59:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679965182; cv=none; d=google.com; s=arc-20160816; b=CJeqp94p0zJDGcVg6ue6bKpQEVu5aK//aZ67o6IQ5GnZSCIOGvgb8AT2kXnvknWfku vRS7R2GbFJ2Up8sHr8ct8QF2xSl4Unnp9iMnoJNIVuZl+CMI16IGUskW4kmYA/lxjStF GPy3r9oIjynOQTWvZ6YGQiKiOWitQe20uOL7s1VnRumZ+qynqQKmmIs/7MygYcdV26c4 LEbWI+fO03JaJhDzzRWXHVh8fXTU45fU6xPzKS9BoolP4O7yrMCWsVZcswbrc7i5lcwh hOrNuer7KcJKMrnDZH6dkD7GCOPyUzR2J3yKjs3NBM0F1PWqPUeCP12KE4l05Nudokmk Mmig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from:mime-version :content-transfer-encoding:dkim-signature:dkim-signature; bh=IVb/5QucqYE4QMQAmYoi2YL8WeufPm/rBXRcF2ZA60U=; b=wh1dYbbS4WctXZFaEhvYeP2qUK/HI5ur56X1nMLKojFEpXEprkYmnCBWqdLPRjYxCZ d9qoYjPbfyc/H5fjIM+6PXCQgjNLQR1S7emilSbYV3k33c/XuSiopBpOqOO/sPUxu8nu iFa4MeGvyyYEt2QmOvlDADbzMZNkekrfteV5ucGhUE2ELS/fhPXfTVzcTI0bDgJ2NYC3 8+Yx76wz1owHafIVfF/sLuWpZcjjNAaVoNkFUC7S6qybIWCEIIRXhLFGomBXT7zzbdNP Q9vkIADrVJZWRxaiqVWqa8B2shb89Gro5pQkNBH5KvKKpv/WFNBc3/5BLHbnkBNWNEm9 W+aQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b="z8TPHMD/"; dkim=neutral (no key) header.i=@suse.de; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a18-20020a1709063a5200b0092be4b3c198si29796621ejf.662.2023.03.27.17.59.10; Mon, 27 Mar 2023 17:59:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b="z8TPHMD/"; dkim=neutral (no key) header.i=@suse.de; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229611AbjC1AtF (ORCPT + 99 others); Mon, 27 Mar 2023 20:49:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44322 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229762AbjC1AtE (ORCPT ); Mon, 27 Mar 2023 20:49:04 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9D6A21A5 for ; Mon, 27 Mar 2023 17:49:03 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 4E53B219DB; Tue, 28 Mar 2023 00:49:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1679964542; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=IVb/5QucqYE4QMQAmYoi2YL8WeufPm/rBXRcF2ZA60U=; b=z8TPHMD/f59fY6sEmaT+VIqkas1RwF2i7yMQgjcU/hJCmCXPYlgmXDm9TrQJGnTNtA5leF 1n9U0i7xMjMqhwORaJvpqF50ooX3LJFeffQM1a4qImHiyN7FLYmSBRMn7bNq8rAH6s3H1D QH3c6xAdZMu5gZW/IOLQ0W7+umeBR/w= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1679964542; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=IVb/5QucqYE4QMQAmYoi2YL8WeufPm/rBXRcF2ZA60U=; b=rb0MNcFDowAJy6NgoF36l1HzQ1WZf77DKiytE4hOWRsNiLjfyTSHABuOjXM0ZHtaU1kL2d xEIIR8loD6Csh/Cw== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 2245813329; Tue, 28 Mar 2023 00:49:00 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id TQTbMnw5ImQJAgAAMHmgww (envelope-from ); Tue, 28 Mar 2023 00:49:00 +0000 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit MIME-Version: 1.0 From: "NeilBrown" To: Bruce Fields , Jeff Layton Cc: Linux NFS Mailing List Subject: [PATCH pynfs] rpc.py: Don't try to subscript an exception. Date: Tue, 28 Mar 2023 11:48:57 +1100 Message-id: <167996453785.8106.14290228013263156210@noble.neil.brown.name> X-Spam-Status: No, score=-2.5 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org As far as I can tell python3 has never supported subscripting of exceptions. So don't try to... Signed-off-by: NeilBrown --- 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 -- 2.40.0