Skip to content
This repository has been archived by the owner on Oct 21, 2022. It is now read-only.

Commit

Permalink
makesrpm: Avoid unlink races in ln -sf
Browse files Browse the repository at this point in the history
A race can occur when calling ln -sf in older versions of GNU coreutils (and
in busybox):

   http://git.savannah.gnu.org/gitweb/?p=coreutils.git;a=commit;h=376967889ed7ed561e46ff6d88a66779db62737a

We seem to be hitting this race because we use ln -sf to create the
RPMS and MANIFESTS top-level symlinks for every target.   Two racing
ln invocations try to remove the existing symlink, one succeeds and the
other fails with the following message:

  ln: cannot remove './RPMS': No such file or directory

This does not happen all the time because the first ln may have created
its link, which the second then deletes.

This commit switches back to the previous behaviour of creating these
symlinks at the start of the build.   This has caused problems in the
past (bug 211) so we intend eventually to remove these links altogether.

Signed-off-by: Euan Harris <euan.harris@citrix.com>
  • Loading branch information
euanh committed Dec 8, 2017
1 parent d946203 commit 296c3f1
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions planex/Makefile.rules
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,15 @@ endif
.DELETE_ON_ERROR:

.PHONY: all rpms
all: $(TOPDIR) $(RPMS)
all: $(RPMS)

$(RPMS): $(MOCK_CONFIGDIR)/$(MOCK_ROOT).cfg
$(RPMS): RPMS MANIFESTS $(MOCK_CONFIGDIR)/$(MOCK_ROOT).cfg

RPMS:
ln -s $(TOPDIR)/RPMS RPMS

MANIFESTS:
ln -s $(TOPDIR)/MANIFESTS MANIFESTS

$(TOPDIR)/RPMS/repodata/repomd.xml: $(RPMS)
$(AT)$(CREATEREPO) $(CREATEREPO_FLAGS) $(TOPDIR)/RPMS
Expand All @@ -92,7 +98,6 @@ clean:
$(TOPDIR)/MANIFESTS/%.json:
@echo [MANIFEST] $@
$(AT) mkdir -p $(@D)
$(AT) ln -sf $(@D)
$(AT)$(MANIFEST) $(MANIFEST_FLAGS) $^ > $@


Expand Down Expand Up @@ -140,7 +145,6 @@ $(TOPDIR)/SOURCES/%/patches.tar: $(PINSDIR)/%.pin FORCE
%.rpm:
@echo [MOCK] $<
$(AT) mkdir -p $(@D)
$(AT) ln -sf $(TOPDIR)/RPMS
$(AT)$(MOCK) $(MOCK_FLAGS) --rebuild $<


Expand Down

0 comments on commit 296c3f1

Please sign in to comment.