[tarantool-patches] Re: [PATCH] lua: pwd: fix passwd and group traversal
Alexander Turenko
alexander.turenko at tarantool.org
Sun Aug 25 14:07:28 MSK 2019
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<struct passwd> to
> > pwd.getgr() and to pass cdata<struct group> 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.
Okay, I understood that you feel uncomfortable with the change of public
API. I'll prepare a patch for refactoring, but I'll ask Kirill to push
the small fix on Monday: two clients already ask us about the CentOS 6
problem.
Hope you don't mind.
Kirill, please consider the discussion and push the small fix.
I'll come back with a refactoring patch soon (hopefully even today).
WBR, Alexander Turenko.
More information about the Tarantool-patches
mailing list