From reviews-return-53098-apmail-mesos-reviews-archive=mesos.apache.org@mesos.apache.org Thu Dec 22 20:50:27 2016 Return-Path: X-Original-To: apmail-mesos-reviews-archive@minotaur.apache.org Delivered-To: apmail-mesos-reviews-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 7494619C85 for ; Thu, 22 Dec 2016 20:50:27 +0000 (UTC) Received: (qmail 14075 invoked by uid 500); 22 Dec 2016 20:50:27 -0000 Delivered-To: apmail-mesos-reviews-archive@mesos.apache.org Received: (qmail 14044 invoked by uid 500); 22 Dec 2016 20:50:27 -0000 Mailing-List: contact reviews-help@mesos.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: reviews@mesos.apache.org Delivered-To: mailing list reviews@mesos.apache.org Received: (qmail 14028 invoked by uid 99); 22 Dec 2016 20:50:27 -0000 Received: from reviews-vm.apache.org (HELO reviews.apache.org) (140.211.11.40) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 22 Dec 2016 20:50:27 +0000 Received: from reviews.apache.org (localhost [127.0.0.1]) by reviews.apache.org (Postfix) with ESMTP id A43F030F67F; Thu, 22 Dec 2016 20:50:26 +0000 (UTC) Content-Type: multipart/alternative; boundary="===============4619244824564734442==" MIME-Version: 1.0 Subject: Re: Review Request 54952: Made `getpwnam_r` error handling more robust. From: Neil Conway To: Alexander Rukletsov Cc: Neil Conway , mesos Date: Thu, 22 Dec 2016 20:50:26 -0000 Message-ID: <20161222205026.1709.48989@reviews.apache.org> X-ReviewBoard-URL: https://reviews.apache.org/ Auto-Submitted: auto-generated Sender: Neil Conway X-ReviewGroup: mesos X-Auto-Response-Suppress: DR, RN, OOF, AutoReply X-ReviewRequest-URL: https://reviews.apache.org/r/54952/ X-Sender: Neil Conway References: <20161221223805.1709.35498@reviews.apache.org> In-Reply-To: <20161221223805.1709.35498@reviews.apache.org> Reply-To: Neil Conway X-ReviewRequest-Repository: mesos --===============4619244824564734442== MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/54952/ ----------------------------------------------------------- (Updated Dec. 22, 2016, 8:50 p.m.) Review request for mesos and Alexander Rukletsov. Changes ------- New approach, per discussion with AlexR. Summary (updated) ----------------- Made `getpwnam_r` error handling more robust. Bugs: MESOS-6826 https://issues.apache.org/jira/browse/MESOS-6826 Repository: mesos Description (updated) ------- According to POSIX, `getpwnam_r` returns 0 (and sets `result` to the null pointer) when the specified user name is not found. However, certain versions of Linux (e.g., RHEL7, recent Arch Linux) return non-zero and set `errno` (to one of several different values) when `getpwnam_r` is passed an invalid user name. In stout, we want to treat the "invalid user name" and "user name not found" cases the same. Both the POSIX spec and Linux manpages call out certain errno values as definitely indicating errors (e.g., EIO, EMFILE). On Linux, we check `errno` and return an error to the caller if `errno` appears in that list. We treat `errno` values not in that list as equivalent to "user not found". On other (Unix) platforms, we treat any non-zero return value from `getpwnam_r` as indicating an error. Diffs (updated) ----- 3rdparty/stout/include/stout/os/posix/su.hpp f3f45ebf006f0f8e7e70b0f4c4ed76465530c58e 3rdparty/stout/tests/os_tests.cpp 8d2005b1f109b4025aa8368600763db9c829d0c5 Diff: https://reviews.apache.org/r/54952/diff/ Testing ------- `make check` on Arch Linux. `OsTest.User` fails without this patch but succeeds with this patch. Thanks, Neil Conway --===============4619244824564734442==--