svn commit: r322565 - head/share/mk

Bryan Drewery bdrewery at FreeBSD.org
Wed Aug 16 05:02:32 UTC 2017


Author: bdrewery
Date: Wed Aug 16 05:02:31 2017
New Revision: 322565
URL: https://svnweb.freebsd.org/changeset/base/322565

Log:
  Use -S for library installations except for -DNO_ROOT builds.
  
  Also disable this if NO_SAFE_LIBINSTALL is defined.
  
  There is little harm in always using -S and it fixes several issues:
  - A race during 'make libraries' where, for example, libgcc_s is being
    installed while another library is trying to link against it.  This is
    possible because libgcc_s is connected in both _prereq_libs and
    _startup_libs.  The first build (_prereq_libs) sets MK_PROFILE=no
    while the 2nd pass (_startup_libs) enables MK_PROFILE.  Thus the
    libgcc_s library *is* present in WORLDTMP for other libraries to
    link to, so serializing further items in _startup_libs is not
    required.  Just ensuring that libgcc_s is installed atomically (via
    rename(2)) is enough. [1]
  - Installation to a running system where some library that cannot be
    detected, copied and used from the temporary INSTALLTMP with LD_LIBRARY_PATH
    that the build itself uses for installation.  Such an example is having the
    install an NSS module for user lookups that install(1) uses while
    concurrently installing the module in another process.  This is not
    a problem for the FreeBSD base build but can be for downstream
    vendors.  While this is a very specific case, installation to a
    running system with non-atomic library installation is prone to many
    problems.  A further step still is to install in proper dependency
    ordering.
  
  Reported by:	dhw many times [1]
  Sponsored by:	Dell EMC Isilon
  MFC after:	2 weeks

Modified:
  head/share/mk/bsd.lib.mk

Modified: head/share/mk/bsd.lib.mk
==============================================================================
--- head/share/mk/bsd.lib.mk	Wed Aug 16 01:45:53 2017	(r322564)
+++ head/share/mk/bsd.lib.mk	Wed Aug 16 05:02:31 2017	(r322565)
@@ -326,6 +326,11 @@ _EXTRADEPEND:
 .if !defined(NO_FSCHG)
 SHLINSTALLFLAGS+= -fschg
 .endif
+.endif
+# Install libraries with -S to avoid linker races with WORLDTMP and risk
+# of modifying in-use libraries when installing to a running system.
+# It is safe to avoid this for NO_ROOT builds that are only creating an image.
+.if !defined(NO_SAFE_LIBINSTALL) && !defined(NO_ROOT)
 SHLINSTALLFLAGS+= -S
 .endif
 


More information about the svn-src-head mailing list