[Rpm-maint] rpm --chroot and glibc/nscd

Michael Schroeder mls at suse.de
Tue May 17 13:36:22 UTC 2011

On Tue, May 17, 2011 at 04:27:08PM +0300, Panu Matilainen wrote:
> Did you try talking to glibc developers about this? Just asking so I 
> wont bother them again if they already told you to keep the pieces or 
> something to that effect...

Not really. I was never successful when proposing something to
Ulrich Drepper, so I didn't dare this time ;-)
Also, I needed a fix for the old SUSE versions, so it didn't make
much sense to ask for some new functionality.

But I agree that support in glibc would be much better than this
hack. Note that you have to both delete the ncsd connection and
flush the nss setup.

> >The patch also
> >- fixes the cache usage. lastUnameLen/lastGnameLen were never
> >   set, so the code *always* did a getpwuid/gid call!
> >- renames lastU/GnameLen to lastU/GnameAlloced in
> >   rpmugU/Gname, so that it is consistent with the
> >   rpmugU/Gid function.
> >
> >Even if you do not want the safe_lookup() part, having a
> >rpmugChroot() function that calls endpwent()/endgrent() and
> >drops the local caches if a chroot is done seems like a
> >good idea.
> Hmm, wouldn't it suffice to just store the rpmChrootDone() state in 
> rpmug and flush the caches etc when the chroot_done state has changed 
> between calls?

Yes, that was actually how I coded it earlier. I then simplified
it a bit -- how often is the chroot state changed?

> Other than that, will apply at least the other bits, I'll mull over the 
> safe_lookup() a bit (perhaps a bit academic but it might break if the 
> chrooted version is configured to use something else than files for user 
> information, but then it probably doesn't work now either due to glibc 
> remembering that stuff).

Yes, that's why it is better to tell glibc to re-read the nss
setup. OTOH it probably doesn't make much sense if glibc does
ldap lookups in the chroot or something like that.


Michael Schroeder                                   mls at suse.de
SUSE LINUX Products GmbH,  GF Jeff Hawn, HRB 16746 AG Nuernberg

More information about the Rpm-maint mailing list