mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-08-01 07:53:38 +02:00
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
This commit is contained in:
+1
-1
@@ -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);
|
||||
|
||||
+8
-6
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
+4
-4
@@ -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
|
||||
|
||||
+1
-1
@@ -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);
|
||||
}
|
||||
|
||||
+1
-1
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
+2
-2
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -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);
|
||||
}
|
||||
|
||||
+13
-1
@@ -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)
|
||||
|
||||
+12
-8
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user