Hi,

The install-links rule in the gprolog Makefile contains a couple of bugs:

install-links: uninstall-links
        if test $(LINKS_DIR) != none; then \
           ./mkinstalldirs $(LINKS_DIR); \
           (cd $(LINKS_DIR) ; $(LN_S) $(INSTALL_DIR)/bin/* .); \
        fi

uninstall-links:
        -if test $(LINKS_DIR) != none; then \
           (cd $(LINKS_DIR) 2>/dev/null && rm -f $(BIN_FILES)); \
           rmdir $(LINKS_DIR) 2>/dev/null; \
        fi || exit 0;

1. install-links uses a wildcard character.

This is not expanded by make and instead the single symlink '/path/to/bin/*' is created. If the wildcard character was expanded then we run the risk of creating links to all files in $(INSTALL_DIR)/bin, which would be what we want if $(INSTALL_DIR)/bin points to a populated directory like /usr/bin.

2. install-links depends on uninstall-links

Running uninstall-links can be very dangerous. For example, if configure is invoked with the arg --with-links-dir=/usr/bin then the uninstall-links rule will attempt to delete /usr/bin. I don't think that the gprolog install should be attempting to delete anything.

I've attached a patch for both of these issues.



Thanks

Keri
diff -ur gprolog-1.4.4.orig/src/Makefile.in gprolog-1.4.4/src/Makefile.in
--- gprolog-1.4.4.orig/src/Makefile.in	2013-04-23 16:56:44.000000000 +0200
+++ gprolog-1.4.4/src/Makefile.in	2013-05-15 17:00:58.000000000 +0200
@@ -81,10 +81,10 @@
 
 # --- Links --- #
 
-install-links: uninstall-links
+install-links:
 	if test $(LINKS_DIR) != none; then \
 	   ./mkinstalldirs $(LINKS_DIR); \
-	   (cd $(LINKS_DIR) ; $(LN_S) $(INSTALL_DIR)/bin/* .); \
+	   (cd $(LINKS_DIR); for i in $(BIN_FILES); do $(LN_S) $(INSTALL_DIR)/bin/$$i .; done); \
 	fi
 
 uninstall-links:
_______________________________________________
Bug-prolog mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/bug-prolog

Reply via email to