From b3d8c8a4e7c5417d986f93f646ea740cb13c08d7 Mon Sep 17 00:00:00 2001 From: Chet Ramey Date: Mon, 13 May 2024 11:36:34 -0400 Subject: [PATCH] change some error messages so the format string isn't the return value from gettext(); work around macos problem with gettext() in child processes; don't try to set tty state while running a trap; don't default to trying enable -f file if the shell is restricted; note that configure now supports --enable-year2038 --- CWRU/CWRU.chlog | 50 +++++++++++++++++++++++++++++++++++ bashhist.c | 2 +- builtins/bind.def | 2 +- builtins/common.c | 14 +++++----- builtins/enable.def | 4 +++ builtins/exec.def | 8 +++--- builtins/fc.def | 2 +- builtins/help.def | 2 +- builtins/mapfile.def | 4 +-- builtins/printf.def | 4 +-- builtins/read.def | 4 +-- builtins/source.def | 14 +++++++++- builtins/ulimit.def | 20 ++++++++------ doc/bash.1 | 31 +++++++++++++--------- execute_cmd.c | 20 ++++++++++++-- execute_cmd.h | 2 ++ jobs.c | 3 ++- lib/readline/doc/readline.3 | 21 ++++++++++----- lib/readline/doc/rluser.texi | 29 +++++++++++--------- lib/readline/doc/version.texi | 6 ++--- locale.c | 14 ++++++---- parse.y | 2 +- redir.c | 10 +++---- tests/comsub2.right | 8 +++--- tests/cond-regexp3.sub | 2 +- tests/glob2.sub | 2 +- 26 files changed, 197 insertions(+), 83 deletions(-) diff --git a/CWRU/CWRU.chlog b/CWRU/CWRU.chlog index 29791610..c7e7f024 100644 --- a/CWRU/CWRU.chlog +++ b/CWRU/CWRU.chlog @@ -9370,3 +9370,53 @@ bashline.c execute_cmd.c,shell.c,builtins/evalfile.c,unwind_prot.c - change some translated error messages to make the text more uniform and reduce the number of gettext() calls + +redir.c,parse.y,bashhist.c.locale.c +builtins/common.c,builtins/bind.def,builtins/exec.def,builtins/fc.def +builtins/help.def,builtins/mapfile.def,builtins/printf.def,builtins/read.def +builtins/ulimit.def + - change some error messages to avoid having the format be the return + value from gettext() to avoid clang complaints; simplified + translatable strings and made them more uniform by removing printf + formatting directives + +execute_cmd.c + - notfound_str: cache the translated version of "command not found" + so we can call gettext early on and work around a macOS misfeature + From a MacPorts ticket https://trac.macports.org/ticket/68638 + forwarded by Tom + - execute_disk_command: use notfound_str instead of calling gettext + every time a command isn't found + +execute_cmd.c,execute_cmd.h + - init_notfound_str: call gettext to initialize and translate + notfound_str + - execute_disk_command: call init_notfound_str before forking if it + hasn't been initialized + +locale.c + - set_default_locale_vars: after we set the appropriate values for the + locale shell variables, call init_notfound_str to force a call to + gettext() + +jobs.c + - wait_for: don't try to set the tty state if we're running a trap, + even if a process terminates due to a signal + + 5/7 + --- +builtins/enable.def + - enable_builtin: don't try to turn enable f into enable -f f if the + shell is restricted + + 5/11 + ---- + +doc/bash.1,lib/readline/doc/readline.3,lib/readline/doc/rltech.texi + - document some of the bindable commands bound to Home, End, Insert, + Page Up, and Page Down, if those keys exist + From a report by Xose Vazquez Perez in 3/2024 + +configure + - make sure to note in CHANGES that configure now supports + --enable-year-2038 for large time_t diff --git a/bashhist.c b/bashhist.c index fb9935f5..03971c44 100644 --- a/bashhist.c +++ b/bashhist.c @@ -461,7 +461,7 @@ maybe_append_history (char *filename) fd = open (filename, O_WRONLY|O_CREAT, 0600); if (fd < 0) { - builtin_error (_("%s: cannot create: %s"), filename, strerror (errno)); + builtin_error ("%s: %s: %s", filename, _("cannot create"), strerror (errno)); return (EXECUTION_FAILURE); } close (fd); diff --git a/builtins/bind.def b/builtins/bind.def index 3062c1c5..5f8a4743 100644 --- a/builtins/bind.def +++ b/builtins/bind.def @@ -274,7 +274,7 @@ bind_builtin (WORD_LIST *list) if (rl_read_init_file (initfile) != 0) { t = printable_filename (initfile, 0); - builtin_error (_("%s: cannot read: %s"), t, strerror (errno)); + builtin_error ("%s: %s: %s", t, _("cannot read"), strerror (errno)); if (t != initfile) free (t); BIND_RETURN (EXECUTION_FAILURE); diff --git a/builtins/common.c b/builtins/common.c index ed672342..789160ff 100644 --- a/builtins/common.c +++ b/builtins/common.c @@ -297,16 +297,16 @@ sh_wrerror (void) #if defined (DONT_REPORT_BROKEN_PIPE_WRITE_ERRORS) && defined (EPIPE) if (errno != EPIPE) #endif /* DONT_REPORT_BROKEN_PIPE_WRITE_ERRORS && EPIPE */ - builtin_error (_("write error: %s"), strerror (errno)); + builtin_error ("%s: %s", _("write error"), strerror (errno)); } void sh_ttyerror (int set) { if (set) - builtin_error (_("error setting terminal attributes: %s"), strerror (errno)); + builtin_error ("%s: %s", _("error setting terminal attributes"), strerror (errno)); else - builtin_error (_("error getting terminal attributes: %s"), strerror (errno)); + builtin_error ("%s: %s", _("error getting terminal attributes"), strerror (errno)); } int @@ -596,9 +596,11 @@ get_working_directory (const char *for_whom) #endif if (the_current_working_directory == 0) { - fprintf (stderr, _("%s: error retrieving current directory: %s: %s\n"), - (for_whom && *for_whom) ? for_whom : get_name_for_error (), - _(bash_getcwd_errstr), strerror (errno)); + fprintf (stderr, "%s: %s: %s: %s\n", + (for_whom && *for_whom) ? for_whom : get_name_for_error (), + _("error retrieving current directory"), + _(bash_getcwd_errstr), + strerror (errno)); return (char *)NULL; } } diff --git a/builtins/enable.def b/builtins/enable.def index 136884bf..075fc030 100644 --- a/builtins/enable.def +++ b/builtins/enable.def @@ -233,7 +233,11 @@ enable_builtin (WORD_LIST *list) #if defined (HAVE_DLOPEN) && defined (HAVE_DLSYM) /* If we try to enable a non-existent builtin, and we have dynamic loading, try the equivalent of `enable -f name name'. */ +#if defined (RESTRICTED_SHELL) + if (*command && (flags & NFLAG) == 0 && opt == EX_NOTFOUND && restricted == 0) +#else if (*command && (flags & NFLAG) == 0 && opt == EX_NOTFOUND) +#endif { int dflags, r; diff --git a/builtins/exec.def b/builtins/exec.def index fc7bc672..3ca7c4f8 100644 --- a/builtins/exec.def +++ b/builtins/exec.def @@ -1,7 +1,7 @@ This file is exec.def, from which is created exec.c. It implements the builtin "exec" in Bash. -Copyright (C) 1987-2021,2022 Free Software Foundation, Inc. +Copyright (C) 1987-2021,2022,2024 Free Software Foundation, Inc. This file is part of GNU Bash, the Bourne Again SHell. @@ -154,9 +154,9 @@ exec_builtin (WORD_LIST *list) if (file_isdir (args[0])) { #if defined (EISDIR) - builtin_error (_("%s: cannot execute: %s"), args[0], strerror (EISDIR)); + builtin_error ("%s: %s: %s", args[0], _("cannot execute"), strerror (EISDIR)); #else - builtin_error (_("%s: cannot execute: %s"), args[0], strerror (errno)); + builtin_error ("%s: %s: %s", args[0], _("cannot execute"), strerror (errno)); #endif exit_value = EX_NOEXEC; } @@ -242,7 +242,7 @@ exec_builtin (WORD_LIST *list) else if (executable_file (command) == 0) { errno = opt; - builtin_error (_("%s: cannot execute: %s"), command, strerror (errno)); + builtin_error ("%s: %s: %s", command, _("cannot execute"), strerror (errno)); exit_value = EX_NOEXEC; /* As per Posix.2, 3.14.6 */ } else diff --git a/builtins/fc.def b/builtins/fc.def index 17121037..1d88a49a 100644 --- a/builtins/fc.def +++ b/builtins/fc.def @@ -459,7 +459,7 @@ fc_builtin (WORD_LIST *list) stream = sh_mktmpfp ("bash-fc", MT_USERANDOM|MT_USETMPDIR, &fn); if (stream == 0) { - builtin_error (_("%s: cannot open temp file: %s"), fn ? fn : "", strerror (errno)); + builtin_error ("%s: %s: %s", fn ? fn : "", _("cannot open temp file"), strerror (errno)); FREE (fn); return (EXECUTION_FAILURE); } diff --git a/builtins/help.def b/builtins/help.def index 0831cab0..770ded01 100644 --- a/builtins/help.def +++ b/builtins/help.def @@ -211,7 +211,7 @@ open_helpfile (const char *name) fd = open (name, O_RDONLY); if (fd == -1) { - builtin_error (_("%s: cannot open: %s"), name, strerror (errno)); + builtin_error ("%s: %s: %s", name, _("cannot open"), strerror (errno)); return -1; } return fd; diff --git a/builtins/mapfile.def b/builtins/mapfile.def index 770d5e37..31528fa8 100644 --- a/builtins/mapfile.def +++ b/builtins/mapfile.def @@ -2,7 +2,7 @@ This file is mapfile.def, from which is created mapfile.c. It implements the builtin "mapfile" in Bash. Copyright (C) 2005-2006 Rocky Bernstein for Free Software Foundation, Inc. -Copyright (C) 2008-2023 Free Software Foundation, Inc. +Copyright (C) 2008-2024 Free Software Foundation, Inc. This file is part of GNU Bash, the Bourne Again SHell. @@ -254,7 +254,7 @@ mapfile_builtin (WORD_LIST *list) if (sh_validfd (fd) == 0) { - builtin_error (_("%d: invalid file descriptor: %s"), fd, strerror (errno)); + builtin_error ("%d: %s: %s", fd, _("invalid file descriptor"), strerror (errno)); return (EXECUTION_FAILURE); } break; diff --git a/builtins/printf.def b/builtins/printf.def index 476cc1c9..2a985031 100644 --- a/builtins/printf.def +++ b/builtins/printf.def @@ -700,7 +700,7 @@ printf_builtin (WORD_LIST *list) /* check for string length overflow when adjusting precision */ if (ckd_add (&precision, slen, 0)) { - builtin_error (_("%%Q: string length: %s"), strerror (ERANGE)); + builtin_error ("%%Q: %s %s", _("string length"), strerror (ERANGE)); precision = -1; } } @@ -825,7 +825,7 @@ printf_builtin (WORD_LIST *list) static inline void printf_erange (char *s) { - builtin_error (_("%s: %s"), s, strerror(ERANGE)); + builtin_error ("%s: %s", s, strerror(ERANGE)); conversion_error = 1; } diff --git a/builtins/read.def b/builtins/read.def index 28491d30..35b71967 100644 --- a/builtins/read.def +++ b/builtins/read.def @@ -363,7 +363,7 @@ read_builtin (WORD_LIST *list) fd = intval; if (sh_validfd (fd) == 0) { - builtin_error (_("%d: invalid file descriptor: %s"), fd, strerror (errno)); + builtin_error ("%d: %s: %s", fd, _("invalid file descriptor"), strerror (errno)); return (EXECUTION_FAILURE); } break; @@ -865,7 +865,7 @@ add_char: { t_errno = errno; if (errno != EINTR) - builtin_error (_("read error: %d: %s"), fd, strerror (errno)); + builtin_error ("%d: %s: %s", fd, _("read error"), strerror (errno)); run_unwind_frame ("read_builtin"); return ((t_errno != EINTR) ? EXECUTION_FAILURE : 128+lastsig); } diff --git a/builtins/source.def b/builtins/source.def index b68d16a5..51dddec6 100644 --- a/builtins/source.def +++ b/builtins/source.def @@ -144,7 +144,19 @@ source_builtin (WORD_LIST *list) else if (absolute_pathname (list->word->word)) filename = savestring (list->word->word); else if (source_uses_path) - filename = find_path_file (list->word->word); + { +#if 0 + char *spath; +#if defined (RESTRICTED_SHELL) + if (restricted == 0 && posixly_correct == 0 && (spath = path_value ("BASH_SOURCE_PATH", 1))) +#else + if (posixly_correct == 0 && (spath = path_value ("BASH_SOURCE_PATH", 1))) +#endif + filename = find_in_path (list->word->word, spath, FS_READABLE); + else +#endif + filename = find_path_file (list->word->word); + } if (filename == 0) { if (source_searches_cwd == 0) diff --git a/builtins/ulimit.def b/builtins/ulimit.def index 316d0ec3..b5c7529a 100644 --- a/builtins/ulimit.def +++ b/builtins/ulimit.def @@ -456,8 +456,9 @@ ulimit_internal (int cmd, char *cmdarg, int mode, int multiple) opt = get_limit (limind, &soft_limit, &hard_limit); if (opt < 0) { - builtin_error (_("%s: cannot get limit: %s"), limits[limind].description, - strerror (errno)); + builtin_error ("%s: %s: %s", limits[limind].description, + _("cannot get limit"), + strerror (errno)); return (EXECUTION_FAILURE); } @@ -501,8 +502,9 @@ ulimit_internal (int cmd, char *cmdarg, int mode, int multiple) if (set_limit (limind, real_limit, mode) < 0) { - builtin_error (_("%s: cannot modify limit: %s"), limits[limind].description, - strerror (errno)); + builtin_error ("%s: %s: %s", limits[limind].description, + _("cannot modify limit"), + strerror (errno)); return (EXECUTION_FAILURE); } @@ -724,8 +726,9 @@ print_all_limits (int mode) if (get_limit (i, &softlim, &hardlim) == 0) printone (i, (mode & LIMIT_SOFT) ? softlim : hardlim, 1); else if (errno != EINVAL) - builtin_error ("%s: cannot get limit: %s", limits[i].description, - strerror (errno)); + builtin_error ("%s: %s: %s", limits[i].description, + _("cannot get limit"), + strerror (errno)); } } @@ -787,8 +790,9 @@ set_all_limits (int mode, RLIMTYPE newlim) for (retval = i = 0; limits[i].option > 0; i++) if (set_limit (i, newlim, mode) < 0) { - builtin_error (_("%s: cannot modify limit: %s"), limits[i].description, - strerror (errno)); + builtin_error ("%s: %s: %s", limits[i].description, + _("cannot modify limit"), + strerror (errno)); retval = 1; } return retval; diff --git a/doc/bash.1 b/doc/bash.1 index 0e21f409..f60d090e 100644 --- a/doc/bash.1 +++ b/doc/bash.1 @@ -5,14 +5,14 @@ .\" Case Western Reserve University .\" chet.ramey@case.edu .\" -.\" Last Change: Tue Apr 23 15:08:01 EDT 2024 +.\" Last Change: Sat May 11 12:44:30 EDT 2024 .\" .\" bash_builtins, strip all but Built-Ins section .\" avoid a warning about an undefined register .\" .if !rzY .nr zY 0 .if \n(zZ=1 .ig zZ .if \n(zY=1 .ig zY -.TH BASH 1 "2024 April 23" "GNU Bash 5.3" +.TH BASH 1 "2024 May 11" "GNU Bash 5.3" .\" .ie \n(.g \{\ .ds ' \(aq @@ -6739,9 +6739,11 @@ The text between the point and mark is referred to as the \fIregion\fP. .TP .B beginning\-of\-line (C\-a) Move to the start of the current line. +This may also be bound to the Home key on some keyboards. .TP .B end\-of\-line (C\-e) Move to the end of the line. +This may also be bound to the End key on some keyboards. .TP .B forward\-char (C\-f) Move forward a character. @@ -6851,15 +6853,17 @@ using a non-incremental search for a string supplied by the user. Search forward through the history using a non-incremental search for a string supplied by the user. .TP -.B history\-search\-forward -Search forward through the history for the string of characters -between the start of the current line and the point. -This is a non-incremental search. -.TP .B history\-search\-backward Search backward through the history for the string of characters between the start of the current line and the point. This is a non-incremental search. +This may be bound to the Page Up key on some keyboards. +.TP +.B history\-search\-forward +Search forward through the history for the string of characters +between the start of the current line and the point. +This is a non-incremental search. +This may be bound to the Page Down key on some keyboards. .TP .B history\-substring\-search\-backward Search backward through the history for the string of characters @@ -7016,15 +7020,18 @@ Capitalize the current (or following) word. With a negative argument, capitalize the previous word, but do not move point. .TP .B overwrite\-mode -Toggle overwrite mode. With an explicit positive numeric argument, -switches to overwrite mode. With an explicit non-positive numeric -argument, switches to insert mode. This command affects only -\fBemacs\fP mode; \fBvi\fP mode does overwrite differently. +Toggle overwrite mode. +With an explicit positive numeric argument, switches to overwrite mode. +With an explicit non-positive numeric argument, switches to insert mode. +This command affects only \fBemacs\fP mode; +\fBvi\fP mode does overwrite differently. Each call to \fIreadline()\fP starts in insert mode. In overwrite mode, characters bound to \fBself\-insert\fP replace the text at point rather than pushing the text to the right. Characters bound to \fBbackward\-delete\-char\fP replace the character -before point with a space. By default, this command is unbound. +before point with a space. +By default, this command is unbound, +but may be bound to the Insert key on some keyboards. .PD .SS Killing and Yanking .PD 0 diff --git a/execute_cmd.c b/execute_cmd.c index 8a5e43c3..64939fc7 100644 --- a/execute_cmd.c +++ b/execute_cmd.c @@ -261,6 +261,12 @@ int subshell_level = 0; /* Currently-executing shell function. */ SHELL_VAR *this_shell_function; +/* Translated message printed when a command is not found. We declare it here + and initialize it in locale.c to work around a macOS bug that forces a + crash if bash calls setlocale(3) but does not call gettext(3) before + forking, then calls gettext() after forking. */ +char *notfound_str = 0; + /* If non-zero, matches in case and [[ ... ]] are case-insensitive */ int match_ignore_case = 0; @@ -584,7 +590,7 @@ async_redirect_stdin (void) close (fd); } else if (fd < 0) - internal_error (_("cannot redirect standard input from /dev/null: %s"), strerror (errno)); + internal_error ("%s: %s", _("cannot redirect standard input from /dev/null"), strerror (errno)); } #define DESCRIBE_PID(pid) do { if (interactive) describe_pid (pid); } while (0) @@ -5702,6 +5708,14 @@ setup_async_signals (void) NOTE: callers expect this to fork or exit(). */ +/* See comment above where notfound_str is declared. */ +void +init_notfound_str (void) +{ + if (notfound_str == 0) + notfound_str = _("command not found"); +} + /* Name of a shell function to call when a command name is not found. */ #ifndef NOTFOUND_HOOK # define NOTFOUND_HOOK "command_not_found_handle" @@ -5759,6 +5773,8 @@ execute_disk_command (WORD_LIST *words, REDIRECT *redirects, char *command_line, maybe_make_export_env (); put_command_name_into_env (command); } + else if (command == 0 && notfound_str == 0) /* make sure */ + init_notfound_str (); /* We have to make the child before we check for the non-existence of COMMAND, since we want the error messages to be redirected. */ @@ -5845,7 +5861,7 @@ execute_disk_command (WORD_LIST *words, REDIRECT *redirects, char *command_line, { /* Make sure filenames are displayed using printable characters */ pathname = printable_filename (pathname, 0); - internal_error (_("%s: command not found"), pathname); + internal_error ("%s: %s", pathname, notfound_str); exit (EX_NOTFOUND); /* Posix.2 says the exit status is 127 */ } diff --git a/execute_cmd.h b/execute_cmd.h index 981e94a1..cd2bad86 100644 --- a/execute_cmd.h +++ b/execute_cmd.h @@ -134,4 +134,6 @@ extern void bind_lastarg (char *); extern void uw_dispose_fd_bitmap (void *); extern void uw_close (void *); +extern void init_notfound_str (void); + #endif /* _EXECUTE_CMD_H_ */ diff --git a/jobs.c b/jobs.c index 63082cfe..fb94426e 100644 --- a/jobs.c +++ b/jobs.c @@ -3151,7 +3151,8 @@ if (job == NO_JOB) if (WIFSIGNALED (s) || WIFSTOPPED (s)) { - set_tty_state (); + if (running_trap == 0 /* || WIFSTOPPED (s) */) + set_tty_state (); /* If the current job was stopped or killed by a signal, and the user has requested it, get a possibly new window size */ diff --git a/lib/readline/doc/readline.3 b/lib/readline/doc/readline.3 index b5ca022e..b36333d3 100644 --- a/lib/readline/doc/readline.3 +++ b/lib/readline/doc/readline.3 @@ -6,9 +6,9 @@ .\" Case Western Reserve University .\" chet.ramey@case.edu .\" -.\" Last Change: Fri Mar 29 11:54:44 EDT 2024 +.\" Last Change: Sat May 11 12:44:56 EDT 2024 .\" -.TH READLINE 3 "2024 March 29" "GNU Readline 8.3" +.TH READLINE 3 "2024 May 11" "GNU Readline 8.3" .\" .ie \n(.g \{\ .ds ' \(aq @@ -895,9 +895,11 @@ The text between the point and mark is referred to as the \fIregion\fP. .TP .B beginning\-of\-line (C\-a) Move to the start of the current line. +This may also be bound to the Home key on some keyboards. .TP .B end\-of\-line (C\-e) Move to the end of the line. +This may also be bound to the End key on some keyboards. .TP .B forward\-char (C\-f) Move forward a character. @@ -1007,12 +1009,14 @@ between the start of the current line and the current cursor position (the \fIpoint\fP). The search string must match at the beginning of a history line. This is a non-incremental search. +This may be bound to the Page Up key on some keyboards. .TP .B history\-search\-forward Search forward through the history for the string of characters between the start of the current line and the point. The search string must match at the beginning of a history line. This is a non-incremental search. +This may be bound to the Page Down key on some keyboards. .TP .B history\-substring\-search\-backward Search backward through the history for the string of characters @@ -1119,15 +1123,18 @@ Capitalize the current (or following) word. With a negative argument, capitalize the previous word, but do not move point. .TP .B overwrite\-mode -Toggle overwrite mode. With an explicit positive numeric argument, -switches to overwrite mode. With an explicit non-positive numeric -argument, switches to insert mode. This command affects only -\fBemacs\fP mode; \fBvi\fP mode does overwrite differently. +Toggle overwrite mode. +With an explicit positive numeric argument, switches to overwrite mode. +With an explicit non-positive numeric argument, switches to insert mode. +This command affects only \fBemacs\fP mode; +\fBvi\fP mode does overwrite differently. Each call to \fIreadline()\fP starts in insert mode. In overwrite mode, characters bound to \fBself\-insert\fP replace the text at point rather than pushing the text to the right. Characters bound to \fBbackward\-delete\-char\fP replace the character -before point with a space. By default, this command is unbound. +before point with a space. +By default, this command is unbound, +but may be bound to the Insert key on some keyboards. .PD .SS Killing and Yanking .PD 0 diff --git a/lib/readline/doc/rluser.texi b/lib/readline/doc/rluser.texi index 45e8a85d..bc57ccf7 100644 --- a/lib/readline/doc/rluser.texi +++ b/lib/readline/doc/rluser.texi @@ -1229,9 +1229,11 @@ The text between the point and mark is referred to as the @dfn{region}. @ftable @code @item beginning-of-line (C-a) Move to the start of the current line. +This may also be bound to the Home key on some keyboards. @item end-of-line (C-e) Move to the end of the line. +This may also be bound to the End key on some keyboards. @item forward-char (C-f) Move forward a character. @@ -1342,29 +1344,31 @@ through the history as necessary using a non-incremental search for a string supplied by the user. The search string may match anywhere in a history line. -@item history-search-forward () -Search forward through the history for the string of characters -between the start of the current line and the point. -The search string must match at the beginning of a history line. -This is a non-incremental search. -By default, this command is unbound. - @item history-search-backward () Search backward through the history for the string of characters between the start of the current line and the point. The search string must match at the beginning of a history line. This is a non-incremental search. -By default, this command is unbound. +By default, this command is unbound, but may be bound to the Page Down +key on some keyboards. -@item history-substring-search-forward () +@item history-search-forward () Search forward through the history for the string of characters between the start of the current line and the point. +The search string must match at the beginning of a history line. +This is a non-incremental search. +By default, this command is unbound, but may be bound to the Page Up +key on some keyboards. + +@item history-substring-search-backward () +Search backward through the history for the string of characters +between the start of the current line and the point. The search string may match anywhere in a history line. This is a non-incremental search. By default, this command is unbound. -@item history-substring-search-backward () -Search backward through the history for the string of characters +@item history-substring-search-forward () +Search forward through the history for the string of characters between the start of the current line and the point. The search string may match anywhere in a history line. This is a non-incremental search. @@ -1506,7 +1510,8 @@ the text at point rather than pushing the text to the right. Characters bound to @code{backward-delete-char} replace the character before point with a space. -By default, this command is unbound. +By default, this command is unbound, but may be bound to the Insert +key on some keyboards. @end ftable diff --git a/lib/readline/doc/version.texi b/lib/readline/doc/version.texi index 9c820a91..9c8540c9 100644 --- a/lib/readline/doc/version.texi +++ b/lib/readline/doc/version.texi @@ -5,7 +5,7 @@ Copyright (C) 1988-2024 Free Software Foundation, Inc. @set EDITION 8.3 @set VERSION 8.3 -@set UPDATED 19 January 2024 -@set UPDATED-MONTH January 2024 +@set UPDATED 11 May 2024 +@set UPDATED-MONTH May 2024 -@set LASTCHANGE Fri Jan 19 11:01:44 EST 2024 +@set LASTCHANGE Sat May 11 12:41:28 EDT 2024 diff --git a/locale.c b/locale.c index bf4001d1..5be40295 100644 --- a/locale.c +++ b/locale.c @@ -1,6 +1,6 @@ /* locale.c - Miscellaneous internationalization functions. */ -/* Copyright (C) 1996-2009,2012,2016-2023 Free Software Foundation, Inc. +/* Copyright (C) 1996-2009,2012,2016-2024 Free Software Foundation, Inc. This file is part of GNU Bash, the Bourne Again SHell. @@ -47,6 +47,8 @@ extern int errno; extern const char *locale_charset (void); #endif +extern void init_notfound_str (void); /* from execute_cmd.c */ + extern int dump_translatable_strings, dump_po_strings; int locale_utf8locale; @@ -173,6 +175,8 @@ set_default_locale_vars (void) if (default_domain && *default_domain) bindtextdomain (default_domain, default_dir); } + + init_notfound_str (); /* force a gettext call early on */ } /* Set one of the locale categories (specified by VAR) to VALUE. Returns 1 @@ -219,9 +223,9 @@ set_locale_var (const char *var, const char *value) if (x == 0) { if (errno == 0) - internal_warning(_("setlocale: LC_ALL: cannot change locale (%s)"), lc_all); + internal_warning ("setlocale: LC_ALL: %s (%s)", _("cannot change locale"), lc_all); else - internal_warning(_("setlocale: LC_ALL: cannot change locale (%s): %s"), lc_all, strerror (errno)); + internal_warning ("setlocale: LC_ALL: %s (%s): %s", _("cannot change locale"), lc_all, strerror (errno)); } locale_mb_cur_max = MB_CUR_MAX; /* if LC_ALL == "", reset_locale_vars has already called this */ @@ -294,9 +298,9 @@ set_locale_var (const char *var, const char *value) if (x == 0) { if (errno == 0) - internal_warning(_("setlocale: %s: cannot change locale (%s)"), var, get_locale_var (var)); + internal_warning("setlocale: %s: %s (%s)", var, _("cannot change locale"), get_locale_var (var)); else - internal_warning(_("setlocale: %s: cannot change locale (%s): %s"), var, get_locale_var (var), strerror (errno)); + internal_warning("setlocale: %s: %s (%s): %s", var, _("cannot change locale"), get_locale_var (var), strerror (errno)); } return (x != 0); diff --git a/parse.y b/parse.y index d232481d..1349480b 100644 --- a/parse.y +++ b/parse.y @@ -2807,7 +2807,7 @@ pop_alias: else if (uc == 0 && shell_input_line_terminator == READERR) { #if defined (FATAL_READERROR) - report_error (_("script file read error: %s"), strerror (errno)); + report_error ("%s: %s", _("script file read error"), strerror (errno)); exit_shell (128); /* POSIX mandated error status */ #else /* Treat read errors like EOF here. */ diff --git a/redir.c b/redir.c index a073cfda..37b470da 100644 --- a/redir.c +++ b/redir.c @@ -197,25 +197,25 @@ redirection_error (REDIRECT *temp, int error, char *fn) switch (error) { case AMBIGUOUS_REDIRECT: - internal_error (_("%s: ambiguous redirect"), filename); + internal_error ("%s: %s", filename, _("ambiguous redirect")); break; case NOCLOBBER_REDIRECT: - internal_error (_("%s: cannot overwrite existing file"), filename); + internal_error ("%s: %s", filename, _("cannot overwrite existing file")); break; #if defined (RESTRICTED_SHELL) case RESTRICTED_REDIRECT: - internal_error (_("%s: restricted: cannot redirect output"), filename); + internal_error ("%s: %s", filename, _("restricted: cannot redirect output")); break; #endif /* RESTRICTED_SHELL */ case HEREDOC_REDIRECT: - internal_error (_("cannot create temp file for here-document: %s"), strerror (heredoc_errno)); + internal_error ("%s: %s", _("cannot create temp file for here-document"), strerror (heredoc_errno)); break; case BADVAR_REDIRECT: - internal_error (_("%s: cannot assign fd to variable"), filename); + internal_error ("%s: %s", filename, _("cannot assign fd to variable")); break; default: diff --git a/tests/comsub2.right b/tests/comsub2.right index 3588cca7..1f9a3e2a 100644 --- a/tests/comsub2.right +++ b/tests/comsub2.right @@ -86,10 +86,10 @@ outside before: value declare -a a=([0]="1" [1]="2" [2]="3" [3]="4") declare -- int="2" after here-doc: 1 -[1]- Running sleep 1 & -[2]+ Running sleep 1 & -[1]- Running sleep 1 & -[2]+ Running sleep 1 & +[1]- Running sleep 1 & +[2]+ Running sleep 1 & +[1]- Running sleep 1 & +[2]+ Running sleep 1 & 17772 26794 17772 26794 we should try rhs diff --git a/tests/cond-regexp3.sub b/tests/cond-regexp3.sub index d939548c..6c432d68 100644 --- a/tests/cond-regexp3.sub +++ b/tests/cond-regexp3.sub @@ -58,7 +58,7 @@ done [[ x =~ \\x ]] ; echo $? bs='\' -[[ x =~ ${bs}x ]] ; echo $? +[[ '\[' =~ ${bs}[ ]] ; echo $? [[ x =~ $'\\'x ]] ; echo $? [[ x =~ '\'x ]] ; echo $? diff --git a/tests/glob2.sub b/tests/glob2.sub index 7425ea4a..0e0482dc 100644 --- a/tests/glob2.sub +++ b/tests/glob2.sub @@ -18,7 +18,7 @@ if locale -a | grep -i '^zh_TW\.big5' >/dev/null ; then : else echo "glob2.sub: warning: you do not have the zh_TW.big5 locale installed;" >&2 - echo "glob2.sub: warning: that will cause some of these tests to fail." >&2 + echo "glob2.sub: warning: that may cause some of these tests to fail." >&2 fi var='ab\'