From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id E390426801 for ; Mon, 26 Aug 2019 05:43:49 -0400 (EDT) Received: from turing.freelists.org ([127.0.0.1]) by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id yg0UD2nxEIbs for ; Mon, 26 Aug 2019 05:43:49 -0400 (EDT) Received: from smtp45.i.mail.ru (smtp45.i.mail.ru [94.100.177.105]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTPS id 4E39E26295 for ; Mon, 26 Aug 2019 05:43:49 -0400 (EDT) Date: Mon, 26 Aug 2019 12:43:31 +0300 From: Alexander Turenko Subject: [tarantool-patches] Re: [PATCH] lua: pwd: fix passwd and group traversal Message-ID: <20190826094331.pj6kqw3vtbuszy2u@tkn_work_nb> References: <5545c38a61fe1867743a75b6bb4767b8e87c629e.1566524401.git.alexander.turenko@tarantool.org> <017216c6-6d77-6298-b71a-a9b131fa360a@tarantool.org> <20190825110727.3o2hpoe2sztpjtoe@tkn_work_nb> <22d67148-2b5d-e025-a739-6426d759e546@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <22d67148-2b5d-e025-a739-6426d759e546@tarantool.org> Sender: tarantool-patches-bounce@freelists.org Errors-to: tarantool-patches-bounce@freelists.org Reply-To: tarantool-patches@freelists.org List-Help: List-Unsubscribe: List-software: Ecartis version 1.0.0 List-Id: tarantool-patches List-Subscribe: List-Owner: List-post: List-Archive: To: Vladislav Shpilevoy Cc: tarantool-patches@freelists.org, Kirill Yukhin On Sun, Aug 25, 2019 at 08:03:13PM +0200, Vladislav Shpilevoy wrote: > > > On 25/08/2019 13:07, Alexander Turenko wrote: > > On Fri, Aug 23, 2019 at 10:26:05PM +0200, Vladislav Shpilevoy wrote: > >> Hi! Thanks for the patch! > >> > >>> The primary reason of this commit is to overcome a startup hang on > >>> CentOS 6. > >>> > >>> https://github.com/tarantool/tarantool/issues/4428 > >>> https://github.com/tarantool/tarantool/issues/4447 > >>> https://github.com/tarantool/tarantool/issues/4271 > >>> https://github.com/tarantool/tarantool/tree/Totktonada/gh-4447-fix-centos-6-startup-fail-full-ci > >>> > >>> Waiting for CI: > >>> https://gitlab.com/tarantool/tarantool/pipelines/77906160 > >>> > >>> I manually verified that tarantool starts on CentOS 6 after the change. > >>> Also verified that the module can be used now on FreeBSD 12.0. > >>> > >>> I understood that the commit formally changes a behaviour that can be > >>> visible for a user: it allows to pass cdata to > >>> pwd.getgr() and to pass cdata to pwd.getgr(). It is > >>> unlikely that one will want to use it or will find this ability by an > >>> occasion. Maybe only with pwd.getpw(1LL) or so, but luajit will report > >>> an error in the case. My intention was to keep the commit short and > >>> avoid refactoring of the module code. > >> > >> But this module is not a rocket science, even its whole rewrite would > >> not be hard. Here the refactoring is quite simple, please, consider > >> my proposal on the branch and below. You can squash it or keep - anyway > >> LGTM. Note, I didn't test my 'fixes', so perhaps they are totally wrong. > >> > >> ========================================================================= > > > >> +local function pwtotable(pw) > >> + return { > >> name = ffi.string(pw.pw_name), > >> id = tonumber(pw.pw_uid), > >> group = getgr(pw.pw_gid), > > > > I did the exactly same, but then observed that getgr() call should not > > be part of pwtotable() function. > > Why? It does not affect pw iterators. It'll affect group iterator. My idea was to split receiveing of data from 'deserialization'. WBR, Alexander Turenko.