From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 3586843E57 for ; Sat, 13 Apr 2024 15:01:42 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2C5B8400D6; Sat, 13 Apr 2024 15:01:42 +0200 (CEST) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2063.outbound.protection.outlook.com [40.107.223.63]) by mails.dpdk.org (Postfix) with ESMTP id 10406400D6 for ; Sat, 13 Apr 2024 15:01:40 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=g9NW0F7B14+Qh0fYFDiN+Fywc0mxR34Nzk90+QHcHBP/H8wBLCtNDpEm/y7jxuxohRvutAL2rLKdFoFLiNxAPJ0tUfQPz8i/hlBHD2cRVF1yxspFyJ50l3A1LZXADJhB8+m2dkn5QVRJctYoUun9HRDrIXkCQ94Nqm45aKV/P0SB/j7jpnvfasjbbaceqoySBnLnwGZbqBix/TsaCSRp2iIBK/hlndQDRSW92sQbJWGjNSRAG5j4Gc+LHkiVPyGKW34DrqH6K2QVbIwutZb3IceEBkACgN/KWT+YekWwO3II1j+9bK1WMwibdBxpgQd5Lebv6NQu0qD8WttusSspGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=/LP9UdcVgQRH+QfrzkOVqdUYY1aCLxU2ZjkfSVkEmuk=; b=CMGWD1o2ATRQ2P/y6Md3mGROYwOeex12GZSai94GfEGc6hS/x6T+8RGckQnOPMyv7dSE9NPJMyu7incT+lZCEu4bPtOKjfAHIm4ZehbWt9qgy7AB77m4fIsYbglp47FnSUv5PPnqj12STOx4dgBXmIxMCHVZbJeAPQyGLy6452/mTAq77UknI2AfSakhwLChZROfSAZbUunTjZvezmaOmJzWV7ODW6hUPNH9NoctJIC+7LkI4+mzkQmTP3toS48qEzo41f8giMDzkqbKPHskxlvgfjbucCNaWym3EKVjrun3QOtsM7KOq+g9ZAaOVRQrHmcTlQsw0Bg0Ue0NtnPXEg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=pantheon.tech smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=/LP9UdcVgQRH+QfrzkOVqdUYY1aCLxU2ZjkfSVkEmuk=; b=qy2+mPkl6aZIUyH30ftVNWvlwWxAQu5F6rllKtKs4FvxQskKeyFcRhJ92ufoYVTeQMmmQq+yU9zNTh91EIa7EFGQBReARo9v5FXLvKRHfEBNa+DknZRd/02XAH1TvRR3ikgC4vk3Bt+Li7PpZwGoDzK8L9oGayXKaVuPN9trNqrfW9BKpBt8jGOlbbJ3ohw1vFlPj/v7f38Ug8L4ukts7WFlFDr5fpGvKP1hF8x9JnIocvgZEzCygffzskhC4ZP2rE/5FK5zHLj6RGCX0hlJFEvXxA7QuC7nD3EmT8s2CIVoAXU5mUOiWHAPUvGPlu5NdQScPRuLJx/YHcz6ZAX1Ag== Received: from SJ0P220CA0006.NAMP220.PROD.OUTLOOK.COM (2603:10b6:a03:41b::29) by SJ0PR12MB6992.namprd12.prod.outlook.com (2603:10b6:a03:483::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.46; Sat, 13 Apr 2024 13:01:36 +0000 Received: from MWH0EPF000989EC.namprd02.prod.outlook.com (2603:10b6:a03:41b:cafe::a4) by SJ0P220CA0006.outlook.office365.com (2603:10b6:a03:41b::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7472.31 via Frontend Transport; Sat, 13 Apr 2024 13:01:36 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by MWH0EPF000989EC.mail.protection.outlook.com (10.167.241.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7452.22 via Frontend Transport; Sat, 13 Apr 2024 13:01:36 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Sat, 13 Apr 2024 06:01:15 -0700 Received: from nvidia.com (10.126.230.35) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1258.12; Sat, 13 Apr 2024 06:01:13 -0700 From: Xueming Li To: =?UTF-8?q?Juraj=20Linke=C5=A1?= CC: Jeremy Spewock , Patrick Robb , dpdk stable Subject: patch 'dts: strip whitespaces from stdout and stderr' has been queued to stable release 23.11.1 Date: Sat, 13 Apr 2024 20:50:04 +0800 Message-ID: <20240413125005.725659-124-xuemingl@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240413125005.725659-1-xuemingl@nvidia.com> References: <20240305094757.439387-1-xuemingl@nvidia.com> <20240413125005.725659-1-xuemingl@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-Originating-IP: [10.126.230.35] X-ClientProxiedBy: rnnvmail201.nvidia.com (10.129.68.8) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWH0EPF000989EC:EE_|SJ0PR12MB6992:EE_ X-MS-Office365-Filtering-Correlation-Id: 3fd4a019-1280-4fbb-e872-08dc5bb9d9fe X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: eUqoJJ7ya8ZcyRyqL9cJdj4V5j1wcJIeb/tFeuY2mtdHvrmJNKTB2mN1qXKdEVn6pMG3btMARYByIDbdu9cD2NOf5MTlkYYrJ/U+oOQ74uWUIbR8jUb6S5szLJxCxPvzOIBXRJbLjKa+o/U62qtcB+faK2i4BONlmEtVHjkQcLXhUyEQTSASNHVU5PKt+vZKt+iWNhIzUM+iKwXbtgHsDCjpMoskjl4ZwLVlxsPaooz4Tn5zG2EjizD05OXLrEjNepk48jybPkDh4q9XytegCASCqgDEMgEl1BHfXwVrJJ9GUTp/ccIVRrdPnzl/RR89K8vVp22D4YTLsUm2zLgUY5k19z3gQvtG8AutpTedLxCcaOhM55MX6pcCDsIYhXhlEWUDJp7v3g4zPqfOXmNp4m8I2ypRNOtYYb1uwcgg7ATAPg1Kv2+Q7f8GhInyx6KcsN17RzAv9AoGVlILkTedGhywyjkvv1y8nrn18hToggLk13oJ05I+LW3oElEr8vUQaMJ3KdTov2guGHbEO1fqd7//iEFyVmzcje+eu7fAZinyk+Sd7kQZR8owAf//kCQCNH1faWBwXaHrZOFdCR4/iGt5siCWXcOrCkgQZzuV+rdJucokYFiI5s7kOeQlxbbmKwIfS3RfjK9G6Byb28zqMLUuaNOYti8BMte8aFCgomCjPWeqS3XL1OqYvCg/qsHsx+fIduN3c8SYr196dx0cSw1/OgyAHerr5WxpqmSBCeHHkVAkDOENkm/W8bR75OoT X-Forefront-Antispam-Report: CIP:216.228.117.161; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge2.nvidia.com; CAT:NONE; SFS:(13230031)(82310400014)(1800799015)(36860700004)(376005); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Apr 2024 13:01:36.3269 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3fd4a019-1280-4fbb-e872-08dc5bb9d9fe X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.117.161]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: MWH0EPF000989EC.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR12MB6992 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Hi, FYI, your patch has been queued to stable release 23.11.1 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 04/15/24. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://git.dpdk.org/dpdk-stable/log/?h=23.11-staging This queued commit can be viewed at: https://git.dpdk.org/dpdk-stable/commit/?h=23.11-staging&id=a20a3c1129aff09b2058b37d3f463e4879e46b74 Thanks. Xueming Li --- >From a20a3c1129aff09b2058b37d3f463e4879e46b74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juraj=20Linke=C5=A1?= Date: Tue, 13 Feb 2024 12:14:39 +0100 Subject: [PATCH] dts: strip whitespaces from stdout and stderr MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Xueming Li There could be a newline at the end of stdout or stderr of a remotely executed command. These cause issues when used later, such as when joining paths from such commands - a newline in the middle of a path is not valid. Fixes: ad80f550dbc5 ("dts: add SSH command verification") Cc: stable@dpdk.org Signed-off-by: Juraj Linkeš Reviewed-by: Jeremy Spewock Acked-by: Patrick Robb --- .../remote_session/remote/remote_session.py | 24 +++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/dts/framework/remote_session/remote/remote_session.py b/dts/framework/remote_session/remote/remote_session.py index 719f7d1ef7..68894a9686 100644 --- a/dts/framework/remote_session/remote/remote_session.py +++ b/dts/framework/remote_session/remote/remote_session.py @@ -3,8 +3,8 @@ # Copyright(c) 2022-2023 PANTHEON.tech s.r.o. # Copyright(c) 2022-2023 University of New Hampshire -import dataclasses from abc import ABC, abstractmethod +from dataclasses import InitVar, dataclass, field from pathlib import PurePath from framework.config import NodeConfiguration @@ -13,7 +13,7 @@ from framework.logger import DTSLOG from framework.settings import SETTINGS -@dataclasses.dataclass(slots=True, frozen=True) +@dataclass(slots=True, frozen=True) class CommandResult: """ The result of remote execution of a command. @@ -21,9 +21,25 @@ class CommandResult: name: str command: str - stdout: str - stderr: str + init_stdout: InitVar[str] + init_stderr: InitVar[str] return_code: int + stdout: str = field(init=False) + stderr: str = field(init=False) + + def __post_init__(self, init_stdout: str, init_stderr: str) -> None: + """Strip the whitespaces from stdout and stderr. + + The generated __init__ method uses object.__setattr__() when the dataclass is frozen, + so that's what we use here as well. + + In order to get access to dataclass fields in the __post_init__ method, + we have to type them as InitVars. These InitVars are included in the __init__ method's + signature, so we have to exclude the actual stdout and stderr fields + from the __init__ method's signature, so that we have the proper number of arguments. + """ + object.__setattr__(self, "stdout", init_stdout.strip()) + object.__setattr__(self, "stderr", init_stderr.strip()) def __str__(self) -> str: return ( -- 2.34.1