diff --git a/CWRU/CWRU.chlog b/CWRU/CWRU.chlog index 6fbaa435..eb1934e0 100644 --- a/CWRU/CWRU.chlog +++ b/CWRU/CWRU.chlog @@ -3590,4 +3590,27 @@ parse.y 4/27 ---- lib/sh/strvis.c - - strivs: changes to handle being compiled without multibyte support + - sh_charvis: changes to handle being compiled without multibyte support + + 4/29 + ---- +lib/readline/callback.c + - rl_callback_read_char: don't set rl_eof_found unless eof is > 0, + since it can be -3 if we need to read more input in a multi-key + sequence. Report from Andrew Burgess + +examples/loadables/Makefile.sample.in + - new file, containing the rules to build the example shared object + - includes Makefile.inc from wherever it's installed. Suggested by + Robert E. Griffith + +examples/loadables/Makefile.inc.in + - remove rules that create the example shared object + + 4/30 + ---- +builtins/evalstring.c + - parse_and_execute: check for terminating signals before returning, + after any longjmp, to improve responsiveness and fix the -c code + path before running any exit trap. Report from + Emanuele Torre diff --git a/MANIFEST b/MANIFEST index e907c78b..86c3a104 100644 --- a/MANIFEST +++ b/MANIFEST @@ -717,6 +717,7 @@ examples/loadables/template.c f examples/loadables/loadables.h f examples/loadables/Makefile.in f examples/loadables/Makefile.inc.in f +examples/loadables/Makefile.sample.in f examples/loadables/necho.c f examples/loadables/hello.c f examples/loadables/asort.c f diff --git a/Makefile.in b/Makefile.in index ef26d708..5fc3644c 100644 --- a/Makefile.in +++ b/Makefile.in @@ -468,7 +468,8 @@ INSTALLED_HEADERS = shell.h bashjmp.h command.h syntax.h general.h error.h \ make_cmd.h subst.h sig.h externs.h builtins.h \ bashtypes.h xmalloc.h config-top.h config-bot.h \ bashintl.h bashansi.h bashjmp.h alias.h hashlib.h \ - conftypes.h unwind_prot.h jobs.h siglist.h + conftypes.h unwind_prot.h jobs.h siglist.h \ + execute_cmd.h INSTALLED_BUILTINS_HEADERS = bashgetopt.h common.h getopt.h INSTALLED_INCFILES = posixstat.h ansi_stdlib.h filecntl.h posixdir.h \ memalloc.h stdc.h posixjmp.h posixwait.h posixtime.h systimes.h \ @@ -570,7 +571,7 @@ CREATED_MAKEFILES = Makefile builtins/Makefile doc/Makefile \ lib/readline/Makefile lib/glob/Makefile \ lib/sh/Makefile lib/tilde/Makefile lib/malloc/Makefile \ lib/termcap/Makefile examples/loadables/Makefile \ - examples/loadables/Makefile.inc \ + examples/loadables/Makefile.inc examples/loadables/Makefile.sample \ examples/loadables/perl/Makefile support/Makefile \ lib/intl/Makefile po/Makefile po/Makefile.in CREATED_HEADERS = signames.h config.h pathnames.h version.h y.tab.h \ diff --git a/bashline.h b/bashline.h index 48c9fecf..d40228e2 100644 --- a/bashline.h +++ b/bashline.h @@ -53,7 +53,7 @@ extern int unbind_unix_command PARAMS((char *)); extern char **bash_default_completion PARAMS((const char *, int, int, int, int)); -void set_directory_hook PARAMS((void)); +extern void set_directory_hook PARAMS((void)); /* Used by programmable completion code. */ extern char *command_word_completion_function PARAMS((const char *, int)); diff --git a/builtins/evalstring.c b/builtins/evalstring.c index 5088151a..7023eb32 100644 --- a/builtins/evalstring.c +++ b/builtins/evalstring.c @@ -426,7 +426,7 @@ parse_and_execute (string, from_file, flags) break; } } - + if (parse_command () == 0) { if ((flags & SEVAL_PARSEONLY) || (interactive_shell == 0 && read_but_dont_execute)) @@ -561,6 +561,8 @@ parse_and_execute (string, from_file, flags) throw_to_top_level (); } + CHECK_TERMSIG; + if (should_jump_to_top_level) jump_to_top_level (code); @@ -594,7 +596,6 @@ parse_string (string, from_file, flags, cmdp, endp) sigprocmask (SIG_BLOCK, (sigset_t *)NULL, (sigset_t *)&ps_sigmask); #endif -/*itrace("parse_string: `%s'", string);*/ /* Reset the line number if the caller wants us to. If we don't reset the line number, we have to subtract one, because we will add one just before executing the next command (resetting the line number sets it to diff --git a/configure b/configure index 792e922a..4ae751c8 100755 --- a/configure +++ b/configure @@ -1,5 +1,5 @@ #! /bin/sh -# From configure.ac for Bash 5.2, version 5.040. +# From configure.ac for Bash 5.2, version 5.041. # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.71 for bash 5.2-beta. # @@ -21863,7 +21863,7 @@ fi #AC_SUBST(ALLOCA_SOURCE) #AC_SUBST(ALLOCA_OBJECT) -ac_config_files="$ac_config_files Makefile builtins/Makefile lib/readline/Makefile lib/glob/Makefile lib/intl/Makefile lib/malloc/Makefile lib/sh/Makefile lib/termcap/Makefile lib/tilde/Makefile doc/Makefile support/Makefile po/Makefile.in examples/loadables/Makefile examples/loadables/Makefile.inc examples/loadables/perl/Makefile support/bash.pc support/bashbug.sh" +ac_config_files="$ac_config_files Makefile builtins/Makefile lib/readline/Makefile lib/glob/Makefile lib/intl/Makefile lib/malloc/Makefile lib/sh/Makefile lib/termcap/Makefile lib/tilde/Makefile doc/Makefile support/Makefile po/Makefile.in examples/loadables/Makefile examples/loadables/Makefile.inc examples/loadables/Makefile.sample examples/loadables/perl/Makefile support/bash.pc support/bashbug.sh" ac_config_commands="$ac_config_commands stamp-h" @@ -22586,6 +22586,7 @@ do "po/Makefile.in") CONFIG_FILES="$CONFIG_FILES po/Makefile.in" ;; "examples/loadables/Makefile") CONFIG_FILES="$CONFIG_FILES examples/loadables/Makefile" ;; "examples/loadables/Makefile.inc") CONFIG_FILES="$CONFIG_FILES examples/loadables/Makefile.inc" ;; + "examples/loadables/Makefile.sample") CONFIG_FILES="$CONFIG_FILES examples/loadables/Makefile.sample" ;; "examples/loadables/perl/Makefile") CONFIG_FILES="$CONFIG_FILES examples/loadables/perl/Makefile" ;; "support/bash.pc") CONFIG_FILES="$CONFIG_FILES support/bash.pc" ;; "support/bashbug.sh") CONFIG_FILES="$CONFIG_FILES support/bashbug.sh" ;; diff --git a/configure.ac b/configure.ac index aee938a3..0b41e647 100644 --- a/configure.ac +++ b/configure.ac @@ -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 . -AC_REVISION([for Bash 5.2, version 5.040])dnl +AC_REVISION([for Bash 5.2, version 5.041])dnl define(bashvers, 5.2) define(relstatus, beta) @@ -1316,6 +1316,7 @@ AC_CONFIG_FILES([Makefile builtins/Makefile lib/readline/Makefile \ lib/tilde/Makefile doc/Makefile support/Makefile \ po/Makefile.in examples/loadables/Makefile \ examples/loadables/Makefile.inc \ + examples/loadables/Makefile.sample \ examples/loadables/perl/Makefile \ support/bash.pc support/bashbug.sh]) diff --git a/doc/bash.1 b/doc/bash.1 index e593be65..900a17a2 100644 --- a/doc/bash.1 +++ b/doc/bash.1 @@ -5,12 +5,12 @@ .\" Case Western Reserve University .\" chet.ramey@case.edu .\" -.\" Last Change: Fri Mar 11 10:16:50 EST 2022 +.\" Last Change: Mon May 2 09:00:07 EDT 2022 .\" .\" bash_builtins, strip all but Built-Ins section .if \n(zZ=1 .ig zZ .if \n(zY=1 .ig zY -.TH BASH 1 "2022 March 11" "GNU Bash 5.2" +.TH BASH 1 "2022 May 2" "GNU Bash 5.2" .\" .\" There's some problem with having a `@' .\" in a tagged paragraph with the BSD man macros. @@ -589,7 +589,8 @@ The variable may be used to specify the format of the time information. .PP -Each command in a pipeline is executed in a \fIsubshell\fP, which is a +Each command in a multi-command +pipeline is executed in a \fIsubshell\fP, which is a separate process. See .SM diff --git a/doc/bashref.texi b/doc/bashref.texi index 6d136d75..5a110ece 100644 --- a/doc/bashref.texi +++ b/doc/bashref.texi @@ -801,7 +801,8 @@ the time information. If the pipeline is not executed asynchronously (@pxref{Lists}), the shell waits for all commands in the pipeline to complete. -Each command in a pipeline is executed in its own @dfn{subshell}, which is a +Each command in a multi-command +pipeline is executed in its own @dfn{subshell}, which is a separate process (@pxref{Command Execution Environment}). If the @code{lastpipe} option is enabled using the @code{shopt} builtin (@pxref{The Shopt Builtin}), diff --git a/doc/version.texi b/doc/version.texi index c04e2a72..7454574c 100644 --- a/doc/version.texi +++ b/doc/version.texi @@ -2,10 +2,10 @@ Copyright (C) 1988-2022 Free Software Foundation, Inc. @end ignore -@set LASTCHANGE Mon Apr 11 17:04:12 EDT 2022 +@set LASTCHANGE Mon May 2 08:59:39 EDT 2022 @set EDITION 5.2 @set VERSION 5.2 -@set UPDATED 11 April 2022 -@set UPDATED-MONTH April 2022 +@set UPDATED 2 May 2022 +@set UPDATED-MONTH May 2022 diff --git a/examples/loadables/Makefile.in b/examples/loadables/Makefile.in index 60aef04c..a3cf3725 100644 --- a/examples/loadables/Makefile.in +++ b/examples/loadables/Makefile.in @@ -249,7 +249,7 @@ pushd.c: ${topdir}/builtins/pushd.def pushd.o: pushd.c $(RM) $@ - $(SHOBJ_CC) -DHAVE_CONFIG_H -DPUSHD_AND_POPD -DLOADABLE_BUILTIN $(SHOBJ_CFLAGS) $(CFLAGS) $(CPPFLAGS) $(INC) -c -o $@ $< + $(SHOBJ_CC) -Wno-format-security -DHAVE_CONFIG_H -DPUSHD_AND_POPD -DLOADABLE_BUILTIN $(SHOBJ_CFLAGS) $(CFLAGS) $(CPPFLAGS) $(INC) -c -o $@ $< pushd: pushd.o $(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ pushd.o $(SHOBJ_LIBS) @@ -262,7 +262,7 @@ mostlyclean: clean -( cd perl && ${MAKE} ${MFLAGS} $@ ) distclean maintainer-clean: clean - $(RM) Makefile Makefile.inc pushd.c + $(RM) Makefile Makefile.inc Makefile.sample pushd.c -( cd perl && ${MAKE} ${MFLAGS} $@ ) installdirs: @@ -270,6 +270,7 @@ installdirs: install-dev: installdirs @$(INSTALL_DATA) Makefile.inc $(DESTDIR)$(loadablesdir)/Makefile.inc + @$(INSTALL_DATA) Makefile.sample $(DESTDIR)$(loadablesdir)/Makefile.sample @$(INSTALL_DATA) $(srcdir)/loadables.h $(DESTDIR)$(loadablesdir)/loadables.h @( cd $(BUILD_DIR) && ${MAKE} ${MFLAGS} DESTDIR="$(DESTDIR)" install-headers) @@ -281,7 +282,8 @@ install-supported: all installdirs install-dev done uninstall-dev: - -$(RM) $(DESTDIR)$(loadablesdir)/Makefile.inc $(DESTDIR)$(loadablesdir)/loadables.h + -$(RM) $(DESTDIR)$(loadablesdir)/Makefile.inc $(DESTDIR)$(loadablesdir)/Makefile.sample + -$(RM) $(DESTDIR)$(loadablesdir)/loadables.h -( cd $(BUILD_DIR) && ${MAKE} ${MFLAGS} DESTDIR="$(DESTDIR)" uninstall-headers) uninstall-supported: uninstall-dev diff --git a/examples/loadables/Makefile.inc.in b/examples/loadables/Makefile.inc.in index 8b419a78..ee3c3035 100644 --- a/examples/loadables/Makefile.inc.in +++ b/examples/loadables/Makefile.inc.in @@ -1,7 +1,7 @@ # # Sample makefile for bash loadable builtin development # -# Copyright (C) 2015 Free Software Foundation, Inc. +# Copyright (C) 2015-2022 Free Software Foundation, Inc. # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -99,10 +99,3 @@ INC = -I$(headersdir) -I$(headersdir)/include -I$(headersdir)/builtins .c.o: $(SHOBJ_CC) $(SHOBJ_CFLAGS) $(CCFLAGS) $(INC) -c -o $@ $< - -all: example - -example: example.o - $(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ example.o $(SHOBJ_LIBS) - -example.o: example.c diff --git a/examples/loadables/Makefile.sample.in b/examples/loadables/Makefile.sample.in new file mode 100644 index 00000000..fe9b06ad --- /dev/null +++ b/examples/loadables/Makefile.sample.in @@ -0,0 +1,44 @@ +# +# Sample makefile for bash loadable builtin development +# +# Copyright (C) 2022 Free Software Foundation, Inc. + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + +# these should match the ones in Makefile.in (for the make install target) + +prefix = @prefix@ +exec_prefix = @exec_prefix@ +libdir = @libdir@ + +# ${loadablesdir} is where the example loadable builtins and data files +# are installed (make install target in Makefile.in) + +loadablesdir = @loadablesdir@ +DESTDIR = + +# include Makefile.inc for all boilerplate definitions + +include $(DESTDIR)$(loadablesdir)/Makefile.inc + +# here, `example' is the name of the shared object +# replace `example' with the appropriate filename + +all: example + +example: example.o + $(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ example.o $(SHOBJ_LIBS) + +example.o: example.c diff --git a/examples/loadables/print.c b/examples/loadables/print.c index 0120dbf4..d6c59035 100644 --- a/examples/loadables/print.c +++ b/examples/loadables/print.c @@ -181,7 +181,8 @@ printargs (list, ofp) for (sawc = 0, l = list; l; l = l->next) { ostr = ansicstr (l->word->word, strlen (l->word->word), 0, &sawc, (int *)0); - fprintf (ofp, "%s", ostr); + if (ostr) + fprintf (ofp, "%s", ostr); free (ostr); if (sawc) return (0); diff --git a/lib/readline/callback.c b/lib/readline/callback.c index 1a3235f1..69df77df 100644 --- a/lib/readline/callback.c +++ b/lib/readline/callback.c @@ -279,8 +279,11 @@ rl_callback_read_char (void) } /* Make sure application hooks can see whether we saw EOF. */ - if (rl_eof_found = eof) - RL_SETSTATE(RL_STATE_EOF); + if (eof > 0) + { + rl_eof_found = eof; + RL_SETSTATE(RL_STATE_EOF); + } if (rl_done) {