get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 613861,
    "url": "http://patchwork.ozlabs.org/api/patches/613861/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/buildroot/patch/1461358223-18312-11-git-send-email-s.martin49@gmail.com/",
    "project": {
        "id": 27,
        "url": "http://patchwork.ozlabs.org/api/projects/27/?format=api",
        "name": "Buildroot development",
        "link_name": "buildroot",
        "list_id": "buildroot.buildroot.org",
        "list_email": "buildroot@buildroot.org",
        "web_url": "",
        "scm_url": "",
        "webscm_url": "",
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<1461358223-18312-11-git-send-email-s.martin49@gmail.com>",
    "list_archive_url": null,
    "date": "2016-04-22T20:50:22",
    "name": "[v9,10/11] support/scripts/check-host-leaks: add option to classify leaks",
    "commit_ref": null,
    "pull_url": null,
    "state": "changes-requested",
    "archived": false,
    "hash": "a383632fdda18469071c0b7fccfe5809eb8b66b7",
    "submitter": {
        "id": 12868,
        "url": "http://patchwork.ozlabs.org/api/people/12868/?format=api",
        "name": "Samuel Martin",
        "email": "s.martin49@gmail.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/buildroot/patch/1461358223-18312-11-git-send-email-s.martin49@gmail.com/mbox/",
    "series": [],
    "comments": "http://patchwork.ozlabs.org/api/patches/613861/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/613861/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<buildroot-bounces@busybox.net>",
        "X-Original-To": [
            "incoming@patchwork.ozlabs.org",
            "buildroot@lists.busybox.net"
        ],
        "Delivered-To": [
            "patchwork-incoming@bilbo.ozlabs.org",
            "buildroot@osuosl.org"
        ],
        "Received": [
            "from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133])\n\tby ozlabs.org (Postfix) with ESMTP id 3qs77r5Fr8z9sCk\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSat, 23 Apr 2016 06:51:20 +1000 (AEST)",
            "from localhost (localhost [127.0.0.1])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id BA01B96689;\n\tFri, 22 Apr 2016 20:51:18 +0000 (UTC)",
            "from hemlock.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id g63XAcIGg-C0; Fri, 22 Apr 2016 20:51:17 +0000 (UTC)",
            "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id E8C9B9669D;\n\tFri, 22 Apr 2016 20:51:00 +0000 (UTC)",
            "from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136])\n\tby ash.osuosl.org (Postfix) with ESMTP id 819B71C1750\n\tfor <buildroot@lists.busybox.net>;\n\tFri, 22 Apr 2016 20:50:52 +0000 (UTC)",
            "from localhost (localhost [127.0.0.1])\n\tby silver.osuosl.org (Postfix) with ESMTP id 7F435337DA\n\tfor <buildroot@lists.busybox.net>;\n\tFri, 22 Apr 2016 20:50:52 +0000 (UTC)",
            "from silver.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id IUG3ohnpVSY4 for <buildroot@lists.busybox.net>;\n\tFri, 22 Apr 2016 20:50:51 +0000 (UTC)",
            "from mail-wm0-f66.google.com (mail-wm0-f66.google.com\n\t[74.125.82.66])\n\tby silver.osuosl.org (Postfix) with ESMTPS id 42ABF33596\n\tfor <buildroot@buildroot.org>; Fri, 22 Apr 2016 20:50:51 +0000 (UTC)",
            "by mail-wm0-f66.google.com with SMTP id r12so7003414wme.0\n\tfor <buildroot@buildroot.org>; Fri, 22 Apr 2016 13:50:51 -0700 (PDT)",
            "from bobook.localdomain (ivr94-4-82-229-165-48.fbx.proxad.net.\n\t[82.229.165.48]) by smtp.gmail.com with ESMTPSA id\n\tiv1sm9826507wjb.34.2016.04.22.13.50.48\n\t(version=TLSv1/SSLv3 cipher=OTHER);\n\tFri, 22 Apr 2016 13:50:48 -0700 (PDT)"
        ],
        "Authentication-Results": "ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com header.b=aFG0t897;\n\tdkim-atps=neutral",
        "X-Virus-Scanned": [
            "amavisd-new at osuosl.org",
            "amavisd-new at osuosl.org"
        ],
        "X-Greylist": "domain auto-whitelisted by SQLgrey-1.7.6",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references;\n\tbh=nWPUEu+3MTWVLLZIuIqubksEoyy0MUKWIh9wTJyjgqA=;\n\tb=aFG0t897nUF/P1mxaZ4M+qe8Rsz5BVBeLFgJa8KidiJbRezeX5w4iOXazpuClnrPh3\n\tCx2Yl6IdjoH7en/ZGrj5AQ6++nbEPGbIHj9Nce63w+C8WRvBer8wZeCrwQU5DJGLfV+X\n\tHWjJRAQ8qDYgRCnq08WF02u5u9cdXh09UTyHOXSaX5zwg4BFidbQXSPCIy01uOLPXLXD\n\tr/V0TsHdYO4LIDZSXCOV9IoB5O/XP+Hy1awJeiDv8kYNNPJd0gijnbKy1LtKUBbv+c3S\n\tWyTWngFIQdJ1WPTFupH91QpEbrOW+CYAH+P7gr4GRpIsxRmk3o4RBhk6ch8Rl4ifyBvH\n\t+XsQ==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20130820;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references;\n\tbh=nWPUEu+3MTWVLLZIuIqubksEoyy0MUKWIh9wTJyjgqA=;\n\tb=dJrESuVcuAkElarbF5gH7DU8Z9SmA7DiYZhWYRPI0JZd51/gk6wCw5/Z1fhuL+t5rq\n\tnS1fOsfG2HKWBF/bRQg2fvHObKI4AIoGoCl3yZ4PCbtMIoTJFDYvwqhtwWsa7CLHqYQ2\n\t210NwjxqHOCj1LXkoPJhbQeMEBu2uj62hohwdCocWIxr0VivwW2GqKdtzFOICDQHDEiU\n\tImiVcFuz5JZwA2JkOiAMV4LMBvmPWA0J+W7OMZMW/j7Tlv5QF1WEl9nSlP3sHQvTtjnR\n\tGsULvgbr1BXPoClvHKErKILMXnjyvu8G9ozmrekeXP+2gXHs6HWRLxrpxkqrgLWIjs8p\n\tgI9Q==",
        "X-Gm-Message-State": "AOPr4FXIDOUve2/gTKRXhXXSAJPh20spJigBxgCQJr26hLZX5R41o70gVYn3h+2BPe6Fsw==",
        "X-Received": "by 10.28.99.214 with SMTP id x205mr5841439wmb.9.1461358249955;\n\tFri, 22 Apr 2016 13:50:49 -0700 (PDT)",
        "From": "Samuel Martin <s.martin49@gmail.com>",
        "To": "buildroot@buildroot.org",
        "Date": "Fri, 22 Apr 2016 22:50:22 +0200",
        "Message-Id": "<1461358223-18312-11-git-send-email-s.martin49@gmail.com>",
        "X-Mailer": "git-send-email 2.8.0",
        "In-Reply-To": "<1461358223-18312-1-git-send-email-s.martin49@gmail.com>",
        "References": "<1461358223-18312-1-git-send-email-s.martin49@gmail.com>",
        "Subject": "[Buildroot] [PATCH v9 10/11] support/scripts/check-host-leaks: add\n\toption to classify leaks",
        "X-BeenThere": "buildroot@busybox.net",
        "X-Mailman-Version": "2.1.18-1",
        "Precedence": "list",
        "List-Id": "Discussion and development of buildroot <buildroot.busybox.net>",
        "List-Unsubscribe": "<http://lists.busybox.net/mailman/options/buildroot>,\n\t<mailto:buildroot-request@busybox.net?subject=unsubscribe>",
        "List-Archive": "<http://lists.busybox.net/pipermail/buildroot/>",
        "List-Post": "<mailto:buildroot@busybox.net>",
        "List-Help": "<mailto:buildroot-request@busybox.net?subject=help>",
        "List-Subscribe": "<http://lists.busybox.net/mailman/listinfo/buildroot>,\n\t<mailto:buildroot-request@busybox.net?subject=subscribe>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=\"us-ascii\"",
        "Content-Transfer-Encoding": "7bit",
        "Errors-To": "buildroot-bounces@busybox.net",
        "Sender": "\"buildroot\" <buildroot-bounces@busybox.net>"
    },
    "content": "This option can be useful to figure out patterns in the leaks.\n\nSigned-off-by: Samuel Martin <s.martin49@gmail.com>\n\n---\nchanges v8->v9:\n- update commit log\n\nchanges v7->v8:\n- new patch. Move this feature in its own change-set as it seems a bit\n  controversial.\n- make leaks classification optional\n---\n support/scripts/check-host-leaks | 59 ++++++++++++++++++++++++++++++++++++++--\n support/scripts/shell/readelf.sh |  1 -\n 2 files changed, 57 insertions(+), 3 deletions(-)",
    "diff": "diff --git a/support/scripts/check-host-leaks b/support/scripts/check-host-leaks\nindex 9f363af..bd92493 100755\n--- a/support/scripts/check-host-leaks\n+++ b/support/scripts/check-host-leaks\n@@ -45,6 +45,12 @@ Options:\n                 Can be set more than once.\n                 An excluded path must be an absolute canonical path.\n \n+        --classify-leaks\n+                Enables leak classification. Categories are defined according to\n+                the matched files' type or ELF kinds.\n+                For ELF files, the sections containing the leaks will displayed.\n+                Enabling this option substantially increases the execution time\n+                of the script.\n \n EOF\n   return ${ret}\n@@ -56,9 +62,51 @@ source.load_module log\n source.load_module utils\n source.load_module sdk\n \n+classify_leak() {\n+    local f=\"${1}\" regexp=\"${2}\"\n+    local leak\n+    if test -h \"${f}\" ; then leak=\"symlink\"\n+    elif readelf.is_elf \"${f}\" ; then\n+        if readelf.is_elf_executable \"${f}\" ; then leak=\"ELF/exe\"\n+        elif readelf.is_elf_shared_object \"${f}\" ; then leak=\"ELF/*.so\"\n+        elif readelf.is_elf_static_library \"${f}\" ; then leak=\"ELF/*.a\"\n+        elif readelf.is_elf_object \"${f}\" ; then\n+            case \"${f}\" in\n+                *.ko) leak=\"ELF/*.ko\" ;;\n+                *) leak=\"ELF/*.o\" ;;\n+            esac\n+        else leak=\"ELF/?\"\n+        fi\n+        local section\n+        local sections=()\n+        for section in $(readelf.list_sections \"${f}\") ; do\n+            if readelf.string_section \"${f}\" \"${section}\" |\n+                    grep -qaE \"${regexp}\" ; then\n+                if ! utils.list_has ${section} ${sections[@]} ; then\n+                    sections+=( \"${section}\" )\n+                fi\n+            fi\n+        done\n+        leak=\"${leak} [${sections[*]}]\"\n+    else\n+        case \"${f}\" in\n+            *-config) leak=\"*-config script\" ;;\n+            *.la) leak=\"*.la\" ;;\n+            *.pc) leak=\"*.pc\" ;;\n+            *.py) leak=\"*.py\" ;;\n+            *.pyc|*.pyo) leak=\"*.py[co]\" ;;\n+        esac\n+    fi\n+    if test -z \"${leak}\" ; then\n+        leak=\"? [$(file -z \"${f}\" | sed -e 's/.*: //')]\"\n+    fi\n+    printf \"${leak}\"\n+}\n+\n+\n main() {\n     local root_dir\n-    local class_leaks\n+    local classify_leaks\n     local excluded=()\n     local leak_paths=()\n     while test ${#} -gt 0 ; do\n@@ -67,6 +115,8 @@ main() {\n                 ;;\n             --exclude)   shift ; excluded+=( \"${1}\" )\n                 ;;\n+            --classify-leaks) classify_leaks=y\n+                ;;\n             -h|--help)\n                 usage\n                 exit 0\n@@ -119,7 +169,12 @@ main() {\n     grep -raEl \"${re_leaks}\" . |\n         sed -re \"${re_excl} ; s:^\\.:${root_dir}:\" |\n         while read f ; do\n-            printf \"%s\\n\" \"${f}\"\n+            if test -n \"${classify_leaks}\" ; then\n+                local leak=\"$(classify_leak \"${f}\" \"${regexp}\")\"\n+                printf \"%-70s : %-120s\\n\" \"${leak}\" \"${f}\"\n+            else\n+                printf \"%s\\n\" \"${f}\"\n+            fi\n         done | sort\n     popd >/dev/null\n }\ndiff --git a/support/scripts/shell/readelf.sh b/support/scripts/shell/readelf.sh\nindex b23666e..a7d790e 100644\n--- a/support/scripts/shell/readelf.sh\n+++ b/support/scripts/shell/readelf.sh\n@@ -54,7 +54,6 @@ source.declare_module readelf\n # environment:\n #   READELF: readelf program path\n readelf._match_elf_regexp() {\n-    log._trace_func\n     local regexp=\"${1}\" file=\"${2}\"\n     LC_ALL=C ${READELF} -h \"${file}\" 2>/dev/null | grep -qE \"${regexp}\"\n }\n",
    "prefixes": [
        "v9",
        "10/11"
    ]
}