get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 871860,
    "url": "http://patchwork.ozlabs.org/api/patches/871860/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/lede/patch/1518404425-50957-2-git-send-email-yszhou4tech@gmail.com/",
    "project": {
        "id": 54,
        "url": "http://patchwork.ozlabs.org/api/projects/54/?format=api",
        "name": "LEDE development",
        "link_name": "lede",
        "list_id": "lede-dev.lists.infradead.org",
        "list_email": "lede-dev@lists.infradead.org",
        "web_url": "http://lede-project.org/",
        "scm_url": "",
        "webscm_url": "http://git.lede-project.org/",
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<1518404425-50957-2-git-send-email-yszhou4tech@gmail.com>",
    "list_archive_url": null,
    "date": "2018-02-12T03:00:25",
    "name": "[LEDE-DEV,v2,procd,2/2] service: initialize supplementary group ids",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "36b4eec37150c7371e9f6a4c317b97d2e608afa3",
    "submitter": {
        "id": 65295,
        "url": "http://patchwork.ozlabs.org/api/people/65295/?format=api",
        "name": "Yousong Zhou",
        "email": "yszhou4tech@gmail.com"
    },
    "delegate": {
        "id": 54613,
        "url": "http://patchwork.ozlabs.org/api/users/54613/?format=api",
        "username": "blogic",
        "first_name": "John",
        "last_name": "Crispin",
        "email": "blogic@openwrt.org"
    },
    "mbox": "http://patchwork.ozlabs.org/project/lede/patch/1518404425-50957-2-git-send-email-yszhou4tech@gmail.com/mbox/",
    "series": [
        {
            "id": 28001,
            "url": "http://patchwork.ozlabs.org/api/series/28001/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/lede/list/?series=28001",
            "date": "2018-02-12T03:00:25",
            "name": "[LEDE-DEV,v2,procd,1/2] service: add func for string config change check",
            "version": 2,
            "mbox": "http://patchwork.ozlabs.org/series/28001/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/871860/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/871860/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<lede-dev-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org>",
        "X-Original-To": "incoming@patchwork.ozlabs.org",
        "Delivered-To": "patchwork-incoming@bilbo.ozlabs.org",
        "Authentication-Results": [
            "ozlabs.org; spf=none (mailfrom)\n\tsmtp.mailfrom=lists.infradead.org\n\t(client-ip=2001:8b0:10b:1236::1; helo=casper.infradead.org;\n\tenvelope-from=lede-dev-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org;\n\treceiver=<UNKNOWN>)",
            "ozlabs.org; dkim=pass (2048-bit key;\n\tunprotected) header.d=infradead.org header.i=@infradead.org\n\theader.b=\"CoB6fj2V\"; dkim=pass (2048-bit key;\n\tunprotected) header.d=lists.infradead.org\n\theader.i=@lists.infradead.org header.b=\"HmKFTrw1\"; \n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"BD33T+CS\"; dkim-atps=neutral"
        ],
        "Received": [
            "from casper.infradead.org (casper.infradead.org\n\t[IPv6:2001:8b0:10b:1236::1])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3zfrWG5Zqkz9sPk\n\tfor <incoming@patchwork.ozlabs.org>;\n\tMon, 12 Feb 2018 14:19:36 +1100 (AEDT)",
            "from [198.137.202.133] (helo=bombadil.infradead.org)\n\tby casper.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux))\n\tid 1el4eI-0002Ej-4w\n\tfor incoming@patchwork.ozlabs.org; Mon, 12 Feb 2018 03:19:22 +0000",
            "from localhost ([127.0.0.1] helo=bombadil.infradead.org)\n\tby bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux))\n\tid 1el4O5-0002j3-Iu; Mon, 12 Feb 2018 03:02:37 +0000",
            "from mail-vk0-x242.google.com ([2607:f8b0:400c:c05::242])\n\tby bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux))\n\tid 1el4Nu-0002XL-Ns\n\tfor lede-dev@lists.infradead.org; Mon, 12 Feb 2018 03:02:27 +0000",
            "by mail-vk0-x242.google.com with SMTP id x203so8027208vkx.10\n\tfor <lede-dev@lists.infradead.org>;\n\tSun, 11 Feb 2018 19:02:16 -0800 (PST)",
            "from titan2.office.mos ([104.238.138.31])\n\tby smtp.gmail.com with ESMTPSA id\n\ta12sm1035016uak.41.2018.02.11.19.02.13\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tSun, 11 Feb 2018 19:02:14 -0800 (PST)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;\n\td=infradead.org; s=casper.20170209;\n\th=Sender:Content-Transfer-Encoding:\n\tContent-Type:MIME-Version:Cc:List-Subscribe:List-Help:List-Post:List-Archive:\n\tList-Unsubscribe:List-Id:Subject:References:In-Reply-To:Message-Id:Date:To:\n\tFrom:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:\n\tResent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner;\n\tbh=oQbw52EmnMMX6Xj8/nRhc9BWOFZ5oE5rND8OmvctlSg=;\n\tb=CoB6fj2V5MDtkIOXOGHaV5leBz\n\t9YPkjjeYQ7nA2+IyV1AUVVBesUXjbH9nkxAOG18CYJmOkYXH6ytOvMvKyULmg1oV1iRwMrFDO9pd4\n\tmoVzvy1XLjvbMFaIlsp6AHiOrcomcHdGeCkIQ/YbmllToGqLhdpVQEjKhPTyWA8Oei6FFzbwPR/Xj\n\tYpBDwntg9obARXidOqK36TOoRIjeYPgh6xFQH5uGblS3BXN1ef1VSXbb+Ctm6uGW9e+3g1M8K+zd/\n\trbL2D70te4iC6YzXsuYZ/3Hw7uf/F7H3Bv3PcSuge9EVq12gMGxQMDaeHK6sSLvk0ETC2eOZ+3P5T\n\t0B6inT7g==;",
            "v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;\n\td=lists.infradead.org; s=bombadil.20170209; h=Sender:\n\tContent-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe:\n\tList-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Subject:References:\n\tIn-Reply-To:Message-Id:Date:To:From:Reply-To:Content-ID:Content-Description:\n\tResent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:\n\tList-Owner; bh=oQbw52EmnMMX6Xj8/nRhc9BWOFZ5oE5rND8OmvctlSg=;\n\tb=HmKFTrw1VbhxYV\n\tL0tEdqlrAZdPnS3f+hmYBHUKE8tON5KITQyyUBd85tyLX1JkgBukQ+B2MKZE1WTBONIheifE2cK0E\n\tYS9bBSQRUDVct98MPy54XD6v1aA8Lpj374fQ1pcouzLZhjJfcLj6PkvqDznBGqM2P4sj6PrjKNLYO\n\t+PQBCKDlbne3DGIXVLdSDsXAILNOQmjlzcjxL4gWPfN/c5YsK9XPJubglRpd5k/IPByejuWJpzwyX\n\tlmSk3gmoN/tNvxJM93OnyfwCqGc3vMDKIdYTTrPnVXOcsS/QicFwTeFNT5hayVfIf4DdNveH1SLQ0\n\t5lVmzk1GKAXWY2kS94Dg==;",
            "v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references;\n\tbh=FQHwQGf+0mVf0BotcOmiGXB/Ou/eo2u17Dk8iNhGneg=;\n\tb=BD33T+CSCLDuUID80KJ7oequIAOhCtSEmBhIHColxI/f0U91/ymyrkOuWizk1uzbZE\n\tnw423Z8LOEQ3ut0fI8CxOB5h66ZSuK9469nXFdVEdrKHfwTl4qkDvobggyUreI2TArdS\n\t0J5yGFib+SdBgCXV5wJEVK0vp6iD1cgJP+RVzhG1OoPSW5zVbZws1qQp1De5GVZ1nzo5\n\tJOWHvv/et7f2LOtg5bsDWYVoeJaxM1vL2BteInyFC9lCXxmheqgpvh3ASkwEqevIfgP7\n\ts4bwzEIRywTn81lAlSGC67X7y6W4kir4NLk1jcQTRMBPRyDRQ8LU8Zru4EkluHvcX8S7\n\tkHbg=="
        ],
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references;\n\tbh=FQHwQGf+0mVf0BotcOmiGXB/Ou/eo2u17Dk8iNhGneg=;\n\tb=OKAabfYHvwrTdHlQWNTnpri4ec/CB53zYzxozd245EOovM/kBZqtXDw6Y6sZqR3twY\n\tqiSycL39zJBgD/Xaa9L9B6pGoRhcknm5uQa2vQKImv94428q8mOf8eExJvmX21anNXJ7\n\tV3AAD80jjRGp5D8L7524WzBrMBGEHRswIs5tY/P8l7fqfCj5RQneavRW0NCFRThQQBYK\n\tgnxEOIo59VNnAGIPaXHrfxn6brZ8L1+YKPTUn2bDmmpi62wDMoPWAWoh8X4i64IX2mDO\n\t9snav6/rMc/gxqEhdV6GDIKS6R+EtfB1o2C+/It4yjOyhgI3cM4sO9D+A8qQprm+QMv1\n\tCXug==",
        "X-Gm-Message-State": "APf1xPCS4qlWSDI1dAkwC0/Gk59buCigm0k7WgC8Nrya6DFTd/zb9VUN\n\ty+yAw9wbYiLY3YCE7UA5kYQ=",
        "X-Google-Smtp-Source": "AH8x226XSsI69VOl8brKwA7SMTXZXmP0XIJ04+hg6R6fC1tfX8Q+fzr7+tkutoeYarQkUvf5nDxJmA==",
        "X-Received": "by 10.31.74.67 with SMTP id x64mr2850623vka.69.1518404535195;\n\tSun, 11 Feb 2018 19:02:15 -0800 (PST)",
        "From": "Yousong Zhou <yszhou4tech@gmail.com>",
        "To": "john@phrozen.org",
        "Date": "Mon, 12 Feb 2018 11:00:25 +0800",
        "Message-Id": "<1518404425-50957-2-git-send-email-yszhou4tech@gmail.com>",
        "X-Mailer": "git-send-email 1.8.3.1",
        "In-Reply-To": "<1518404425-50957-1-git-send-email-yszhou4tech@gmail.com>",
        "References": "<1518404425-50957-1-git-send-email-yszhou4tech@gmail.com>",
        "X-Spam-Note": "CRM114 invocation failed",
        "X-Spam-Score": "-2.0 (--)",
        "X-Spam-Report": "SpamAssassin version 3.4.1 on bombadil.infradead.org summary:\n\tContent analysis details:   (-2.0 points)\n\tpts rule name              description\n\t---- ----------------------\n\t--------------------------------------------------\n\t-0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/,\n\tno\n\ttrust [2607:f8b0:400c:c05:0:0:0:242 listed in] [list.dnswl.org]\n\t0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail\n\tprovider (yszhou4tech[at]gmail.com)\n\t-0.0 SPF_PASS               SPF: sender matches SPF record\n\t-1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%\n\t[score: 0.0000]\n\t-0.1 DKIM_VALID Message has at least one valid DKIM or DK signature\n\t0.1 DKIM_SIGNED            Message has a DKIM or DK signature,\n\tnot necessarily valid\n\t-0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from\n\tauthor's domain",
        "Subject": "[LEDE-DEV] [PATCH v2][procd 2/2] service: initialize supplementary\n\tgroup ids",
        "X-BeenThere": "lede-dev@lists.infradead.org",
        "X-Mailman-Version": "2.1.21",
        "Precedence": "list",
        "List-Id": "<lede-dev.lists.infradead.org>",
        "List-Unsubscribe": "<http://lists.infradead.org/mailman/options/lede-dev>,\n\t<mailto:lede-dev-request@lists.infradead.org?subject=unsubscribe>",
        "List-Archive": "<http://lists.infradead.org/pipermail/lede-dev/>",
        "List-Post": "<mailto:lede-dev@lists.infradead.org>",
        "List-Help": "<mailto:lede-dev-request@lists.infradead.org?subject=help>",
        "List-Subscribe": "<http://lists.infradead.org/mailman/listinfo/lede-dev>,\n\t<mailto:lede-dev-request@lists.infradead.org?subject=subscribe>",
        "Cc": "Yousong Zhou <yszhou4tech@gmail.com>, lede-dev@lists.infradead.org",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=\"us-ascii\"",
        "Content-Transfer-Encoding": "7bit",
        "Sender": "\"Lede-dev\" <lede-dev-bounces@lists.infradead.org>",
        "Errors-To": "lede-dev-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org"
    },
    "content": "We currently only call setgid() with user's primary group id for service\ninstance processes.  In the case of a user belong to multiple groups,\nit's natural to also explicitly initialize their supplementary group ids\n\nFixes FS#988\n\nSigned-off-by: Yousong Zhou <yszhou4tech@gmail.com>\n---\n service/instance.c | 13 ++++++++++++-\n service/instance.h |  1 +\n 2 files changed, 13 insertions(+), 1 deletion(-)",
    "diff": "diff --git a/service/instance.c b/service/instance.c\nindex c3f8b56..76573f7 100644\n--- a/service/instance.c\n+++ b/service/instance.c\n@@ -17,6 +17,7 @@\n #include <sys/types.h>\n #include <sys/socket.h>\n #include <sys/stat.h>\n+#include <grp.h>\n #include <net/if.h>\n #include <unistd.h>\n #include <stdint.h>\n@@ -348,6 +349,10 @@ instance_run(struct service_instance *in, int _stdout, int _stderr)\n \t\tclosefd(_stderr);\n \t}\n \n+\tif (in->user && in->gid && initgroups(in->user, in->gid)) {\n+\t\tERROR(\"failed to initgroups() for user %s: %m\\n\", in->user);\n+\t\texit(127);\n+\t}\n \tif (in->gid && setgid(in->gid)) {\n \t\tERROR(\"failed to set group id %d: %m\\n\", in->gid);\n \t\texit(127);\n@@ -614,6 +619,9 @@ instance_config_changed(struct service_instance *in, struct service_instance *in\n \tif (in->nice != in_new->nice)\n \t\treturn true;\n \n+\tif (string_changed(in->user, in_new->user))\n+\t\treturn true;\n+\n \tif (in->uid != in_new->uid)\n \t\treturn true;\n \n@@ -863,8 +871,10 @@ instance_config_parse(struct service_instance *in)\n \t}\n \n \tif (tb[INSTANCE_ATTR_USER]) {\n-\t\tstruct passwd *p = getpwnam(blobmsg_get_string(tb[INSTANCE_ATTR_USER]));\n+\t\tconst char *user = blobmsg_get_string(tb[INSTANCE_ATTR_USER]);\n+\t\tstruct passwd *p = getpwnam(user);\n \t\tif (p) {\n+\t\t\tin->user = strdup(user);\n \t\t\tin->uid = p->pw_uid;\n \t\t\tin->gid = p->pw_gid;\n \t\t}\n@@ -983,6 +993,7 @@ instance_free(struct service_instance *in)\n \twatch_del(in);\n \tinstance_config_cleanup(in);\n \tfree(in->config);\n+\tfree(in->user);\n \tfree(in);\n }\n \ndiff --git a/service/instance.h b/service/instance.h\nindex bdd14de..771406c 100644\n--- a/service/instance.h\n+++ b/service/instance.h\n@@ -42,6 +42,7 @@ struct service_instance {\n \tint8_t nice;\n \tbool valid;\n \n+\tchar *user;\n \tuid_t uid;\n \tgid_t gid;\n \n",
    "prefixes": [
        "LEDE-DEV",
        "v2",
        "procd",
        "2/2"
    ]
}