fixes for a couple of autoconf macros; update exit builtin for POSIX interp 1602; include more info in EOF error message when parsing compound command; update Makefiles by removing some variables, initializing others; update dependencies on version.h

This commit is contained in:
Chet Ramey
2024-10-28 15:05:35 -04:00
parent ee3b91dfd9
commit 4917f2859c
26 changed files with 263 additions and 265 deletions
+90
View File
@@ -10465,3 +10465,93 @@ config-top.h
doc/bashref.texi
- Posix mode: remove item about function names being valid shell
identifiers
10/25
-----
aclocal.m4
- simplify the checks for the various members of struct dirent
Report and patch from Grisha Levit <grishalevit@gmail.com>
m4/strtoimax.m4
- simplify and remove redundant caching and cache check
Report and patch from Grisha Levit <grishalevit@gmail.com>
builtins/common.c
- get_exitstat: make the behavior of exit with no arguments
running in a trap action the same as return: check for any trap
(running_trap > 0) in the current execution_context. This is
POSIX interp 1602, in POSIX.1-2024
stringlib.c
- find_token_in_alist: if FLAGS is non-zero, do *no* allocate new
memory for the token. The existing behavior is to allocate memory
and return a copy of the token, and all callers pass 0
parse.y
- compoundcmd_lineno: now an array of `struct tokeninfo', which
has line number and current compound command information
- change compoundcmd_lineno[compoundcmd_top] to
compoundcmd_lineno[compoundcmd_top].lineno in all calls
- set_compoundcmd_top: in addition to assigning line number info,
assign T to compoundcmd_lineno[compoundcmd_top].token
- report_syntax_error: if we get a syntax error while looking for
shell_eof_token (comsubs), include the token we were looking for
in the error message
- report_syntax_error: if we are reporting an unexpected EOF error,
and compoundcmd_top >= 0, look up the token for the compound
command we're parsing, including `(', and change the error message
to include it
10/26
-----
Makefile.in
- PURIFY,GLOBC,GLOBO,ALLOC_FILES,LIBRARY_SOURCE: remove
- ADDON_CFLAGS,ADDON_LDDFLAGS: initialize to empty
- GRAM_H: remove from HSOURCES
- profiling-tests: use Program instead of PROGRAM
builtins/Makefile.in
- DEBUG: initialize from configure
- SYSTEM_FLAGS: remove, since it's not passed from topdir Makefile
- ADDON_CFLAGS: initialize to empty
lib/glob/Makefile.in
- ADDON_CFLAGS: initialize to empty
lib/readline/Makefile.in
- ADDON_CFLAGS: initialize to empty
- APP_CFLAGS: remove
lib/sh/Makefile.in
- DEBUG: initialize from configure
- ADDON_CFLAGS: initialize to empty
- LIBOBJDIR: initialize to empty; configure uses it in LIBOBJS
lib/tilde/Makefile.in
- ADDON_CFLAGS: initialize to empty
- CCFLAGS: add ADDON_CFLAGS, replacing ASAN_CFLAGS
support/Makefile.in
- SYSTEM_FLAGS: remove, since it's not passed from topdir Makefile
Makefiles report and patch from Grisha Levit <grishalevit@gmail.com>
version.c,shell.h
- default_compatibility_level: int variable, initialized to
DEFAULT_COMPAT_LEVEL like shell_compatibility_level
variables.c
- sv_shcompat: use default_compatibility_level instead of
DEFAULT_COMPAT_LEVEL so variables.o doesn't have to depend on
version.h
builtins/shopt.def
- set_compatibility_level: use default_compatibility_level instead
of DEFAULT_COMPAT_LEVEL so shopt.o doesn't have to depend on
version.h
- don't include version.h any more
configure.ac,Makefile.in,support/Makefile.in,doc/Makefile.in
- 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>
+33 -34
View File
@@ -1,4 +1,4 @@
# Makefile for bash-5.3, version 5.6
# Makefile for bash-5.3, version 5.7
#
# Copyright (C) 1996-2024 Free Software Foundation, Inc.
@@ -96,9 +96,6 @@ TESTSCRIPT = @TESTSCRIPT@
DEBUGGER_START_FILE = @DEBUGGER_START_FILE@
#If you have purify, and want to use it, run the make as `make PURIFY=purify'
#PURIFY = @PURIFY@
# Here is a rule for making .o files from .c files that does not
# force the type of the machine (like -M_MACHINE) into the flags.
.c.o:
@@ -152,6 +149,12 @@ LOCAL_LDFLAGS = @LOCAL_LDFLAGS@
SYSTEM_FLAGS = -DPROGRAM='"$(Program)"' -DCONF_HOSTTYPE='"$(Machine)"' -DCONF_OSTYPE='"$(OS)"' -DCONF_MACHTYPE='"$(MACHTYPE)"' -DCONF_VENDOR='"$(VENDOR)"' $(LOCALE_DEFS)
BASH_MAKEFLAGS =
# set by lint/sanitize targets
ADDON_CFLAGS =
ADDON_LDFLAGS =
BASE_CCFLAGS = $(SYSTEM_FLAGS) $(LOCAL_DEFS) \
$(DEFS) $(LOCAL_CFLAGS) $(INCLUDES) $(STYLE_CFLAGS)
@@ -405,7 +408,6 @@ LIBICONV = @LIBICONV@
LIBINTL = @LIBINTL@
LTLIBINTL = @LTLIBINTL@
INTLLIBS = @INTLLIBS@
INTLOBJS = @INTLOBJS@
# Our malloc.
MALLOC_TARGET = @MALLOC_TARGET@
@@ -467,9 +469,9 @@ LIBRARY_LDFLAGS = $(READLINE_LDFLAGS) $(HISTORY_LDFLAGS) $(GLOB_LDFLAGS) \
# The main source code for the Bourne Again SHell.
CSOURCES = shell.c eval.c parse.y general.c make_cmd.c print_cmd.c y.tab.c \
dispose_cmd.c execute_cmd.c variables.c $(GLOBC) version.c \
dispose_cmd.c execute_cmd.c variables.c version.c \
expr.c copy_cmd.c flags.c subst.c hashcmd.c hashlib.c mailcheck.c \
test.c trap.c alias.c jobs.c nojobs.c $(ALLOC_FILES) braces.c \
test.c trap.c alias.c jobs.c nojobs.c braces.c \
input.c bashhist.c array.c arrayfunc.c assoc.c sig.c pathexp.c \
unwind_prot.c siglist.c bashline.c bracecomp.c error.c \
list.c stringlib.c locale.c findcmd.c redir.c \
@@ -477,7 +479,7 @@ CSOURCES = shell.c eval.c parse.y general.c make_cmd.c print_cmd.c y.tab.c \
HSOURCES = shell.h flags.h trap.h hashcmd.h hashlib.h jobs.h builtins.h \
general.h variables.h config.h $(ALLOC_HEADERS) alias.h \
quit.h unwind_prot.h syntax.h ${GRAM_H} \
quit.h unwind_prot.h syntax.h \
command.h input.h error.h bashansi.h dispose_cmd.h make_cmd.h \
subst.h externs.h siglist.h bashhist.h bashline.h bashtypes.h \
array.h arrayfunc.h sig.h mailcheck.h bashintl.h bashjmp.h \
@@ -512,7 +514,7 @@ SIGNAMES_O = @SIGNAMES_O@
ARRAY_O = @ARRAY_O@
# Matching object files.
OBJECTS = shell.o eval.o y.tab.o general.o make_cmd.o print_cmd.o $(GLOBO) \
OBJECTS = shell.o eval.o y.tab.o general.o make_cmd.o print_cmd.o \
dispose_cmd.o execute_cmd.o variables.o copy_cmd.o error.o \
expr.o flags.o $(JOBS_O) subst.o hashcmd.o hashlib.o mailcheck.o \
trap.o input.o unwind_prot.o pathexp.o sig.o test.o version.o \
@@ -525,7 +527,6 @@ BUILTIN_SRCDIR=$(srcdir)/builtins
DEFSRC=$(BUILTIN_SRCDIR)
BUILTIN_ABSSRC=${topdir}/builtins
DEFDIR = $(dot)/builtins
DEBUGGER_DIR = $(dot)/debugger
BUILTIN_DEFS = $(DEFSRC)/alias.def $(DEFSRC)/bind.def $(DEFSRC)/break.def \
$(DEFSRC)/builtin.def $(DEFSRC)/cd.def $(DEFSRC)/colon.def \
@@ -578,10 +579,9 @@ DOCDIR = $(dot)/doc
PO_SRC = $(srcdir)/po/
PO_DIR = $(dot)/po/
SIGNAMES_SUPPORT = $(SUPPORT_SRC)mksignames.c
# Auxiliary support files
SUPPORT_SRC = $(srcdir)/support/
SDIR = $(dot)/support
SUPPORT_DIR = $(dot)/support
TESTS_SUPPORT = recho$(EXEEXT) zecho$(EXEEXT) printenv$(EXEEXT) xcase$(EXEEXT)
CREATED_SUPPORT = signames.h recho$(EXEEXT) zecho$(EXEEXT) printenv$(EXEEXT) \
@@ -614,12 +614,12 @@ LOADABLES_DIR = ${top_builddir}/examples/loadables
# Keep GNU Make from exporting the entire environment for small machines.
.NOEXPORT:
.made: $(Program) bashbug $(SDIR)/man2html$(EXEEXT)
.made: $(Program) bashbug $(SUPPORT_DIR)/man2html$(EXEEXT)
@echo "$(Program) last made for a $(Machine) running $(OS)" >.made
$(Program): $(OBJECTS) $(BUILTINS_DEP) $(LIBDEP) .build
$(RM) $@
$(PURIFY) $(CC) $(BUILTINS_LDFLAGS) $(LIBRARY_LDFLAGS) $(LDFLAGS) -o $(Program) $(OBJECTS) $(LIBS)
$(CC) $(BUILTINS_LDFLAGS) $(LIBRARY_LDFLAGS) $(LDFLAGS) -o $(Program) $(OBJECTS) $(LIBS)
ls -l $(Program)
-$(SIZE) $(Program)
@@ -632,9 +632,9 @@ $(Program): $(OBJECTS) $(BUILTINS_DEP) $(LIBDEP) .build
@echo " ***********************************************************"
@echo
bashbug: $(SDIR)/bashbug.sh $(VERSPROG)
bashbug: $(SUPPORT_DIR)/bashbug.sh $(VERSPROG)
@sed -e "s%!PATCHLEVEL!%$(PatchLevel)%" \
$(SDIR)/bashbug.sh > $@
$(SUPPORT_DIR)/bashbug.sh > $@
@chmod a+rx bashbug
strip: $(Program) .made
@@ -661,7 +661,6 @@ lsan:
gcov:
${MAKE} $(BASH_MAKEFLAGS) CFLAGS=-g ADDON_CFLAGS='${GCOV_XCFLAGS}' ADDON_LDFLAGS='${GCOV_XLDFLAGS}' .made
# have to make this separate because making tests depend on $(PROGRAM)
asan-tests: asan $(TESTS_SUPPORT)
@-test -d tests || mkdir tests
@@ -676,7 +675,7 @@ lsan-tests: lsan $(TESTS_SUPPORT)
@( cd $(srcdir)/tests && \
BUILD_DIR=$(BUILD_DIR) PATH=$(BUILD_DIR)/tests:$$PATH THIS_SH=$(THIS_SH) $(SHELL) ${TESTSCRIPT} )
profiling-tests: ${PROGRAM}
profiling-tests: ${Program}
@test "X$$PROFILE_FLAGS" == "X" && { echo "profiling-tests: must be built with profiling enabled" >&2; exit 1; }
@${MAKE} $(BASH_MAKEFLAGS) tests TESTSCRIPT=run-gprof
@@ -796,7 +795,7 @@ syntax.c: mksyntax${EXEEXT} $(srcdir)/syntax.h
$(RM) $@
./mksyntax$(EXEEXT) -o $@
$(BUILTINS_LIBRARY): $(DEFDIR)/builtext.h $(BUILTIN_DEFS) $(BUILTIN_C_SRC) config.h ${BASHINCDIR}/memalloc.h version.h
$(BUILTINS_LIBRARY): $(DEFDIR)/builtext.h $(BUILTIN_DEFS) $(BUILTIN_C_SRC) config.h ${BASHINCDIR}/memalloc.h
@(cd $(DEFDIR) && $(MAKE) $(BASH_MAKEFLAGS) DEBUG=${DEBUG} targets ) || exit 1
# these require special rules to circumvent make builtin rules
@@ -812,8 +811,8 @@ ${DEFDIR}/builtext.h: $(BUILTIN_DEFS)
${DEFDIR}/pipesize.h: ${BUILTINS_LIBRARY}
@(cd $(DEFDIR) && $(MAKE) $(BASH_MAKEFLAGS) pipesize.h ) || exit 1
$(SDIR)/man2html$(EXEEXT): ${SUPPORT_SRC}/man2html.c
@(cd $(SDIR) && $(MAKE) $(BASH_MAKEFLAGS) all ) || exit 1
$(SUPPORT_DIR)/man2html$(EXEEXT): $(SUPPORT_SRC)man2html.c
@(cd $(SUPPORT_DIR) && $(MAKE) $(BASH_MAKEFLAGS) all ) || exit 1
# For the justification of the following Makefile rules, see node
# `Automatic Remaking' in GNU Autoconf documentation.
@@ -846,8 +845,8 @@ pathnames.h: Makefile $(srcdir)/pathnames.h.in
buildconf.h: $(srcdir)/buildconf.h.in
CONFIG_FILES= CONFIG_HEADERS=buildconf.h $(SHELL) ./config.status
$(SDIR)/bashbug.sh: $(SDIR)/bashbug.sh.in
CONFIG_FILES=$(SDIR)/bashbug.sh CONFIG_HEADERS= $(SHELL) ./config.status
$(SUPPORT_DIR)/bashbug.sh: $(SUPPORT_DIR)/bashbug.sh.in
CONFIG_FILES=$(SUPPORT_DIR)/bashbug.sh CONFIG_HEADERS= $(SHELL) ./config.status
# comment out for distribution
$(srcdir)/configure: $(srcdir)/configure.ac $(srcdir)/aclocal.m4 $(srcdir)/config.h.in
@@ -876,11 +875,11 @@ info dvi ps: force
force:
# unused
TAGS: $(SOURCES) $(BUILTIN_C_SRC) $(LIBRARY_SOURCE)
( cd $(topdir) && $(ETAGS) $(ETAGSFLAGS) $(SOURCES) $(BUILTIN_C_SRC) $(LIBRARY_SOURCE) )
TAGS: $(SOURCES) $(BUILTIN_C_SRC)
( cd $(topdir) && $(ETAGS) $(ETAGSFLAGS) $(SOURCES) $(BUILTIN_C_SRC) )
tags: $(SOURCES) $(BUILTIN_C_SRC) $(LIBRARY_SOURCE)
( cd $(topdir) && $(CTAGS) $(CTAGSFLAGS) $(SOURCES) $(BUILTIN_C_SRC) $(LIBRARY_SOURCE) > $@ )
tags: $(SOURCES) $(BUILTIN_C_SRC)
( cd $(topdir) && $(CTAGS) $(CTAGSFLAGS) $(SOURCES) $(BUILTIN_C_SRC) )
# Targets that actually do things not part of the build
@@ -931,7 +930,7 @@ install-headers: install-headers-dirs
${INSTALL_DATA} $(srcdir)/"$$hf" $(DESTDIR)$(headersdir)/$$hf || exit 1; \
fi ; \
done
-$(INSTALL_DATA) $(SDIR)/bash.pc $(DESTDIR)$(pkgconfigdir)/bash.pc
-$(INSTALL_DATA) $(SUPPORT_DIR)/bash.pc $(DESTDIR)$(pkgconfigdir)/bash.pc
uninstall-headers:
-( cd $(DESTDIR)$(headersdir) && $(RM) $(INSTALLED_HEADERS) )
@@ -962,7 +961,7 @@ basic-clean:
clean: basic-clean
( cd $(DOCDIR) && $(MAKE) $(BASH_MAKEFLAGS) $@ )
( cd builtins && $(MAKE) $(BASH_MAKEFLAGS) $@ )
-( cd $(SDIR) && $(MAKE) $(BASH_MAKEFLAGS) $@ )
-( cd $(SUPPORT_DIR) && $(MAKE) $(BASH_MAKEFLAGS) $@ )
-for libdir in ${LIB_SUBDIRS}; do \
(cd $$libdir && test -f Makefile && $(MAKE) $(BASH_MAKEFLAGS) $@) ;\
done
@@ -974,7 +973,7 @@ clean: basic-clean
mostlyclean: basic-clean
( cd $(DOCDIR) && $(MAKE) $(BASH_MAKEFLAGS) $@ )
( cd builtins && $(MAKE) $(BASH_MAKEFLAGS) $@ )
-( cd $(SDIR) && $(MAKE) $(BASH_MAKEFLAGS) $@ )
-( cd $(SUPPORT_DIR) && $(MAKE) $(BASH_MAKEFLAGS) $@ )
-for libdir in ${LIB_SUBDIRS}; do \
(cd $$libdir && test -f Makefile && $(MAKE) $(BASH_MAKEFLAGS) $@) ;\
done
@@ -984,7 +983,7 @@ mostlyclean: basic-clean
distclean: basic-clean maybe-clean
( cd $(DOCDIR) && $(MAKE) $(BASH_MAKEFLAGS) $@ )
( cd builtins && $(MAKE) $(BASH_MAKEFLAGS) $@ )
-( cd $(SDIR) && $(MAKE) $(BASH_MAKEFLAGS) $@ )
-( cd $(SUPPORT_DIR) && $(MAKE) $(BASH_MAKEFLAGS) $@ )
-for libdir in ${LIB_SUBDIRS}; do \
(cd $$libdir && test -f Makefile && $(MAKE) $(BASH_MAKEFLAGS) $@) ;\
done
@@ -1000,7 +999,7 @@ maintainer-clean: basic-clean
$(RM) y.tab.c y.tab.h parser-built tags TAGS
( cd $(DOCDIR) && $(MAKE) $(BASH_MAKEFLAGS) $@ )
( cd builtins && $(MAKE) $(BASH_MAKEFLAGS) $@ )
( cd $(SDIR) && $(MAKE) $(BASH_MAKEFLAGS) $@ )
( cd $(SUPPORT_DIR) && $(MAKE) $(BASH_MAKEFLAGS) $@ )
-for libdir in ${LIB_SUBDIRS}; do \
(cd $$libdir && test -f Makefile && $(MAKE) $(BASH_MAKEFLAGS) $@) ;\
done
@@ -1303,7 +1302,7 @@ variables.o: flags.h execute_cmd.h mailcheck.h input.h $(DEFSRC)/common.h
variables.o: findcmd.h bashhist.h hashcmd.h pathexp.h
variables.o: pcomplete.h ${BASHINCDIR}/chartypes.h
variables.o: ${BASHINCDIR}/posixtime.h assoc.h ${DEFSRC}/getopt.h
variables.o: version.h $(DEFDIR)/builtext.h
variables.o: $(DEFDIR)/builtext.h
version.o: conftypes.h patchlevel.h version.h
version.o: buildconf.h
xmalloc.o: config.h bashtypes.h ${BASHINCDIR}/ansi_stdlib.h error.h
Vendored
+4 -30
View File
@@ -1025,7 +1025,7 @@ dnl like _AC_STRUCT_DIRENT(MEMBER) but public
AC_DEFUN(BASH_STRUCT_DIRENT,
[
AC_REQUIRE([AC_HEADER_DIRENT])
AC_CHECK_MEMBERS(struct dirent.$1, bash_cv_dirent_has_$1=yes, bash_cv_dirent_has_$1=no,
AC_CHECK_MEMBERS(struct dirent.$1, [], [],
[[
#include <stdio.h>
#include <sys/types.h>
@@ -1049,35 +1049,9 @@ AC_CHECK_MEMBERS(struct dirent.$1, bash_cv_dirent_has_$1=yes, bash_cv_dirent_has
]])
])
AC_DEFUN(BASH_STRUCT_DIRENT_D_INO,
[AC_REQUIRE([AC_HEADER_DIRENT])
AC_MSG_CHECKING(for struct dirent.d_ino)
AC_CACHE_VAL(bash_cv_dirent_has_d_ino, [BASH_STRUCT_DIRENT([d_ino])])
AC_MSG_RESULT($bash_cv_dirent_has_d_ino)
if test $bash_cv_dirent_has_d_ino = yes; then
AC_DEFINE(HAVE_STRUCT_DIRENT_D_INO)
fi
])
AC_DEFUN(BASH_STRUCT_DIRENT_D_FILENO,
[AC_REQUIRE([AC_HEADER_DIRENT])
AC_MSG_CHECKING(for struct dirent.d_fileno)
AC_CACHE_VAL(bash_cv_dirent_has_d_fileno, [BASH_STRUCT_DIRENT([d_fileno])])
AC_MSG_RESULT($bash_cv_dirent_has_d_fileno)
if test $bash_cv_dirent_has_d_fileno = yes; then
AC_DEFINE(HAVE_STRUCT_DIRENT_D_FILENO)
fi
])
AC_DEFUN(BASH_STRUCT_DIRENT_D_NAMLEN,
[AC_REQUIRE([AC_HEADER_DIRENT])
AC_MSG_CHECKING(for struct dirent.d_namlen)
AC_CACHE_VAL(bash_cv_dirent_has_d_namlen, [BASH_STRUCT_DIRENT([d_namlen])])
AC_MSG_RESULT($bash_cv_dirent_has_d_namlen)
if test $bash_cv_dirent_has_d_namlen = yes; then
AC_DEFINE(HAVE_STRUCT_DIRENT_D_NAMLEN)
fi
])
AC_DEFUN([BASH_STRUCT_DIRENT_D_INO], [BASH_STRUCT_DIRENT([d_ino])])
AC_DEFUN([BASH_STRUCT_DIRENT_D_FILENO], [BASH_STRUCT_DIRENT([d_fileno])])
AC_DEFUN([BASH_STRUCT_DIRENT_D_NAMLEN], [BASH_STRUCT_DIRENT([d_namlen])])
AC_DEFUN(BASH_STRUCT_TIMEVAL,
[AC_MSG_CHECKING(for struct timeval in sys/time.h and time.h)
+7 -3
View File
@@ -56,6 +56,8 @@ BUILD_DIR = @BUILD_DIR@
LIBBUILD = ${BUILD_DIR}/lib
DEBUG = @DEBUG@
PROFILE_FLAGS = @PROFILE_FLAGS@
CFLAGS = @CFLAGS@
CFLAGS_FOR_BUILD = @CFLAGS_FOR_BUILD@ @CROSS_COMPILE@
@@ -95,9 +97,10 @@ HELPFILES_TARGET = @HELPFILES_TARGET@
INCLUDES = -I. -I.. @RL_INCLUDE@ -I$(topdir) -I$(BASHINCDIR) -I$(topdir)/lib -I$(srcdir) ${INTL_INC}
BASE_CCFLAGS = ${PROFILE_FLAGS} $(DEFS) $(LOCAL_DEFS) $(SYSTEM_FLAGS) \
BASE_CCFLAGS = ${PROFILE_FLAGS} $(DEFS) $(LOCAL_DEFS) \
${INCLUDES} $(STYLE_CFLAGS) $(LOCAL_CFLAGS)
ADDON_CFLAGS=
CCFLAGS = ${ADDON_CFLAGS} $(BASE_CCFLAGS) $(CPPFLAGS) $(CFLAGS)
CCFLAGS_FOR_BUILD = $(BASE_CCFLAGS) $(CPPFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD)
@@ -268,8 +271,9 @@ distclean maintainer-clean: clean
$(OFILES): $(MKBUILTINS) ../config.h
../version.h: ../config.h ../Makefile Makefile
-( cd ${BUILD_DIR} && ${MAKE} ${BASH_MAKEFLAGS} version.h )
# sketchy rule here
#../version.h: ../config.h ../Makefile Makefile
# -( cd ${BUILD_DIR} && ${MAKE} ${BASH_MAKEFLAGS} version.h )
# maintainer special - for now
po: builtins.c
+3
View File
@@ -538,6 +538,9 @@ get_exitstat (WORD_LIST *list)
return value. */
if (this_shell_builtin == return_builtin && running_trap > 0 && running_trap != DEBUG_TRAP+1 && trap_return_context == funcnest + sourcenest)
return (trap_saved_exit_value);
/* The same interp applies to the exit builtin. */
if (this_shell_builtin == exit_builtin && running_trap > 0 && running_trap != DEBUG_TRAP+1 && trap_return_context == funcnest + sourcenest)
return (trap_saved_exit_value);
return (last_command_exit_value);
}
+3 -2
View File
@@ -1,7 +1,7 @@
This file is exit.def, from which is created exit.c.
It implements the builtins "exit", and "logout" in Bash.
Copyright (C) 1987-2023 Free Software Foundation, Inc.
Copyright (C) 1987-2024 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -138,7 +138,8 @@ exit_or_logout (WORD_LIST *list)
/* If we're running the exit trap (running_trap == 1, since running_trap
gets set to SIG+1), and we don't have a argument given to `exit'
(list == 0), use the exit status we saved before running the trap
commands (trap_saved_exit_value). */
commands (trap_saved_exit_value). get_exitstat() handles the case of
running exit from any other trap action (POSIX interp 1602). */
exit_value = (running_trap == 1 && list == 0) ? trap_saved_exit_value : get_exitstat (list);
if (exit_value > EX_SHERRBASE) /* some kind of error */
return (exit_value);
+6 -5
View File
@@ -52,8 +52,6 @@ $END
#include <stdio.h>
#include "version.h"
#include "../bashintl.h"
#include "../shell.h"
@@ -689,10 +687,10 @@ set_compatibility_level (char *option_name, int mode)
shell_compatibility_level = 43;
else if (shopt_compat44)
shell_compatibility_level = 44;
else if (oldval > 44 && shell_compatibility_level < DEFAULT_COMPAT_LEVEL)
else if (oldval > 44 && shell_compatibility_level < default_compatibility_level)
;
else
shell_compatibility_level = DEFAULT_COMPAT_LEVEL;
shell_compatibility_level = default_compatibility_level;
/* Make sure the current compatibility level is reflected in BASH_COMPAT */
rhs = itos (shell_compatibility_level);
@@ -710,9 +708,12 @@ set_compatibility_opts (void)
shopt_compat31 = shopt_compat32 = 0;
shopt_compat40 = shopt_compat41 = shopt_compat42 = shopt_compat43 = 0;
shopt_compat44 = 0;
if (shell_compatibility_level == default_compatibility_level)
return;
switch (shell_compatibility_level)
{
case DEFAULT_COMPAT_LEVEL:
case 52: /* completeness */
case 51: /* completeness */
case 50:
break;
Vendored
+15 -110
View File
@@ -1,5 +1,5 @@
#! /bin/sh
# From configure.ac for Bash 5.3, version 5.071.
# From configure.ac for Bash 5.3, version 5.073.
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.72 for bash 5.3-beta.
#
@@ -762,7 +762,6 @@ RL_MAJOR
RL_VERSION
LIBS_FOR_BUILD
STYLE_CFLAGS
BASE_CFLAGS_FOR_BUILD
STATIC_LD
SIGNAMES_O
SIGNAMES_H
@@ -5424,11 +5423,9 @@ if test "X$cross_compiling" = "Xno"; then
# CFLAGS set above to default value if not passed in environment
if test -n "$want_auto_cflags" ; then
CFLAGS_FOR_BUILD="${CFLAGS}"
BASE_CFLAGS_FOR_BUILD="${CFLAGS}"
else
# passed in environment
CFLAGS_FOR_BUILD=${CFLAGS-'$(CFLAGS)'}
BASE_CFLAGS_FOR_BUILD=${CFLAGS-'$(CFLAGS)'}
fi
LIBS_FOR_BUILD=${LIBS_FOR_BUILD-'$(LIBS)'}
else
@@ -5436,7 +5433,6 @@ else
CPPFLAGS_FOR_BUILD=${CPPFLAGS_FOR_BUILD-""}
LDFLAGS_FOR_BUILD=${LDFLAGS_FOR_BUILD-""}
CFLAGS_FOR_BUILD=${CFLAGS_FOR_BUILD="-g"}
BASE_CFLAGS_FOR_BUILD=${BASE_CFLAGS_FOR_BUILD="-g"}
LIBS_FOR_BUILD=${LIBS_FOR_BUILD-""}
fi
@@ -5454,7 +5450,6 @@ fi
if test "$opt_readline" = yes && test "$opt_with_installed_readline" != "no"
then
# If the user specified --with-installed-readline=PREFIX and PREFIX
@@ -9226,8 +9221,8 @@ rm -f core conftest.err conftest.$ac_objext conftest.beam \
LIBS=$save_LIBS
test $gl_pthread_api = yes && break
done
echo "$as_me:9229: gl_pthread_api=$gl_pthread_api" >&5
echo "$as_me:9230: LIBPTHREAD=$LIBPTHREAD" >&5
echo "$as_me:9224: gl_pthread_api=$gl_pthread_api" >&5
echo "$as_me:9225: LIBPTHREAD=$LIBPTHREAD" >&5
gl_pthread_in_glibc=no
# On Linux with glibc >= 2.34, libc contains the fully functional
@@ -9253,7 +9248,7 @@ rm -rf conftest*
;;
esac
echo "$as_me:9256: gl_pthread_in_glibc=$gl_pthread_in_glibc" >&5
echo "$as_me:9251: gl_pthread_in_glibc=$gl_pthread_in_glibc" >&5
# Test for libpthread by looking for pthread_kill. (Not pthread_self,
# since it is defined as a macro on OSF/1.)
@@ -9431,7 +9426,7 @@ fi
fi
fi
echo "$as_me:9434: LIBPMULTITHREAD=$LIBPMULTITHREAD" >&5
echo "$as_me:9429: LIBPMULTITHREAD=$LIBPMULTITHREAD" >&5
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether POSIX threads API is available" >&5
printf %s "checking whether POSIX threads API is available... " >&6; }
@@ -9678,8 +9673,8 @@ rm -f core conftest.err conftest.$ac_objext conftest.beam \
LIBS=$save_LIBS
test $gl_pthread_api = yes && break
done
echo "$as_me:9681: gl_pthread_api=$gl_pthread_api" >&5
echo "$as_me:9682: LIBPTHREAD=$LIBPTHREAD" >&5
echo "$as_me:9676: gl_pthread_api=$gl_pthread_api" >&5
echo "$as_me:9677: LIBPTHREAD=$LIBPTHREAD" >&5
gl_pthread_in_glibc=no
# On Linux with glibc >= 2.34, libc contains the fully functional
@@ -9705,7 +9700,7 @@ rm -rf conftest*
;;
esac
echo "$as_me:9708: gl_pthread_in_glibc=$gl_pthread_in_glibc" >&5
echo "$as_me:9703: gl_pthread_in_glibc=$gl_pthread_in_glibc" >&5
# Test for libpthread by looking for pthread_kill. (Not pthread_self,
# since it is defined as a macro on OSF/1.)
@@ -9883,7 +9878,7 @@ fi
fi
fi
echo "$as_me:9886: LIBPMULTITHREAD=$LIBPMULTITHREAD" >&5
echo "$as_me:9881: LIBPMULTITHREAD=$LIBPMULTITHREAD" >&5
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether POSIX threads API is available" >&5
printf %s "checking whether POSIX threads API is available... " >&6; }
@@ -19911,13 +19906,6 @@ fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for struct dirent.d_ino" >&5
printf %s "checking for struct dirent.d_ino... " >&6; }
if test ${bash_cv_dirent_has_d_ino+y}
then :
printf %s "(cached) " >&6
else case e in #(
e)
ac_fn_c_check_member "$LINENO" "struct dirent" "d_ino" "ac_cv_member_struct_dirent_d_ino" "
#include <stdio.h>
@@ -19946,31 +19934,11 @@ then :
printf "%s\n" "#define HAVE_STRUCT_DIRENT_D_INO 1" >>confdefs.h
bash_cv_dirent_has_d_ino=yes
else case e in #(
e) bash_cv_dirent_has_d_ino=no ;;
esac
fi
;;
esac
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $bash_cv_dirent_has_d_ino" >&5
printf "%s\n" "$bash_cv_dirent_has_d_ino" >&6; }
if test $bash_cv_dirent_has_d_ino = yes; then
printf "%s\n" "#define HAVE_STRUCT_DIRENT_D_INO 1" >>confdefs.h
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for struct dirent.d_fileno" >&5
printf %s "checking for struct dirent.d_fileno... " >&6; }
if test ${bash_cv_dirent_has_d_fileno+y}
then :
printf %s "(cached) " >&6
else case e in #(
e)
ac_fn_c_check_member "$LINENO" "struct dirent" "d_fileno" "ac_cv_member_struct_dirent_d_fileno" "
#include <stdio.h>
@@ -19999,31 +19967,11 @@ then :
printf "%s\n" "#define HAVE_STRUCT_DIRENT_D_FILENO 1" >>confdefs.h
bash_cv_dirent_has_d_fileno=yes
else case e in #(
e) bash_cv_dirent_has_d_fileno=no ;;
esac
fi
;;
esac
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $bash_cv_dirent_has_d_fileno" >&5
printf "%s\n" "$bash_cv_dirent_has_d_fileno" >&6; }
if test $bash_cv_dirent_has_d_fileno = yes; then
printf "%s\n" "#define HAVE_STRUCT_DIRENT_D_FILENO 1" >>confdefs.h
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for struct dirent.d_namlen" >&5
printf %s "checking for struct dirent.d_namlen... " >&6; }
if test ${bash_cv_dirent_has_d_namlen+y}
then :
printf %s "(cached) " >&6
else case e in #(
e)
ac_fn_c_check_member "$LINENO" "struct dirent" "d_namlen" "ac_cv_member_struct_dirent_d_namlen" "
#include <stdio.h>
@@ -20052,23 +20000,10 @@ then :
printf "%s\n" "#define HAVE_STRUCT_DIRENT_D_NAMLEN 1" >>confdefs.h
bash_cv_dirent_has_d_namlen=yes
else case e in #(
e) bash_cv_dirent_has_d_namlen=no ;;
esac
fi
;;
esac
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $bash_cv_dirent_has_d_namlen" >&5
printf "%s\n" "$bash_cv_dirent_has_d_namlen" >&6; }
if test $bash_cv_dirent_has_d_namlen = yes; then
printf "%s\n" "#define HAVE_STRUCT_DIRENT_D_NAMLEN 1" >>confdefs.h
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for struct winsize in sys/ioctl.h and termios.h" >&5
printf %s "checking for struct winsize in sys/ioctl.h and termios.h... " >&6; }
if test ${bash_cv_struct_winsize_header+y}
@@ -21467,15 +21402,6 @@ printf "%s\n" "#define HAVE_VSNPRINTF 0" >>confdefs.h
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for usable strtoimax" >&5
printf %s "checking for usable strtoimax... " >&6; }
if test ${bash_cv_func_strtoimax+y}
then :
printf %s "(cached) " >&6
else case e in #(
e)
HAVE_STRTOIMAX=0 HAVE_DECL_STRTOIMAX=0
ac_fn_c_check_func "$LINENO" "strtoimax" "ac_cv_func_strtoimax"
if test "x$ac_cv_func_strtoimax" = xyes
then :
@@ -21494,35 +21420,14 @@ fi
printf "%s\n" "#define HAVE_DECL_STRTOIMAX $ac_have_decl" >>confdefs.h
if test "$ac_cv_func_strtoimax" = "yes" ; then
HAVE_STRTOIMAX=1
fi
if test "$ac_cv_have_decl_strtoimax" = "yes" ; then
HAVE_DECL_STRTOIMAX=1
fi
if test "$HAVE_STRTOIMAX" = 0 || test "$HAVE_DECL_STRTOIMAX" = 0 ; then
bash_cv_func_strtoimax=no REPLACE_STRTOIMAX=1
else
bash_cv_func_strtoimax=yes
fi
;;
esac
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $bash_cv_func_strtoimax" >&5
printf "%s\n" "$bash_cv_func_strtoimax" >&6; }
if test "$ac_cv_have_decl_strtoimax" = "yes" ; then
printf "%s\n" "#define HAVE_DECL_STRTOIMAX 1" >>confdefs.h
fi
if test $bash_cv_func_strtoimax = no; then
case " $LIBOBJS " in
if test "$ac_cv_func_strtoimax" != "yes" ; then
case " $LIBOBJS " in
*" strtoimax.$ac_objext "* ) ;;
*) LIBOBJS="$LIBOBJS strtoimax.$ac_objext"
;;
esac
fi
fi
ac_fn_check_decl "$LINENO" "clearerr_unlocked" "ac_cv_have_decl_clearerr_unlocked" "$ac_includes_default" "$ac_c_undeclared_builtin_options" "CFLAGS"
if test "x$ac_cv_have_decl_clearerr_unlocked" = xyes
+1 -5
View File
@@ -21,7 +21,7 @@ dnl Process this file with autoconf to produce a configure script.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
AC_REVISION([for Bash 5.3, version 5.071])dnl
AC_REVISION([for Bash 5.3, version 5.073])dnl
define(bashvers, 5.3)
define(relstatus, beta)
@@ -547,11 +547,9 @@ if test "X$cross_compiling" = "Xno"; then
# CFLAGS set above to default value if not passed in environment
if test -n "$want_auto_cflags" ; then
CFLAGS_FOR_BUILD="${CFLAGS}"
BASE_CFLAGS_FOR_BUILD="${CFLAGS}"
else
# passed in environment
CFLAGS_FOR_BUILD=${CFLAGS-'$(CFLAGS)'}
BASE_CFLAGS_FOR_BUILD=${CFLAGS-'$(CFLAGS)'}
fi
LIBS_FOR_BUILD=${LIBS_FOR_BUILD-'$(LIBS)'}
else
@@ -559,7 +557,6 @@ else
CPPFLAGS_FOR_BUILD=${CPPFLAGS_FOR_BUILD-""}
LDFLAGS_FOR_BUILD=${LDFLAGS_FOR_BUILD-""}
CFLAGS_FOR_BUILD=${CFLAGS_FOR_BUILD="-g"}
BASE_CFLAGS_FOR_BUILD=${BASE_CFLAGS_FOR_BUILD="-g"}
LIBS_FOR_BUILD=${LIBS_FOR_BUILD-""}
fi
@@ -570,7 +567,6 @@ AC_SUBST(STATIC_LD)
AC_SUBST(CC_FOR_BUILD)
AC_SUBST(CFLAGS_FOR_BUILD)
AC_SUBST(BASE_CFLAGS_FOR_BUILD)
AC_SUBST(STYLE_CFLAGS)
AC_SUBST(CPPFLAGS_FOR_BUILD)
AC_SUBST(LDFLAGS_FOR_BUILD)
-4
View File
@@ -65,10 +65,6 @@ SUPPORT_SRCDIR = $(topdir)/support
# bad style
RL_LIBDIR = $(topdir)/lib/readline
# unused
TEXINDEX = texindex
TEX = tex
MAKEINFO = makeinfo
TEXI2DVI = ${SUPPORT_SRCDIR}/texi2dvi
TEXI2HTML = ${SUPPORT_SRCDIR}/texi2html
+1
View File
@@ -39,6 +39,7 @@ MV = mv
SHELL = @MAKE_SHELL@
PROFILE_FLAGS = @PROFILE_FLAGS@
ADDON_CFLAGS =
CFLAGS = @CFLAGS@
LOCAL_CFLAGS = @LOCAL_CFLAGS@
-1
View File
@@ -72,7 +72,6 @@ ALLOCA_SOURCE = alloca.c
ALLOCA_OBJECT = alloca.o
MALLOC_SRC = @MALLOC_SRC@
MALLOC = @MALLOC@
ALLOCA = @ALLOCA@
MALLOC_OBJS = malloc.o $(ALLOCA) trace.o stats.o table.o watch.o
+2
View File
@@ -54,6 +54,8 @@ CTAGS = ctags -tw
DEBUG = @DEBUG@
ADDON_CFLAGS =
CFLAGS = @CFLAGS@
LOCAL_CFLAGS = @LOCAL_CFLAGS@ ${DEBUG}
STYLE_CFLAGS = @STYLE_CFLAGS@
+5
View File
@@ -55,6 +55,8 @@ MV = mv
SHELL = @MAKE_SHELL@
DEBUG = @DEBUG@
CFLAGS = @CFLAGS@
LOCAL_CFLAGS = @LOCAL_CFLAGS@ ${DEBUG}
STYLE_CFLAGS = @STYLE_CFLAGS@
@@ -63,6 +65,8 @@ LDFLAGS = @LDFLAGS@ @LOCAL_LDFLAGS@
PROFILE_FLAGS = @PROFILE_FLAGS@
ADDON_CFLAGS =
DEFS = @DEFS@
LOCAL_DEFS = @LOCAL_DEFS@
@@ -101,6 +105,7 @@ CSOURCES = clktck.c clock.c getcwd.c getenv.c oslib.c setlinebuf.c \
HSOURCES =
# The object files contained in $(LIBRARY_NAME)
LIBOBJDIR =
LIBOBJS = @LIBOBJS@
OBJECTS = clktck.o clock.o getenv.o oslib.o setlinebuf.o strnlen.o \
itos.o zread.o zwrite.o shtty.o shmatch.o eaccess.o \
+5 -2
View File
@@ -40,6 +40,8 @@ SHELL = @MAKE_SHELL@
PROFILE_FLAGS = @PROFILE_FLAGS@
ADDON_CFLAGS =
CFLAGS = @CFLAGS@
LOCAL_CFLAGS = @LOCAL_CFLAGS@
STYLE_CFLAGS = @STYLE_CFLAGS@
@@ -53,8 +55,9 @@ BASHINCDIR = ${topdir}/include
INCLUDES = -I. -I../.. -I$(topdir) -I${BASHINCDIR} -I$(topdir)/lib
CCFLAGS = ${ASAN_CFLAGS} $(PROFILE_FLAGS) $(DEFS) $(LOCAL_DEFS) $(CPPFLAGS) \
${INCLUDES} $(STYLE_CFLAGS) $(LOCAL_CFLAGS) $(CFLAGS)
CCFLAGS = $(PROFILE_FLAGS) $(DEFS) $(LOCAL_DEFS) $(CPPFLAGS) \
${INCLUDES} $(STYLE_CFLAGS) $(LOCAL_CFLAGS) $(CFLAGS) \
${ADDON_CFLAGS}
.c.o:
$(CC) -c $(CCFLAGS) $<
+3 -23
View File
@@ -6,32 +6,12 @@ dnl with or without modifications, as long as this notice is preserved.
dnl Make sure we replace strtoimax if we don't have a declaration
dnl We can use this as a template for future function checks
AC_DEFUN([BASH_FUNC_STRTOIMAX], [
AC_MSG_CHECKING([for usable strtoimax])
AC_CACHE_VAL(bash_cv_func_strtoimax,
AC_DEFUN([BASH_FUNC_STRTOIMAX],
[
HAVE_STRTOIMAX=0 HAVE_DECL_STRTOIMAX=0
AC_CHECK_FUNCS([strtoimax])
AC_CHECK_DECLS([strtoimax])
if test "$ac_cv_func_strtoimax" = "yes" ; then
HAVE_STRTOIMAX=1
fi
if test "$ac_cv_have_decl_strtoimax" = "yes" ; then
HAVE_DECL_STRTOIMAX=1
fi
if test "$HAVE_STRTOIMAX" = 0 || test "$HAVE_DECL_STRTOIMAX" = 0 ; then
bash_cv_func_strtoimax=no REPLACE_STRTOIMAX=1
else
bash_cv_func_strtoimax=yes
if test "$ac_cv_func_strtoimax" != "yes" ; then
AC_LIBOBJ(strtoimax)
fi
])
AC_MSG_RESULT($bash_cv_func_strtoimax)
if test "$ac_cv_have_decl_strtoimax" = "yes" ; then
AC_DEFINE([HAVE_DECL_STRTOIMAX], [1])
fi
if test $bash_cv_func_strtoimax = no; then
AC_LIBOBJ(strtoimax)
fi
])
+65 -29
View File
@@ -341,10 +341,12 @@ static int token_before_that;
/* The token read prior to token_before_that. */
static int two_tokens_ago;
/* Someday compoundcmd_lineno will be an array of these structs. */
/* compoundcmd_lineno is an array of these structs. This holds information
about the current compound command the parser is reading (token) and
where it begins (lineno). */
struct tokeninfo {
int lineno;
int tok;
int token;
};
/* The line number in a script where a compound command begins. The
@@ -353,7 +355,7 @@ struct tokeninfo {
This is a nested command maximum, since the array index is decremented
after a compound command is parsed. */
#define MAX_COMPOUND_NEST 256
static int compoundcmd_lineno[MAX_COMPOUND_NEST+1];
static struct tokeninfo compoundcmd_lineno[MAX_COMPOUND_NEST+1];
static int compoundcmd_top = -1;
/* If non-zero, it is the token that we want read_token to return
@@ -890,45 +892,57 @@ shell_command: for_command
for_command: FOR WORD newline_list DO compound_list DONE
{
$$ = make_for_command ($2, add_string_to_list ("\"$@\"", (WORD_LIST *)NULL), $5, compoundcmd_lineno[compoundcmd_top]);
$$ = make_for_command ($2, add_string_to_list ("\"$@\"", (WORD_LIST *)NULL), $5, compoundcmd_lineno[compoundcmd_top].lineno);
if (compoundcmd_top >= 0) compoundcmd_top--;
}
| FOR WORD newline_list '{' compound_list '}'
{
$$ = make_for_command ($2, add_string_to_list ("\"$@\"", (WORD_LIST *)NULL), $5, compoundcmd_lineno[compoundcmd_top]);
int l;
l = (compoundcmd_top > 0) ? compoundcmd_lineno[compoundcmd_top - 1].lineno
: compoundcmd_lineno[compoundcmd_top].lineno;
$$ = make_for_command ($2, add_string_to_list ("\"$@\"", (WORD_LIST *)NULL), $5, l);
if (compoundcmd_top >= 0) compoundcmd_top--; /* RBRACE */
if (compoundcmd_top >= 0) compoundcmd_top--; /* FOR */
}
| FOR WORD ';' newline_list DO compound_list DONE
{
$$ = make_for_command ($2, add_string_to_list ("\"$@\"", (WORD_LIST *)NULL), $6, compoundcmd_lineno[compoundcmd_top]);
$$ = make_for_command ($2, add_string_to_list ("\"$@\"", (WORD_LIST *)NULL), $6, compoundcmd_lineno[compoundcmd_top].lineno);
if (compoundcmd_top >= 0) compoundcmd_top--;
}
| FOR WORD ';' newline_list '{' compound_list '}'
{
$$ = make_for_command ($2, add_string_to_list ("\"$@\"", (WORD_LIST *)NULL), $6, compoundcmd_lineno[compoundcmd_top]);
int l;
l = (compoundcmd_top > 0) ? compoundcmd_lineno[compoundcmd_top - 1].lineno
: compoundcmd_lineno[compoundcmd_top].lineno;
$$ = make_for_command ($2, add_string_to_list ("\"$@\"", (WORD_LIST *)NULL), $6, l);
if (compoundcmd_top >= 0) compoundcmd_top--; /* RBRACE */
if (compoundcmd_top >= 0) compoundcmd_top--; /* FOR */
}
| FOR WORD newline_list IN word_list list_terminator newline_list DO compound_list DONE
{
$$ = make_for_command ($2, REVERSE_LIST ($5, WORD_LIST *), $9, compoundcmd_lineno[compoundcmd_top]);
$$ = make_for_command ($2, REVERSE_LIST ($5, WORD_LIST *), $9, compoundcmd_lineno[compoundcmd_top].lineno);
if (compoundcmd_top >= 0) compoundcmd_top--;
}
| FOR WORD newline_list IN word_list list_terminator newline_list '{' compound_list '}'
{
$$ = make_for_command ($2, REVERSE_LIST ($5, WORD_LIST *), $9, compoundcmd_lineno[compoundcmd_top]);
int l;
l = (compoundcmd_top > 0) ? compoundcmd_lineno[compoundcmd_top - 1].lineno
: compoundcmd_lineno[compoundcmd_top].lineno;
$$ = make_for_command ($2, REVERSE_LIST ($5, WORD_LIST *), $9, l);
if (compoundcmd_top >= 0) compoundcmd_top--; /* RBRACE */
if (compoundcmd_top >= 0) compoundcmd_top--; /* FOR */
}
| FOR WORD newline_list IN list_terminator newline_list DO compound_list DONE
{
$$ = make_for_command ($2, (WORD_LIST *)NULL, $8, compoundcmd_lineno[compoundcmd_top]);
$$ = make_for_command ($2, (WORD_LIST *)NULL, $8, compoundcmd_lineno[compoundcmd_top].lineno);
if (compoundcmd_top >= 0) compoundcmd_top--;
}
| FOR WORD newline_list IN list_terminator newline_list '{' compound_list '}'
{
$$ = make_for_command ($2, (WORD_LIST *)NULL, $8, compoundcmd_lineno[compoundcmd_top]);
int l;
l = (compoundcmd_top > 0) ? compoundcmd_lineno[compoundcmd_top - 1].lineno
: compoundcmd_lineno[compoundcmd_top].lineno;
$$ = make_for_command ($2, (WORD_LIST *)NULL, $8, l);
if (compoundcmd_top >= 0) compoundcmd_top--; /* RBRACE */
if (compoundcmd_top >= 0) compoundcmd_top--; /* FOR */
}
@@ -964,45 +978,57 @@ arith_for_command: FOR ARITH_FOR_EXPRS list_terminator newline_list DO compound_
select_command: SELECT WORD newline_list DO compound_list DONE
{
$$ = make_select_command ($2, add_string_to_list ("\"$@\"", (WORD_LIST *)NULL), $5, compoundcmd_lineno[compoundcmd_top]);
$$ = make_select_command ($2, add_string_to_list ("\"$@\"", (WORD_LIST *)NULL), $5, compoundcmd_lineno[compoundcmd_top].lineno);
if (compoundcmd_top >= 0) compoundcmd_top--;
}
| SELECT WORD newline_list '{' compound_list '}'
{
$$ = make_select_command ($2, add_string_to_list ("\"$@\"", (WORD_LIST *)NULL), $5, compoundcmd_lineno[compoundcmd_top]);
int l;
l = (compoundcmd_top > 0) ? compoundcmd_lineno[compoundcmd_top - 1].lineno
: compoundcmd_lineno[compoundcmd_top].lineno;
$$ = make_select_command ($2, add_string_to_list ("\"$@\"", (WORD_LIST *)NULL), $5, l);
if (compoundcmd_top >= 0) compoundcmd_top--; /* RBRACE */
if (compoundcmd_top >= 0) compoundcmd_top--; /* SELECT */
}
| SELECT WORD ';' newline_list DO compound_list DONE
{
$$ = make_select_command ($2, add_string_to_list ("\"$@\"", (WORD_LIST *)NULL), $6, compoundcmd_lineno[compoundcmd_top]);
$$ = make_select_command ($2, add_string_to_list ("\"$@\"", (WORD_LIST *)NULL), $6, compoundcmd_lineno[compoundcmd_top].lineno);
if (compoundcmd_top >= 0) compoundcmd_top--;
}
| SELECT WORD ';' newline_list '{' compound_list '}'
{
$$ = make_select_command ($2, add_string_to_list ("\"$@\"", (WORD_LIST *)NULL), $6, compoundcmd_lineno[compoundcmd_top]);
int l;
l = (compoundcmd_top > 0) ? compoundcmd_lineno[compoundcmd_top - 1].lineno
: compoundcmd_lineno[compoundcmd_top].lineno;
$$ = make_select_command ($2, add_string_to_list ("\"$@\"", (WORD_LIST *)NULL), $6, l);
if (compoundcmd_top >= 0) compoundcmd_top--; /* RBRACE */
if (compoundcmd_top >= 0) compoundcmd_top--; /* SELECT */
}
| SELECT WORD newline_list IN word_list list_terminator newline_list DO compound_list DONE
{
$$ = make_select_command ($2, REVERSE_LIST ($5, WORD_LIST *), $9, compoundcmd_lineno[compoundcmd_top]);
$$ = make_select_command ($2, REVERSE_LIST ($5, WORD_LIST *), $9, compoundcmd_lineno[compoundcmd_top].lineno);
if (compoundcmd_top >= 0) compoundcmd_top--;
}
| SELECT WORD newline_list IN word_list list_terminator newline_list '{' compound_list '}'
{
$$ = make_select_command ($2, REVERSE_LIST ($5, WORD_LIST *), $9, compoundcmd_lineno[compoundcmd_top]);
int l;
l = (compoundcmd_top > 0) ? compoundcmd_lineno[compoundcmd_top - 1].lineno
: compoundcmd_lineno[compoundcmd_top].lineno;
$$ = make_select_command ($2, REVERSE_LIST ($5, WORD_LIST *), $9, l);
if (compoundcmd_top >= 0) compoundcmd_top--; /* RBRACE */
if (compoundcmd_top >= 0) compoundcmd_top--; /* SELECT */
}
| SELECT WORD newline_list IN list_terminator newline_list DO compound_list DONE
{
$$ = make_select_command ($2, (WORD_LIST *)NULL, $8, compoundcmd_lineno[compoundcmd_top]);
$$ = make_select_command ($2, (WORD_LIST *)NULL, $8, compoundcmd_lineno[compoundcmd_top].lineno);
if (compoundcmd_top >= 0) compoundcmd_top--;
}
| SELECT WORD newline_list IN list_terminator newline_list '{' compound_list '}'
{
$$ = make_select_command ($2, (WORD_LIST *)NULL, $8, compoundcmd_lineno[compoundcmd_top]);
int l;
l = (compoundcmd_top > 0) ? compoundcmd_lineno[compoundcmd_top - 1].lineno
: compoundcmd_lineno[compoundcmd_top].lineno;
$$ = make_select_command ($2, (WORD_LIST *)NULL, $8, l);
if (compoundcmd_top >= 0) compoundcmd_top--; /* RBRACE */
if (compoundcmd_top >= 0) compoundcmd_top--; /* SELECT */
}
@@ -1010,17 +1036,17 @@ select_command: SELECT WORD newline_list DO compound_list DONE
case_command: CASE WORD newline_list IN newline_list ESAC
{
$$ = make_case_command ($2, (PATTERN_LIST *)NULL, compoundcmd_lineno[compoundcmd_top]);
$$ = make_case_command ($2, (PATTERN_LIST *)NULL, compoundcmd_lineno[compoundcmd_top].lineno);
if (compoundcmd_top >= 0) compoundcmd_top--;
}
| CASE WORD newline_list IN case_clause_sequence newline_list ESAC
{
$$ = make_case_command ($2, $5, compoundcmd_lineno[compoundcmd_top]);
$$ = make_case_command ($2, $5, compoundcmd_lineno[compoundcmd_top].lineno);
if (compoundcmd_top >= 0) compoundcmd_top--;
}
| CASE WORD newline_list IN case_clause ESAC
{
$$ = make_case_command ($2, $5, compoundcmd_lineno[compoundcmd_top]);
$$ = make_case_command ($2, $5, compoundcmd_lineno[compoundcmd_top].lineno);
if (compoundcmd_top >= 0) compoundcmd_top--;
}
;
@@ -4870,7 +4896,7 @@ parse_dparen (int c)
#if defined (ARITH_FOR_COMMAND)
if (last_read_token == FOR)
{
arith_for_lineno = compoundcmd_top[compoundcmd_lineno];
arith_for_lineno = compoundcmd_top[compoundcmd_lineno].lineno;
cmdtyp = parse_arith_cmd (&wval, 0);
if (cmdtyp == 1)
{
@@ -5842,7 +5868,8 @@ set_compoundcmd_top (int t)
case COND_START:
if (compoundcmd_top < MAX_COMPOUND_NEST)
compoundcmd_top++;
compoundcmd_lineno[compoundcmd_top] = line_number;
compoundcmd_lineno[compoundcmd_top].lineno = line_number;
compoundcmd_lineno[compoundcmd_top].token = t;
break;
default:
break;
@@ -6790,10 +6817,10 @@ report_syntax_error (const char *message)
free (msg);
msg = p;
}
if (shell_eof_token && current_token != shell_eof_token)
parser_error (line_number, _("syntax error near unexpected token `%s' while looking for matching `%c'"), msg, shell_eof_token);
else
parser_error (line_number, _("syntax error near unexpected token `%s'"), msg);
if (shell_eof_token && current_token != shell_eof_token)
parser_error (line_number, _("syntax error near unexpected token `%s' while looking for matching `%c'"), msg, shell_eof_token);
else
parser_error (line_number, _("syntax error near unexpected token `%s'"), msg);
free (msg);
if (interactive == 0)
@@ -6825,7 +6852,16 @@ else
if (EOF_Reached && shell_eof_token && current_token != shell_eof_token)
parser_error (line_number, _("unexpected EOF while looking for matching `%c'"), shell_eof_token);
else if (EOF_Reached && compoundcmd_top >= 0)
parser_error (line_number, _("syntax error: unexpected end of file from command on line %d"), compoundcmd_lineno[compoundcmd_top]);
{
char *x;
x = find_token_in_alist (compoundcmd_lineno[compoundcmd_top].token, word_token_alist, 1);
if (x == 0)
x = find_token_in_alist (compoundcmd_lineno[compoundcmd_top].token, other_token_alist, 1);
if (x)
parser_error (line_number, _("syntax error: unexpected end of file from `%s' command on line %d"), x, compoundcmd_lineno[compoundcmd_top].lineno);
else
parser_error (line_number, _("syntax error: unexpected end of file from command on line %d"), compoundcmd_lineno[compoundcmd_top].lineno);
}
else
{
msg = EOF_Reached ? _("syntax error: unexpected end of file") : _("syntax error");
+1
View File
@@ -110,6 +110,7 @@ extern int subshell_environment;
extern int current_command_number;
extern int indirection_level;
extern int shell_compatibility_level;
extern const int default_compatibility_level;
extern int running_under_emacs;
extern int pretty_print_mode;
+4 -2
View File
@@ -70,7 +70,9 @@ find_string_in_alist (char *string, STRING_INT_ALIST *alist, int flags)
/* Find TOKEN in ALIST, a list of string/int value pairs. Return the
corresponding string. Allocates memory for the returned
string. FLAGS is currently ignored, but reserved. */
string. FLAGS == 0 means to allocate new memory, the existing
behavior. If FLAGS&1, we just return the token and expect the caller
to allocate new memory and save it, if necessary. */
char *
find_token_in_alist (int token, STRING_INT_ALIST *alist, int flags)
{
@@ -79,7 +81,7 @@ find_token_in_alist (int token, STRING_INT_ALIST *alist, int flags)
for (i = 0; alist[i].word; i++)
{
if (alist[i].token == token)
return (savestring (alist[i].word));
return (flags ? alist[i].word : savestring (alist[i].word));
}
return (NULL);
}
+1 -2
View File
@@ -46,7 +46,6 @@ PROFILE_FLAGS = @PROFILE_FLAGS@
CFLAGS = @CFLAGS@
CFLAGS_FOR_BUILD = @CFLAGS_FOR_BUILD@
BASE_CFLAGS_FOR_BUILD = @BASE_CFLAGS_FOR_BUILD@
CPPFLAGS = @CPPFLAGS@
CPPFLAGS_FOR_BUILD = @CPPFLAGS_FOR_BUILD@
LOCAL_CFLAGS = @LOCAL_CFLAGS@
@@ -63,7 +62,7 @@ LDFLAGS_FOR_BUILD = @LDFLAGS_FOR_BUILD@ $(LOCAL_LDFLAGS) $(CFLAGS_FOR_BUILD)
INCLUDES = -I${BUILD_DIR} -I${topdir}
BASE_CCFLAGS = ${PROFILE_FLAGS} $(DEFS) $(LOCAL_DEFS) $(SYSTEM_FLAGS) \
BASE_CCFLAGS = ${PROFILE_FLAGS} $(DEFS) $(LOCAL_DEFS) \
${INCLUDES} $(STYLE_CFLAGS) $(LOCAL_CFLAGS)
CCFLAGS = $(BASE_CCFLAGS) $(CPPFLAGS) $(CFLAGS)
+2 -2
View File
@@ -154,9 +154,9 @@ ok 6
ok 7
ok 8
bash: -c: line 1: unexpected token `EOF', expected `)'
bash: -c: line 2: syntax error: unexpected end of file from command on line 1
bash: -c: line 2: syntax error: unexpected end of file from `[[' command on line 1
bash: -c: line 1: unexpected EOF while looking for `]]'
bash: -c: line 2: syntax error: unexpected end of file from command on line 1
bash: -c: line 2: syntax error: unexpected end of file from `[[' command on line 1
bash: -c: line 1: syntax error in conditional expression: unexpected token `]'
bash: -c: line 1: syntax error near `]'
bash: -c: line 1: `[[ ( -t X ) ]'
+6 -6
View File
@@ -240,7 +240,7 @@ after non-special builtin: 1
./errors7.sub: line 27: x: readonly variable
./errors7.sub: line 29: x: readonly variable
./errors7.sub: line 32: v: readonly variable
./errors8.sub: eval: line 7: syntax error: unexpected end of file from command on line 6
./errors8.sub: eval: line 7: syntax error: unexpected end of file from `(' command on line 6
ok 1
./errors8.sub: line 8: v: readonly variable
ok 2
@@ -330,11 +330,11 @@ bash: line 1: readonly: `AA[4]': not a valid identifier
array: 1
sh: line 1: export: `AA[4]': not a valid identifier
sh: line 1: readonly: `AA[4]': not a valid identifier
bash: -c: line 5: syntax error: unexpected end of file from command on line 1
bash: -c: line 3: syntax error: unexpected end of file from command on line 1
bash: -c: line 4: syntax error: unexpected end of file from command on line 1
bash: -c: line 5: syntax error: unexpected end of file from command on line 1
bash: -c: line 7: syntax error: unexpected end of file from command on line 1
bash: -c: line 5: syntax error: unexpected end of file from `if' command on line 1
bash: -c: line 3: syntax error: unexpected end of file from `while' command on line 1
bash: -c: line 4: syntax error: unexpected end of file from `until' command on line 1
bash: -c: line 5: syntax error: unexpected end of file from `for' command on line 1
bash: -c: line 7: syntax error: unexpected end of file from `case' command on line 1
bash: line 1: return: can only `return' from a function or sourced script
after return
bash: line 1: return: can only `return' from a function or sourced script
+1 -1
View File
@@ -1,7 +1,7 @@
exportfunc ok 1
exportfunc ok 2
./exportfunc.tests: line 37: cve7169-bad: No such file or directory
./exportfunc.tests: eval: line 44: syntax error: unexpected end of file from command on line 42
./exportfunc.tests: eval: line 44: syntax error: unexpected end of file from `{' command on line 42
./exportfunc.tests: line 43: cve7169-bad2: No such file or directory
./exportfunc1.sub: line 14: maximum here-document count exceeded
./exportfunc.tests: line 72: HELLO_WORLD: No such file or directory
+1 -1
View File
@@ -95,7 +95,7 @@ hello
\END
end hello<NL>\END
./heredoc3.sub: line 98: warning: here-document at line 96 delimited by end-of-file (wanted `EOF')
./heredoc3.sub: line 99: syntax error: unexpected end of file from command on line 96
./heredoc3.sub: line 99: syntax error: unexpected end of file from `(' command on line 96
heredoc1
EOF
Ok:0
+3 -3
View File
@@ -6443,14 +6443,14 @@ sv_shcompat (const char *name)
v = find_variable (name);
if (v == 0)
{
shell_compatibility_level = DEFAULT_COMPAT_LEVEL;
shell_compatibility_level = default_compatibility_level;
set_compatibility_opts ();
return;
}
val = value_cell (v);
if (val == 0 || *val == '\0')
{
shell_compatibility_level = DEFAULT_COMPAT_LEVEL;
shell_compatibility_level = default_compatibility_level;
set_compatibility_opts ();
return;
}
@@ -6477,7 +6477,7 @@ compat_error:
return;
}
if (compatval < MIN_COMPAT_LEVEL || compatval > DEFAULT_COMPAT_LEVEL)
if (compatval < MIN_COMPAT_LEVEL || compatval > default_compatibility_level)
goto compat_error;
shell_compatibility_level = compatval;
+1
View File
@@ -51,6 +51,7 @@ const char * const bash_copyright = N_("Copyright (C) 2024 Free Software Foundat
const char * const bash_license = N_("License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\n");
/* If == 31, shell compatible with bash-3.1, == 32 with bash-3.2, and so on */
const int default_compatibility_level = DEFAULT_COMPAT_LEVEL;
int shell_compatibility_level = DEFAULT_COMPAT_LEVEL;
/* Functions for getting, setting, and displaying the shell version. */