ncbi/ngs

setup/konfigure.perl accidentally substitutes version string in directory

rekado opened this issue · 1 comments

The konfigure.perl script generates a rule for installing library symlinks like this:

$(INST_LIBDIR)$(BITS)/%.$(VERSION_SHLX): $(LIBDIR)/%.$(VERSION_SHLX)
    @ echo -n "installing '$(@F)'... "
    @ if cp $^ $@ && chmod 755 $@;                         \
      then                                                 \
          rm -f $(subst $(VERSION),$(MAJVERS),$@) $(subst $(VERSION_SHLX),$(SHLX),$@);    \
          ln -s $(@F) $(subst $(VERSION),$(MAJVERS),$@);   \
          ln -s $(subst $(VERSION),$(MAJVERS),$(@F)) $(subst $(VERSION_SHLX),$(SHLX),$@); \
          echo success;                                    \
      else                                                 \
          echo failure;                                    \
          false;                                           \
      fi

The subst macro calls are dangerous because they replace all occurrences of the pattern with the replacement string, not just the suffix. This is a problem when INST_LIBDIR includes the version string as is the case in the package outputs of GNU Guix.

This could be mitigated by replacing $(subst before,after,target) with $(target:.before,.after), which should only touch the last occurrence of before.

I see this has already been fixed in commit mdshw5@46d4509, but no new release has been made containing this commit.