Page MenuHome GnuPG

gpgrt: Static linking support
Open, LowPublic

Description

sysutils.c has a use of getpwnam and getpwuid (for _gpgrt_vfnameconcat, tilde expansion).

In some OSes (Solaris, GNU, FreeBSD, etc.), nsswitch is used and dynamic loading/linking is used internally for these getpw* functions.

With GNU libc, at build time, it tells the possible mismatch at runtime, when static link is specified.

Basically, full static linking is not possible when we use getpw* functions on a system with nsswitch which uses dynamic loading/linking.

Possibly, we can change the behavior of _gpgrt_vfnameconcat's tilde expansion for static linked version.

Event Timeline

werner edited projects, added Feature Request, Linux; removed Bug Report.
werner added a subscriber: werner.

Let us mark this as a feature requests. gepwnam(3) is a standard libc function and if glibc does not support it; this is more likely a glibc bug than a bug in an application.

TL;DR
This ticket was created because building static-linked gpgv shows warnings from glibc for getpwnam and getpwuid.
Basically, we can/should ignore the warnings from glibc at link time (for normal use cases), because it is irrelevant.

Reasons:

  • These days, it's nscd [0] which handles the name service switch.
  • So, an application does not dynamic load/link at runtime for those functions. Thus, no possible compatibility problem at all.
  • Only when/if nscd is disabled/notavailable, it will be an application which may does dynamic load/link at runtime. And only when/if the dynamic loaded module will have a compatibility issue, it will cause a problem.
  • The warnings themselves are relevant to cover this kind of corner cases, but not for normal cases in general.

[0] https://www.man7.org/linux/man-pages/man8/nscd.8.html

It's like three decades now, after Sun invented the name service switch. It has dynamic nature, unfortunately.
(I mean, it's not glibc only.)

BTW, I learned that musl libc 1.1.7 added support for alternative backends via the NSCD protocol.

gniibe mentioned this in Unknown Object (Maniphest Task).Mon, Feb 2, 8:25 AM