.*~
config.h
+buildconf.h
config.status
config.cache
config.log
- remove some unused variables: BASE_CFLAGS_FOR_BUILD, DEBUGGER_DIR,
INTLOBJS, TEXINDEX, TEX, MALLOC, SIGNAMES_SUPPORT
From a report by Martin D Kealey <martin@kurahaupo.gen.nz>
+
+ 10/28
+ -----
+builtins/exec.def
+ - exec_builtin: don't try to print an error message in the cases
+ where shell_execve prints one, in case we have execfail set
+ Report from Emanuele Torre <torreemanuele6@gmail.com>
+
+Makefile.in
+ - LIBRARY_SOURCE: add back in to tags targets, add definition
+ Suggestion from Mike Jonkmans <bashbug@jonkmans.nl>
LIBRARY_LDFLAGS = $(READLINE_LDFLAGS) $(HISTORY_LDFLAGS) $(GLOB_LDFLAGS) \
$(TILDE_LDFLAGS) $(MALLOC_LDFLAGS) $(SHLIB_LDFLAGS)
+LIBRARY_SOURCE = $(SHLIB_SOURCE) $(GLOB_SOURCE) \
+ $(READLINE_SOURCE) $(MALLOC_SOURCE)
+
#
# The shell itself
#
force:
# unused
-TAGS: $(SOURCES) $(BUILTIN_C_SRC)
- ( cd $(topdir) && $(ETAGS) $(ETAGSFLAGS) $(SOURCES) $(BUILTIN_C_SRC) )
+TAGS: $(SOURCES) $(BUILTIN_C_SRC) $(LIBRARY_SOURCE)
+ ( cd $(topdir) && $(ETAGS) $(ETAGSFLAGS) $(SOURCES) $(BUILTIN_C_SRC) $(LIBRARY_SOURCE) )
-tags: $(SOURCES) $(BUILTIN_C_SRC)
- ( cd $(topdir) && $(CTAGS) $(CTAGSFLAGS) $(SOURCES) $(BUILTIN_C_SRC) )
+tags: $(SOURCES) $(BUILTIN_C_SRC) $(LIBRARY_SOURCE)
+ ( cd $(topdir) && $(CTAGS) $(CTAGSFLAGS) $(SOURCES) $(BUILTIN_C_SRC) $(LIBRARY_SOURCE) )
# Targets that actually do things not part of the build
if (cleanenv == 0)
adjust_shell_level (1);
- if (exit_value == EX_NOTFOUND) /* no duplicate error message */
+ /* These are the return statuses for which shell_execve will print a message. */
+ if (exit_value == EX_NOTFOUND || exit_value == EX_BINARY_FILE || exit_value == EX_NOEXEC)
goto failed_exec;
- else if (executable_file (command) == 0)
+ /* These are the errno values for which shell_execve will print a message. */
+#if defined (EISDIR)
+ else if (opt == EISDIR || opt == E2BIG || opt == ENOMEM)
+#else
+ else if (opt == E2BIG || opt == ENOMEM)
+#endif
+ goto failed_exec;
+ else /* catchall */
{
+ builtin_error ("%s: %s: %s", command, _("cannot execute"), strerror (opt));
+ if (executable_file (command) == 0)
+ exit_value = EX_NOEXEC; /* As per Posix.2, 3.14.6 */
errno = opt;
- builtin_error ("%s: %s: %s", command, _("cannot execute"), strerror (errno));
- exit_value = EX_NOEXEC; /* As per Posix.2, 3.14.6 */
}
- else
- file_error (command);
failed_exec:
FREE (command);
# Dependencies
-${BUILD_DIR}/version.h: ${BUILD_DIR}/config.h ${BUILD_DIR}/Makefile Makefile
- -( cd ${BUILD_DIR} && ${MAKE} ${BASH_MAKEFLAGS} version.h )
+#${BUILD_DIR}/version.h: ${BUILD_DIR}/config.h ${BUILD_DIR}/Makefile Makefile
+# -( cd ${BUILD_DIR} && ${MAKE} ${BASH_MAKEFLAGS} version.h )
${BUILD_DIR}/pathnames.h: ${BUILD_DIR}/config.h ${BUILD_DIR}/Makefile Makefile
-( cd ${BUILD_DIR} && ${MAKE} ${BASH_MAKEFLAGS} pathnames.h )
trap -- '' SIGTERM
trap -- 'echo USR1' SIGUSR1
USR1
-./exec3.sub: line 27: /tmp/bash-notthere: No such file or directory
-./exec3.sub: after failed exec: 127
+./exec3.sub: line 38: /tmp/bash-notthere: No such file or directory
+./exec3.sub: ENOENT: after failed exec: 127
+./exec3.sub: line 43: exec: bash-notthere: not found
trap -- 'echo EXIT' EXIT
trap -- '' SIGTERM
trap -- 'echo USR1' SIGUSR1
set +e
! { set -e ; false ; echo reached async group; } &
+wait
set +e
set -e
# added tests for changes in 10/2021 for preserving the traps across a failed
# exec
+: ${THIS_SH:=./bash}
+: ${TMPDIR:=/var/tmp}
+TDIR=$TMPDIR/execdir-$$
+
+mkdir $TDIR || exit 1
+cp $THIS_SH $TDIR || exit 1
+cd $TDIR || exit 1
+
shopt -s execfail
trap 'echo EXIT' EXIT
kill -s USR1 $$ # should run the trap
+# ENOENT -- No such file or directory
+# full pathname
+rm -f /tmp/bash-notthere
exec /tmp/bash-notthere
-
# make sure we're still around
-echo $0: after failed exec: $?
+echo $0: ENOENT: after failed exec: $?
+# relative pathname
+rm -f bash-notthere
+exec bash-notthere
+
+# EACCES - permission denied
+rm -f x.sh x.output
+echo 'echo bar' > x.sh
+exec ./x.sh 2>x.output
+string=$(< x.output)
+# check for right error message and that we survived the failed exec
+case $string in
+*denied) ;;
+*) echo "$0: EACCES: error message mismatch: $string" ;;
+esac
+rm -f x.sh x.output
+
+# E2BIG - Argument list too long
+unset BASH_ENV
+
+rm -f x.sh x.output
+echo "export var='$(echo {1..1000500})' ;
+exec ${THIS_SH}" > ./x.sh
+chmod 755 ./x.sh
+${THIS_SH} ./x.sh 2>x.output
+string=$(< x.output)
+# check for right error message and that we survived the failed exec
+case $string in
+*list\ too\ long) ;;
+*) echo "$0: E2BIG: error message mismatch: $string" ;;
+esac
+rm -f x.sh x.output
+
+# EISDIR - is a directory
+rm -f x.sh x.output
+mkdir xdir-$$
+exec ./xdir-$$ 2>x.output
+rmdir ./xdir-$$
+string=$(< x.output)
+# check for right error message and that we survived the failed exec
+case $string in
+*[Ii]s\ a\ directory) ;;
+*) echo "$0: EISDIR: error message mismatch: $string" ;;
+esac
+rm -f x.sh x.output
trap
kill -s USR1 $$ # should run the trap
kill -s TERM $$ # should still be ignored
+cd $OLDPWD
+rm -rf $TDIR
+
# this should run the exit trap
exit 0
#include "alias.h"
#include "jobs.h"
-#include "version.h"
-
#include "builtins/getopt.h"
#include "builtins/common.h"
#include "builtins/builtext.h"
{
compat_error:
internal_error (_("%s: %s: compatibility value out of range"), name, val);
- shell_compatibility_level = DEFAULT_COMPAT_LEVEL;
+ shell_compatibility_level = default_compatibility_level;
set_compatibility_opts ();
return;
}