Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/810282/?format=api
{ "id": 810282, "url": "http://patchwork.ozlabs.org/api/patches/810282/?format=api", "web_url": "http://patchwork.ozlabs.org/project/glibc/patch/1504643122-14874-7-git-send-email-adhemerval.zanella@linaro.org/", "project": { "id": 41, "url": "http://patchwork.ozlabs.org/api/projects/41/?format=api", "name": "GNU C Library", "link_name": "glibc", "list_id": "libc-alpha.sourceware.org", "list_email": "libc-alpha@sourceware.org", "web_url": "", "scm_url": "", "webscm_url": "", "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<1504643122-14874-7-git-send-email-adhemerval.zanella@linaro.org>", "list_archive_url": null, "date": "2017-09-05T20:25:19", "name": "[6/9] posix: fix glob bugs with long login names", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "826290dbe03fc9ee2b0c2a1a4773508a3ff9c960", "submitter": { "id": 66065, "url": "http://patchwork.ozlabs.org/api/people/66065/?format=api", "name": "Adhemerval Zanella", "email": "adhemerval.zanella@linaro.org" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/glibc/patch/1504643122-14874-7-git-send-email-adhemerval.zanella@linaro.org/mbox/", "series": [ { "id": 1647, "url": "http://patchwork.ozlabs.org/api/series/1647/?format=api", "web_url": "http://patchwork.ozlabs.org/project/glibc/list/?series=1647", "date": "2017-09-05T20:25:13", "name": "posix: glob fixes and refactor", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/1647/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/810282/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/810282/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<libc-alpha-return-84213-incoming=patchwork.ozlabs.org@sourceware.org>", "X-Original-To": "incoming@patchwork.ozlabs.org", "Delivered-To": [ "patchwork-incoming@bilbo.ozlabs.org", "mailing list libc-alpha@sourceware.org" ], "Authentication-Results": [ "ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=sourceware.org\n\t(client-ip=209.132.180.131; helo=sourceware.org;\n\tenvelope-from=libc-alpha-return-84213-incoming=patchwork.ozlabs.org@sourceware.org;\n\treceiver=<UNKNOWN>)", "ozlabs.org; dkim=pass (1024-bit key;\n\tsecure) header.d=sourceware.org header.i=@sourceware.org\n\theader.b=\"L60WJ9JQ\"; dkim-atps=neutral", "sourceware.org; auth=none" ], "Received": [ "from sourceware.org (server1.sourceware.org [209.132.180.131])\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 3xmytW22Tjz9t2c\n\tfor <incoming@patchwork.ozlabs.org>;\n\tWed, 6 Sep 2017 06:26:59 +1000 (AEST)", "(qmail 49565 invoked by alias); 5 Sep 2017 20:25:54 -0000", "(qmail 49068 invoked by uid 89); 5 Sep 2017 20:25:52 -0000" ], "DomainKey-Signature": "a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id\n\t:list-unsubscribe:list-subscribe:list-archive:list-post\n\t:list-help:sender:from:to:cc:subject:date:message-id:in-reply-to\n\t:references:mime-version:content-type:content-transfer-encoding;\n\tq=dns; s=default; b=IyVElSMt5ynXeezzvrIpxsQ/zRt552eRLlaNKJr9Vzx\n\tmzwbu8m3vbO80MiOJHevgqPoCRnEarw/WNl0f4cxKPrGvQk1XNaTAcqjz3LM7yVz\n\tX1ZDMZgNJgvRMJM55C5nNG0yklsKQxBbL0pA7KlydoFU+AD0gU0GgF/u/QGMe/kQ\n\t=", "DKIM-Signature": "v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id\n\t:list-unsubscribe:list-subscribe:list-archive:list-post\n\t:list-help:sender:from:to:cc:subject:date:message-id:in-reply-to\n\t:references:mime-version:content-type:content-transfer-encoding;\n\ts=default; bh=K4ZrIniorA0UDyV7WpblIRdAmpk=; b=L60WJ9JQEsmdsGiAN\n\tMP82DQFD3WLTZnjcVJH1chFGWkr3+4Mr3BHI6T9uVZNl372qRYY5ToHHAUtkBmM7\n\tcqk6yDzIx5CRe7yD1SQUAsYj3v+LfeIETW1jlbqgQPsKLFmq5rUGjRd3UANErXO2\n\ty+KTL+0NFMKUgGtdfppXgoB/FU=", "Mailing-List": "contact libc-alpha-help@sourceware.org; run by ezmlm", "Precedence": "bulk", "List-Id": "<libc-alpha.sourceware.org>", "List-Unsubscribe": "<mailto:libc-alpha-unsubscribe-incoming=patchwork.ozlabs.org@sourceware.org>", "List-Subscribe": "<mailto:libc-alpha-subscribe@sourceware.org>", "List-Archive": "<http://sourceware.org/ml/libc-alpha/>", "List-Post": "<mailto:libc-alpha@sourceware.org>", "List-Help": "<mailto:libc-alpha-help@sourceware.org>,\n\t<http://sourceware.org/ml/#faqs>", "Sender": "libc-alpha-owner@sourceware.org", "X-Virus-Found": "No", "X-Spam-SWARE-Status": "No, score=-26.4 required=5.0 tests=BAYES_00, GIT_PATCH_0,\n\tGIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE,\n\tRCVD_IN_SORBS_SPAM,\n\tSPF_PASS autolearn=ham version=3.3.2 spammy=", "X-HELO": "mail-qt0-f177.google.com", "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:mime-version:content-transfer-encoding;\n\tbh=cRQPchhIXMogBPuGPpsjboir3fNQqjdAR5wB7sWk+4I=;\n\tb=hEPxWBoOzudli4JehLA/B7xW10tc39zbi19lxXlNjRkvzBbkO7iuVFduBpFNX2dnsA\n\t0nJ7lkpXDEAMF8oIBFOzBjQQ1yHTwEML2/XB2IL58ynB1bBazQp6RKkbVcUc5yg6zc89\n\tT7hEqVi6e8wewESRrW2Wr/qaNhqEkfr5/RHN9Stoz2w9vsPSyQNmZ7AzJlC2ACjy8MW6\n\tuTx1Lwuvs9je2a9K6tYxO//zdUbzvPWcBwamLKjqEFqnIfEO6DetTV9U/lK1VX2SK789\n\t09tL/8t3AUQiLCaze9l7v52UqfS74ajDRJAtgzffpln8SQwSMRqxsIe6aU/8Mdv9oRzs\n\t4c5w==", "X-Gm-Message-State": "AHPjjUglRqUPdsrYzyCZr3VnbR2tHfO738wp80EXGw8QOALHe9VNGkJ1\n\tAxSxdebvb2cnw+4T5BftoA==", "X-Google-Smtp-Source": "ADKCNb4fcYHioi8FyMqK7yBjGIJXG4RelwrHnM9wOg1aabXkBRJ3/yQXfYIPmHNOXKdLtTIPGp2Usw==", "X-Received": "by 10.200.22.201 with SMTP id y9mr422204qtk.115.1504643142902;\n\tTue, 05 Sep 2017 13:25:42 -0700 (PDT)", "From": "Adhemerval Zanella <adhemerval.zanella@linaro.org>", "To": "libc-alpha@sourceware.org", "Cc": "Paul Eggert <eggert@cs.ucla.edu>", "Subject": "[PATCH 6/9] posix: fix glob bugs with long login names", "Date": "Tue, 5 Sep 2017 17:25:19 -0300", "Message-Id": "<1504643122-14874-7-git-send-email-adhemerval.zanella@linaro.org>", "In-Reply-To": "<1504643122-14874-1-git-send-email-adhemerval.zanella@linaro.org>", "References": "<1504643122-14874-1-git-send-email-adhemerval.zanella@linaro.org>", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=UTF-8", "Content-Transfer-Encoding": "8bit" }, "content": "Current glob implementation allows unlimited user name for home\ndirectory construction on GLOB_TILDE case. To accomplish it glob\neither construct a name on stack if size are small enough (based\non current alloca_used) or in heap otherwise.\n\nThis patch simplifies storage allocation by using the same scratch\nbuffer for both get_rlogin_r and getpwnam_r.\n\nThis also syncs with gnulib commit 064df0b (glob: fix bugs with long\nlogin names).\n\nChecked on x86_64-linux-gnu and on a build using build-many-glibcs.py\nfor all major architectures.\n\n\t* posix/glob.c (GET_LOGIN_NAME_MAX): Remove.\n\t(glob): Use the same scratch buffer for both getlogin_r and\n\tgetpwnam_r. Don’t require preallocation of the login name. This\n\tsimplifies storage allocation, and corrects the handling of\n\tlong login names.\n---\n ChangeLog | 7 +++++\n posix/glob.c | 88 +++++++++++++++++++++---------------------------------------\n 2 files changed, 37 insertions(+), 58 deletions(-)", "diff": "diff --git a/posix/glob.c b/posix/glob.c\nindex 340cf08..2c8a3dc 100644\n--- a/posix/glob.c\n+++ b/posix/glob.c\n@@ -75,12 +75,6 @@\n #include <flexmember.h>\n #include <glob_internal.h>\n #include <scratch_buffer.h>\n-\n-#ifdef _SC_LOGIN_NAME_MAX\n-# define GET_LOGIN_NAME_MAX()\tsysconf (_SC_LOGIN_NAME_MAX)\n-#else\n-# define GET_LOGIN_NAME_MAX()\t(-1)\n-#endif\n \f\n static const char *next_brace_sub (const char *begin, int flags) __THROWNL;\n \n@@ -611,67 +605,45 @@ glob (const char *pattern, int flags, int (*errfunc) (const char *, int),\n \t else\n \t\thome_dir = \"c:/users/default\"; /* poor default */\n #else\n-\t int success;\n-\t char *name;\n-\t int malloc_name = 0;\n-\t size_t buflen = GET_LOGIN_NAME_MAX () + 1;\n-\n-\t if (buflen == 0)\n-\t\t/* 'sysconf' does not support _SC_LOGIN_NAME_MAX. Try\n-\t\t a moderate value. */\n-\t\tbuflen = 20;\n-\t if (glob_use_alloca (alloca_used, buflen))\n-\t\tname = alloca_account (buflen, alloca_used);\n-\t else\n+\t int err;\n+\t struct passwd *p;\n+\t struct passwd pwbuf;\n+\t struct scratch_buffer s;\n+\t scratch_buffer_init (&s);\n+\t while (true)\n \t\t{\n-\t\t name = malloc (buflen);\n-\t\t if (name == NULL)\n+\t\t p = NULL;\n+\t\t err = __getlogin_r (s.data, s.length);\n+\t\t if (err == 0)\n \t\t {\n-\t\t retval = GLOB_NOSPACE;\n-\t\t goto out;\n-\t\t }\n-\t\t malloc_name = 1;\n-\t\t}\n-\n-\t success = __getlogin_r (name, buflen) == 0;\n-\t if (success)\n-\t\t{\n-\t\t struct passwd *p;\n-\t\t struct scratch_buffer pwtmpbuf;\n-\t\t scratch_buffer_init (&pwtmpbuf);\n # if defined HAVE_GETPWNAM_R || defined _LIBC\n-\t\t struct passwd pwbuf;\n-\n-\t\t while (getpwnam_r (name, &pwbuf,\n-\t\t\t\t pwtmpbuf.data, pwtmpbuf.length, &p)\n-\t\t\t == ERANGE)\n-\t\t {\n-\t\t if (!scratch_buffer_grow (&pwtmpbuf))\n-\t\t\t{\n-\t\t\t retval = GLOB_NOSPACE;\n-\t\t\t goto out;\n-\t\t\t}\n-\t\t }\n+\t\t size_t ssize = strlen (s.data) + 1;\n+\t\t err = getpwnam_r (s.data, &pwbuf, s.data + ssize,\n+\t\t\t\t\ts.length - ssize, &p);\n # else\n-\t\t p = getpwnam (name);\n+\t\t p = getpwnam (s.data);\n+\t\t if (p == NULL)\n+\t\t\terr = errno;\n # endif\n-\t\t if (p != NULL)\n+\t\t }\n+\t\t if (err != ERANGE)\n+\t\t break;\n+\t\t if (!scratch_buffer_grow (&s))\n \t\t {\n-\t\t home_dir = strdup (p->pw_dir);\n-\t\t malloc_home_dir = 1;\n-\t\t if (home_dir == NULL)\n-\t\t\t{\n-\t\t\t scratch_buffer_free (&pwtmpbuf);\n-\t\t\t retval = GLOB_NOSPACE;\n-\t\t\t goto out;\n-\t\t\t}\n+\t\t retval = GLOB_NOSPACE;\n+\t\t goto out;\n \t\t }\n-\t\t scratch_buffer_free (&pwtmpbuf);\n \t\t}\n-\t else\n+\t if (err == 0)\n+\t\t{\n+\t\t home_dir = strdup (p->pw_dir);\n+\t\t malloc_home_dir = 1;\n+\t\t}\n+\t scratch_buffer_free (&s);\n+\t if (err == 0 && home_dir == NULL)\n \t\t{\n-\t\t if (__glibc_unlikely (malloc_name))\n-\t\t free (name);\n+\t\t retval = GLOB_NOSPACE;\n+\t\t goto out;\n \t\t}\n #endif /* WINDOWS32 */\n \t }\n", "prefixes": [ "6/9" ] }