Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 27 Jul 2018 18:03:04 +0300
From:      Konstantin Belousov <kostikbel@gmail.com>
To:        Ian Lepore <ian@FreeBSD.org>
Cc:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   Re: svn commit: r336746 - in head/lib: libc/gen libutil
Message-ID:  <20180727150304.GA2489@kib.kiev.ua>
In-Reply-To: <201807261834.w6QIYc9i080738@repo.freebsd.org>
References:  <201807261834.w6QIYc9i080738@repo.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Jul 26, 2018 at 06:34:38PM +0000, Ian Lepore wrote:
> Author: ian
> Date: Thu Jul 26 18:34:38 2018
> New Revision: 336746
> URL: https://svnweb.freebsd.org/changeset/base/336746
> 
> Log:
>   Make pw_scan(3) more compatible with getpwent(3) et. al. when processing
>   data from /etc/passwd rather than /etc/master.passwd.
>   
>   The libc getpwent(3) and related functions automatically read master.passwd
>   when run by root, or passwd when run by a non-root user.  When run by non-
>   root, getpwent() copes with the missing data by setting the corresponding
>   fields in the passwd struct to known values (zeroes for numbers, or a
>   pointer to an empty string for literals).  When libutil's pw_scan(3) was
>   used to parse a line without the root-accessible data, it was leaving
>   garbage in the corresponding fields.
>   
>   These changes rename the static pw_init() function used by getpwent() and
>   friends to __pw_initpwd(), and move it into pw_scan.c so that common init
>   code can be shared between libc and libutil.  pw_scan(3) now calls
>   __pw_initpwd() before __pw_scan(), just like the getpwent() family does, so
>   that reading an arbitrary passwd file in either format and parsing it with
>   pw_scan(3) returns the same results as getpwent(3) would.
>   
>   This also adds a new pw_initpwd(3) function to libutil, so that code which
>   creates passwd structs from scratch in some manner that doesn't involve
>   pw_scan() can initialize the struct to the values expected by lots of
>   existing code, which doesn't expect to encounter NULL pointers or garbage
>   values in some fields.
> 
If my reading is right, you just made libutil depend on the internal
libc interfaces. Formal consequence is that libutil.so version must
be bumped each time the used interface is changed (and it is allowed
to change). I think that your change actually requires the bump of
libutil.so.N version already.

Also, libutil.so.N should be moved from the libutil pkgbase package to
the clibs package, I am not sure about this.

At the higher level, I very much dislike this change. FBSDprivate_1.0
namespace is for symbols providing the internal interfaces for the
C runtime implementation in the FreeBSD. This is mostly a knot of
inter-dependencies between rtld, libc and libthr. libutil arguably
should not participate.

If you want for libc to provide a functionality outside the C runtime,
please make the sustainable interface, which ABI can be maintained, and
export the symbols in the normal namespace, with the usual stability
guarantees.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20180727150304.GA2489>