From c9d34d6652b68fcde24491b062ac5e76a9b5dbac Mon Sep 17 00:00:00 2001 From: Eric van Gyzen Date: Sun, 28 May 2017 00:45:28 +0000 Subject: [PATCH] Fix INSTALL_AS_USER with external nsswitch databases The INSTALL_AS_USER option tells "install" to use the current user name as the owner of the installed file. The "install" command executed by the build is statically linked, so it does not load nsswitch modules, such as nss_ldap.so, so it fails when the user is only defined in such a database. Fix it to use the current UID instead of user name. This works for all users. I expect it is also slightly more efficient. Reviewed by: sjg MFC after: 3 days Sponsored by: Dell EMC Differential Revision: https://reviews.freebsd.org/D10862 --- share/mk/bsd.init.mk | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/share/mk/bsd.init.mk b/share/mk/bsd.init.mk index 2877999fa66..bab4e23fb26 100644 --- a/share/mk/bsd.init.mk +++ b/share/mk/bsd.init.mk @@ -24,20 +24,12 @@ _uid!= id -u .export _uid .endif .if ${_uid} != 0 -.if !defined(USER) -# Avoid exporting USER -.if !defined(_USER) -_USER!= id -un -.export _USER -.endif -USER= ${_USER} -.endif .if !defined(_gid) _gid!= id -g .export _gid .endif .for x in BIN CONF DOC DTB INFO KMOD LIB MAN NLS SHARE -$xOWN= ${USER} +$xOWN= ${_uid} $xGRP= ${_gid} .endfor .endif