Before this change, both the soname and the fully versioned libdebuginfod file name were created after libdebuginfod.so, opening a race for all libdebuginfod users that have Makefile dependencies on libdebuginfod.so but actually use libdebuginfod.so.1 or the fully versioned libdebuginfod file name.
After this change, the libdebuginfod.so symlink is created the last of all libdebuginfod files, closing the race. --- debuginfod/ChangeLog | 4 ++++ debuginfod/Makefile.am | 12 ++++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/debuginfod/ChangeLog b/debuginfod/ChangeLog index 27abdfda..03eabb6b 100644 --- a/debuginfod/ChangeLog +++ b/debuginfod/ChangeLog @@ -1,5 +1,9 @@ 2020-12-06 Dmitry V. Levin <l...@altlinux.org> + * Makefile.am [LIBDEBUGINFOD]: Create the fully versioned + libdebuginfod file name first, turn the soname and libdebuginfod.so + into symlinks. + * Makefile.am (LIBDEBUGINFOD_FULL_NAME): New variable. (libdebuginfod.so): Use it to create the fully versioned file name. (install, uninstall): Replace libdebuginfod-$(PACKAGE_VERSION).so with diff --git a/debuginfod/Makefile.am b/debuginfod/Makefile.am index 7df66125..b667ad6d 100644 --- a/debuginfod/Makefile.am +++ b/debuginfod/Makefile.am @@ -101,21 +101,25 @@ else libdebuginfod_so_LDLIBS = $(libcurl_LIBS) $(fts_LIBS) endif LIBDEBUGINFOD_FULL_NAME = libdebuginfod-$(PACKAGE_VERSION).so -libdebuginfod.so: $(srcdir)/libdebuginfod.map $(libdebuginfod_so_LIBS) +$(LIBDEBUGINFOD_FULL_NAME): $(srcdir)/libdebuginfod.map $(libdebuginfod_so_LIBS) $(AM_V_CCLD)$(LINK) $(dso_LDFLAGS) -o $@ \ -Wl,--soname,$(LIBDEBUGINFOD_SONAME) \ -Wl,--version-script,$<,--no-undefined \ -Wl,--whole-archive $(libdebuginfod_so_LIBS) -Wl,--no-whole-archive \ $(libdebuginfod_so_LDLIBS) @$(textrel_check) - $(AM_V_at)ln -fs $@ $(LIBDEBUGINFOD_FULL_NAME) - $(AM_V_at)ln -fs $@ $(LIBDEBUGINFOD_SONAME) + +$(LIBDEBUGINFOD_SONAME): $(LIBDEBUGINFOD_FULL_NAME) + ln -fs $< $@ + +libdebuginfod.so: $(LIBDEBUGINFOD_SONAME) + ln -fs $< $@ endif if LIBDEBUGINFOD install: install-am libdebuginfod.so $(mkinstalldirs) $(DESTDIR)$(libdir) - $(INSTALL_PROGRAM) libdebuginfod.so $(DESTDIR)$(libdir)/$(LIBDEBUGINFOD_FULL_NAME) + $(INSTALL_PROGRAM) $(LIBDEBUGINFOD_FULL_NAME) $(DESTDIR)$(libdir)/ ln -fs $(LIBDEBUGINFOD_FULL_NAME) $(DESTDIR)$(libdir)/$(LIBDEBUGINFOD_SONAME) ln -fs $(LIBDEBUGINFOD_FULL_NAME) $(DESTDIR)$(libdir)/libdebuginfod.so -- ldv