Fix hard-coded bash path in gprofng
Checks
Context |
Check |
Description |
linaro-tcwg-bot/tcwg_binutils_build--master-arm |
success
|
Testing passed
|
linaro-tcwg-bot/tcwg_binutils_build--master-aarch64 |
success
|
Testing passed
|
linaro-tcwg-bot/tcwg_binutils_check--master-aarch64 |
success
|
Testing passed
|
linaro-tcwg-bot/tcwg_binutils_check--master-arm |
success
|
Testing passed
|
Commit Message
From: Vladimir Mezentsev <vladimir.mezentsev@oracle.com>
Radu Hociung <radu.git@Mergesium.com> suggested the fix below.
I only tested and prepared a patch.
The fix looks good to me.
===================================================================
When running 'make check', the default gprofng test suite creates a
shell script for which it used a hardcoded shebang of '/usr/bin/bash'
this script would not run if bash is in a different location, like
/bin/bash
This commit adds 'AC_PATH_PROG(BASH, bash)' to configure.ac so the
installation path of bash is detected at configuration time. The
configuration is propagated to the runtest command line where it is
needed.
---
gprofng/Makefile.am | 1 +
gprofng/Makefile.in | 2 ++
gprofng/configure | 47 ++++++++++++++++++++++++++--
gprofng/configure.ac | 3 ++
gprofng/doc/Makefile.in | 1 +
gprofng/gp-display-html/Makefile.in | 1 +
gprofng/src/Makefile.in | 1 +
gprofng/testsuite/config/default.exp | 2 +-
8 files changed, 55 insertions(+), 3 deletions(-)
@@ -68,6 +68,7 @@ if TCL_TRY
CLOCK_GETTIME_LINK="$(CLOCK_GETTIME_LINK)" \
CHECK_TARGET=$@ \
PREFIX="$(prefix)" \
+ BASH="$(BASH)" \
GPROFNG_BROKEN_JAVAC="$(GPROFNG_BROKEN_JAVAC)" \
MAKE="$(MAKE)" CC="$(CC)" CFLAGS="$(CFLAGS) $(PTHREAD_CFLAGS)" \
LDFLAGS="$(LDFLAGS)" LIBS="$(PTHREAD_LIBS) $(LIBS)" \
@@ -238,6 +238,7 @@ AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
+BASH = @BASH@
BISON = @BISON@
BUILD_SUBDIRS = @BUILD_SUBDIRS@
CC = @CC@
@@ -932,6 +933,7 @@ check-small check-extra check-install: site.exp development.exp
@TCL_TRY_TRUE@ CLOCK_GETTIME_LINK="$(CLOCK_GETTIME_LINK)" \
@TCL_TRY_TRUE@ CHECK_TARGET=$@ \
@TCL_TRY_TRUE@ PREFIX="$(prefix)" \
+@TCL_TRY_TRUE@ BASH="$(BASH)" \
@TCL_TRY_TRUE@ GPROFNG_BROKEN_JAVAC="$(GPROFNG_BROKEN_JAVAC)" \
@TCL_TRY_TRUE@ MAKE="$(MAKE)" CC="$(CC)" CFLAGS="$(CFLAGS) $(PTHREAD_CFLAGS)" \
@TCL_TRY_TRUE@ LDFLAGS="$(LDFLAGS)" LIBS="$(PTHREAD_LIBS) $(LIBS)" \
@@ -639,6 +639,7 @@ GPROFNG_CPPFLAGS
GPROFNG_NO_FORMAT_TRUNCATION_CFLAGS
GPROFNG_CFLAGS
LD_NO_AS_NEEDED
+BASH
BUILD_DOC_FALSE
BUILD_DOC_TRUE
BUILD_MAN_FALSE
@@ -12248,7 +12249,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12251 "configure"
+#line 12252 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -12354,7 +12355,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12357 "configure"
+#line 12358 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -16861,6 +16862,48 @@ else
fi
+# Extract the first word of "bash", so it can be a program name with args.
+set dummy bash; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_BASH+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $BASH in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_BASH="$BASH" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_path_BASH="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+BASH=$ac_cv_path_BASH
+if test -n "$BASH"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BASH" >&5
+$as_echo "$BASH" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+
+
LD_NO_AS_NEEDED=${no_as_needed}
GPROFNG_CFLAGS=${gprofng_cflags}
@@ -228,6 +228,9 @@ fi
AM_CONDITIONAL([BUILD_MAN], [test x$build_man = xtrue])
AM_CONDITIONAL([BUILD_DOC], [test x$build_doc = xtrue])
+AC_PATH_PROG([BASH], [bash])
+AC_SUBST([BASH])
+
AC_SUBST(LD_NO_AS_NEEDED, [${no_as_needed}])
AC_SUBST(GPROFNG_CFLAGS, [${gprofng_cflags}])
AC_SUBST(GPROFNG_NO_FORMAT_TRUNCATION_CFLAGS)
@@ -222,6 +222,7 @@ AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
+BASH = @BASH@
BISON = @BISON@
BUILD_SUBDIRS = @BUILD_SUBDIRS@
CC = @CC@
@@ -182,6 +182,7 @@ AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
+BASH = @BASH@
BISON = @BISON@
BUILD_SUBDIRS = @BUILD_SUBDIRS@
CC = @CC@
@@ -306,6 +306,7 @@ AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
+BASH = @BASH@
BISON = @BISON@
BUILD_SUBDIRS = @BUILD_SUBDIRS@
CC = @CC@
@@ -54,7 +54,7 @@ if { "$CHECK_TARGET" == "check-install" } {
}
set f [open "gprofng_wraper" w+]
- puts $f "#!/usr/bin/bash"
+ puts $f "#!$BASH"
puts $f "LD_LIBRARY_PATH=$ld_library_path:$orig_ld_library_path"
puts $f "GPROFNG_SYSCONFDIR=$env(srcroot)/src"
puts $f "GPROFNG_PRELOAD_LIBDIRS=$BUILDDIR/libcollector/.libs"