1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00
moby--moby/pkg/homedir
Kir Kolyshkin 80e338a18d Revert "homedir: add cgo or osusergo buildtag constraints for unix"
TL;DR: there is no way to do this right.

We do know that in some combination of build tags set (or unset),
linker flags, environment variables, and libc implementation,
this package won't work right. In fact, there is one specific
combination:

1. `CGO_ENABLED=1` (or unset)
2. static binary is being built (e.g. `go build` is run with `-extldflags -static`)
3. `go build` links the binary against glibc
4. `osusergo` is not set

This particular combination results in the following legitimate linker warning:

> cgo_lookup_unix.go: warning: Using 'getpwuid_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking

If this warning is ignored and the resulting binary is used on a system
with files from a different glibc version (or without those files), it
could result in a segfault.

The commit being reverted tried to guard against such possibility,
but the problem is, we can only use build tags to account for items
1 and 4 from the above list, while items 2 and 3 do not result in
any build tags being set or unset, making this guard excessive.

Remove it.

This reverts commit 023b072288.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2019-10-24 13:13:09 -07:00
..
homedir_linux.go homedir: remove idtools and libcontainer's user package dependencies 2019-09-24 00:32:13 +00:00
homedir_others.go homedir: remove idtools and libcontainer's user package dependencies 2019-09-24 00:32:13 +00:00
homedir_test.go Add canonical import comment 2018-02-05 16:51:57 -05:00
homedir_unix.go Revert "homedir: add cgo or osusergo buildtag constraints for unix" 2019-10-24 13:13:09 -07:00
homedir_windows.go Add canonical import comment 2018-02-05 16:51:57 -05:00