get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/138226/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 138226,
    "url": "https://patches.dpdk.org/api/patches/138226/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20240312172558.11844-2-jspewock@iol.unh.edu/",
    "project": {
        "id": 1,
        "url": "https://patches.dpdk.org/api/projects/1/?format=api",
        "name": "DPDK",
        "link_name": "dpdk",
        "list_id": "dev.dpdk.org",
        "list_email": "dev@dpdk.org",
        "web_url": "http://core.dpdk.org",
        "scm_url": "git://dpdk.org/dpdk",
        "webscm_url": "http://git.dpdk.org/dpdk",
        "list_archive_url": "https://inbox.dpdk.org/dev",
        "list_archive_url_format": "https://inbox.dpdk.org/dev/{}",
        "commit_url_format": ""
    },
    "msgid": "<20240312172558.11844-2-jspewock@iol.unh.edu>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20240312172558.11844-2-jspewock@iol.unh.edu",
    "date": "2024-03-12T17:25:57",
    "name": "[v1,1/2] dts: Improve output gathering in interactive shells",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "761721eba4716e47e7d09a3f09dc53c6a87c687f",
    "submitter": {
        "id": 2772,
        "url": "https://patches.dpdk.org/api/people/2772/?format=api",
        "name": "Jeremy Spewock",
        "email": "jspewock@iol.unh.edu"
    },
    "delegate": {
        "id": 1,
        "url": "https://patches.dpdk.org/api/users/1/?format=api",
        "username": "tmonjalo",
        "first_name": "Thomas",
        "last_name": "Monjalon",
        "email": "thomas@monjalon.net"
    },
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/20240312172558.11844-2-jspewock@iol.unh.edu/mbox/",
    "series": [
        {
            "id": 31483,
            "url": "https://patches.dpdk.org/api/series/31483/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=31483",
            "date": "2024-03-12T17:25:56",
            "name": "Improve interactive shell output gathering",
            "version": 1,
            "mbox": "https://patches.dpdk.org/series/31483/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/138226/comments/",
    "check": "success",
    "checks": "https://patches.dpdk.org/api/patches/138226/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@inbox.dpdk.org",
        "Delivered-To": "patchwork@inbox.dpdk.org",
        "Received": [
            "from mails.dpdk.org (mails.dpdk.org [217.70.189.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id B36C243C94;\n\tTue, 12 Mar 2024 18:26:33 +0100 (CET)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id A037A42D90;\n\tTue, 12 Mar 2024 18:26:33 +0100 (CET)",
            "from mail-pg1-f226.google.com (mail-pg1-f226.google.com\n [209.85.215.226])\n by mails.dpdk.org (Postfix) with ESMTP id 11D2F42D89\n for <dev@dpdk.org>; Tue, 12 Mar 2024 18:26:32 +0100 (CET)",
            "by mail-pg1-f226.google.com with SMTP id\n 41be03b00d2f7-5dcc4076c13so61016a12.0\n for <dev@dpdk.org>; Tue, 12 Mar 2024 10:26:31 -0700 (PDT)",
            "from postal.iol.unh.edu (postal.iol.unh.edu.\n [2606:4100:3880:1234::84]) by smtp-relay.gmail.com with ESMTPS id\n n3-20020a17090ade8300b0029af7a6e1a8sm395550pjv.4.2024.03.12.10.26.31\n (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);\n Tue, 12 Mar 2024 10:26:31 -0700 (PDT)",
            "from iol.unh.edu (unknown\n [IPv6:2606:4100:3880:1271:90f9:1b64:f6e6:867f])\n by postal.iol.unh.edu (Postfix) with ESMTP id 519716052471;\n Tue, 12 Mar 2024 13:26:30 -0400 (EDT)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=iol.unh.edu; s=unh-iol; t=1710264391; x=1710869191; darn=dpdk.org;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:from:to:cc:subject:date\n :message-id:reply-to;\n bh=aslyKnAynBtHbwjUDaSheVxbl6+MwYCHgzOkaqUlbFI=;\n b=B0G35cWWX9Xa8ARxNatBQNNJUNrB108KL7aSqZDSlBlxX1vHTN2E9DW6BvneuGK9aC\n 8ws+6RGs1OYUgMbe6bgbZMt8aTy9wWtL4cRpoOEGRAV3KYxk4BxIb9QTemtxLKq+UIv+\n gccaTAP3Edga6ACqmGFaXeN2xNI1N1aG2bJCY=",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20230601; t=1710264391; x=1710869191;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc\n :subject:date:message-id:reply-to;\n bh=aslyKnAynBtHbwjUDaSheVxbl6+MwYCHgzOkaqUlbFI=;\n b=eug+tp11LDjroHn1x3squBmRd2FPzj3Aifn9YeqeOQnqp0ixX++LTT/9XBQkBqYTr5\n AiO2IoPp6YEBhTdtlKm8b2/9vYnqOqbiHJKHmtfRpGDemOyLgZCccne1X5asky0OpVsT\n ljifXvQp14HGDUYvFvhKD8nkEzCGKANscYeIIvGMNSCyMzOlKdgTCjYJB71ezpoXqFlC\n tRyY/x8dOv+X0C/S3Cr+YWfoMZTroUu3VcsiBEzrSlAupGSKC3/vTDQct7lnpc4lgpoi\n FThdf+eHthWvwKAIJ3/mHwAxy3HK2El9sVBn46ehShp3b3J09hF8/ZhKT3UxobGAsGs/\n 23dw==",
        "X-Gm-Message-State": "AOJu0YyTIwm40sWx+7fzKpO4qdXW8rcx/6l7iAa2diLu01vTtx1yt4mO\n 0FS6SV0l60C3/2fNvRVeeNRbgbFa7pxaRPR2qHRLvcQxduA+Af6REi+lGSBLRUFzmlDcC6nOv5O\n ravXW2xyBGncyE7XNoDcNClZPhL4Hb2sVdJymn6g1WXCdC7Jf",
        "X-Google-Smtp-Source": "\n AGHT+IGtSlwPhLXSKMfaUKEcIBB7+DWqOZSV0o0Wq/ry/LLoy9qqni6WYW3qXFstbS93k07+3s3YyvXklNNc",
        "X-Received": "by 2002:a17:90a:53e4:b0:29a:72b:df85 with SMTP id\n y91-20020a17090a53e400b0029a072bdf85mr306815pjh.7.1710264391188;\n Tue, 12 Mar 2024 10:26:31 -0700 (PDT)",
        "X-Relaying-Domain": "iol.unh.edu",
        "From": "jspewock@iol.unh.edu",
        "To": "Honnappa.Nagarahalli@arm.com, juraj.linkes@pantheon.tech,\n thomas@monjalon.net, wathsala.vithanage@arm.com, probb@iol.unh.edu,\n paul.szczepanek@arm.com, yoan.picchi@foss.arm.com, Luca.Vizzarro@arm.com",
        "Cc": "dev@dpdk.org,\n\tJeremy Spewock <jspewock@iol.unh.edu>",
        "Subject": "[PATCH v1 1/2] dts: Improve output gathering in interactive shells",
        "Date": "Tue, 12 Mar 2024 13:25:57 -0400",
        "Message-ID": "<20240312172558.11844-2-jspewock@iol.unh.edu>",
        "X-Mailer": "git-send-email 2.43.2",
        "In-Reply-To": "<20240312172558.11844-1-jspewock@iol.unh.edu>",
        "References": "<20240312172558.11844-1-jspewock@iol.unh.edu>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.29",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n <mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n <mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org"
    },
    "content": "From: Jeremy Spewock <jspewock@iol.unh.edu>\n\nThe current implementation of consuming output from interactive shells\nrelies on being able to find an expected prompt somewhere within the\noutput buffer after sending the command. This is useful in situations\nwhere the prompt does not appear in the output itself, but in some\npractical cases (such as the starting of an XML-RPC server for scapy)\nthe prompt exists in one of the commands sent to the shell and this can\ncause the command to exit early and creates a race condition between the\nserver starting and the first command being sent to the server.\n\nThis patch addresses this problem by searching for a line that strictly\nends with the provided prompt, rather than one that simply contains it,\nso that the detection that a command is finished is more consistent. It\nalso adds a catch to detect when a command times out before finding the\nprompt so that the exception can be wrapped into a more explicit one and\ndisplay the output that it did manage to gather before timing out.\n\nBugzilla ID: 1359\nFixes: 88489c0501af (\"dts: add smoke tests\")\n\nSigned-off-by: Jeremy Spewock <jspewock@iol.unh.edu>\n---\n dts/framework/exception.py                    |  7 +++++\n .../remote_session/interactive_shell.py       | 26 +++++++++++++------\n 2 files changed, 25 insertions(+), 8 deletions(-)",
    "diff": "diff --git a/dts/framework/exception.py b/dts/framework/exception.py\nindex 658eee2c38..cce1e0231a 100644\n--- a/dts/framework/exception.py\n+++ b/dts/framework/exception.py\n@@ -146,6 +146,13 @@ def __str__(self) -> str:\n         return f\"Command {self.command} returned a non-zero exit code: {self._command_return_code}\"\n \n \n+class InteractiveCommandExecutionError(DTSError):\n+    \"\"\"An unsuccessful execution of a remote command in an interactive environment.\"\"\"\n+\n+    #:\n+    severity: ClassVar[ErrorSeverity] = ErrorSeverity.REMOTE_CMD_EXEC_ERR\n+\n+\n class RemoteDirectoryExistsError(DTSError):\n     \"\"\"A directory that exists on a remote node.\"\"\"\n \ndiff --git a/dts/framework/remote_session/interactive_shell.py b/dts/framework/remote_session/interactive_shell.py\nindex 5cfe202e15..2bcfdcb3c7 100644\n--- a/dts/framework/remote_session/interactive_shell.py\n+++ b/dts/framework/remote_session/interactive_shell.py\n@@ -20,6 +20,7 @@\n \n from paramiko import Channel, SSHClient, channel  # type: ignore[import]\n \n+from framework.exception import InteractiveCommandExecutionError\n from framework.logger import DTSLogger\n from framework.settings import SETTINGS\n \n@@ -124,6 +125,10 @@ def send_command(self, command: str, prompt: str | None = None) -> str:\n \n         Returns:\n             All output in the buffer before expected string.\n+\n+        Raises:\n+            InteractiveCommandExecutionError: If command was sent but prompt could not be found in\n+                the output.\n         \"\"\"\n         self._logger.info(f\"Sending: '{command}'\")\n         if prompt is None:\n@@ -131,14 +136,19 @@ def send_command(self, command: str, prompt: str | None = None) -> str:\n         self._stdin.write(f\"{command}{self._command_extra_chars}\\n\")\n         self._stdin.flush()\n         out: str = \"\"\n-        for line in self._stdout:\n-            out += line\n-            if prompt in line and not line.rstrip().endswith(\n-                command.rstrip()\n-            ):  # ignore line that sent command\n-                break\n-        self._logger.debug(f\"Got output: {out}\")\n-        return out\n+        try:\n+            for line in self._stdout:\n+                out += line\n+                if line.rstrip().endswith(prompt):\n+                    break\n+        except TimeoutError:\n+            raise InteractiveCommandExecutionError(\n+                f\"Failed to find the prompt ({prompt}) at the end of a line in the output from the\"\n+                f\" command ({command}). Got:\\n{out}\"\n+            )\n+        else:\n+            self._logger.debug(f\"Got output: {out}\")\n+            return out\n \n     def close(self) -> None:\n         \"\"\"Properly free all resources.\"\"\"\n",
    "prefixes": [
        "v1",
        "1/2"
    ]
}