Subject: instdir-ltlib test and libtool -rpath failure

From: Karl Berry <[email-masked]>
Date: Sun, 16 Jun 2024 10:06:16 -0600

When Paul fixed typos in various files a few days ago:

    commit 1d35638b23e95fe6f41c828a3442f6d7f242f4c4
    Author: Paul Eggert <[email-masked]>
    AuthorDate: Fri Jun 7 08:41:45 2024 -0700

        maint: spelling and whitespace fixes

He noted:

    * t/instdir-ltlib.sh: Fix misspellings of macro names.
    This causes the test to fail,

This test states that it is intentionally testing an empty string value
for $(libdir) (and $(pyexecdir)), which results in passing an empty
string to -rpath on the libtool command line:

/bin/sh ./libtool  --tag=CC   --mode=link cc  -g -O2   -o libfoo.la -rpath  libfoo.lo  

And libtool then reports the error:
  libtool:   error: only absolute run-paths are allowed
which seems correct to me. 

So my "fix" was to move t/instdir-ltlib/sh from handwritten_TESTS (that
are expected to succeed) to XFAIL_TESTS in t/list-of-tests.mk.
(I'll commit it after this report gets a bug#.)

I also wrote to bug-libtool suggesting an improvement to the error message.

    so someone with libtool expertise needs to look into this.

I don't have any particular libtool expertise (it's hardly plausible that a
libtool expert would appear out of nowhere to address this), but it had
to be fixed, so the above is my best guess.

Karl

P.S. Please don't make commits that knowingly break the tests. Report a
bug instead. Thanks.

-----------------------------------------------------------------------------
test: the instdir-ltlib test is expected to fail.

* t/list-of-tests.mk (handwritten_TESTS): move t/instdir-ltlib.sh
(XFAIL_TESTS): to here.
* t/instdir-ltlib.sh: add some doc.

diff --git a/t/instdir-ltlib.sh b/t/instdir-ltlib.sh
index 7744fd6e6..23fe9c12d 100644
--- a/t/instdir-ltlib.sh
+++ b/t/instdir-ltlib.sh
@@ -15,12 +15,20 @@
 # along with this program.  If not, see <https://www.gnu.org/licenses/>.

 # If $(libdir) or $(pyexecdir) is the empty string, then nothing should
-# be installed there.
-# This test exercises the libtool code paths.
+# be installed there, and in fact libtool will refuse to link due to the
+# missing argument for -rpath:
+#   /bin/sh ./libtool [...] -rpath  libfoo.lo  
+#   libtool:   error: only absolute run-paths are allowed
+# (Hopefully the error message will be improved.)
+# Thus this test is expected to fail.
+# 
+# This test exercises some of the libtool code paths.

 required='cc libtoolize'
 . test-init.sh

+# Although LT_INIT is preferred nowadays, keep using AC_PROG_LIBTOOL
+# to help make sure it's still supported.
 cat >>configure.ac <<'END'
 AC_PROG_CC
 AM_PROG_AR
diff --git a/t/list-of-tests.mk b/t/list-of-tests.mk
index 9f6a08685..3761d4ad3 100644
--- a/t/list-of-tests.mk
+++ b/t/list-of-tests.mk
@@ -36,6 +36,7 @@ t/override-conditional-2.sh \
 t/override-conditional-pr13940.sh \
 t/dist-pr109765.sh \
 t/instdir-cond2.sh \
+t/instdir-ltlib.sh \
 t/java-nobase.sh \
 t/objext-pr10128.sh \
 t/remake-timing-bug-pr8365.sh \
@@ -545,7 +546,6 @@ t/instdir-cond2.sh \
 t/instdir-no-empty.sh \
 t/instdir-java.sh \
 t/instdir-lisp.sh \
-t/instdir-ltlib.sh \
 t/instdir-prog.sh \
 t/instdir-python.sh \
 t/instdir-texi.sh \

compile finished at Sun Jun 16 09:05:03 2024