mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-07-03 02:10:50 +02:00
read builtin fixes for CHERI environment; use CLOCK_GETTIME in gettimeofday replacement; readline fix to not optimize typeahead while defining a keyboard macro; fix for crash with unset nameref variable; make sure to save currently executing command around running DEBUG trap
This commit is contained in:
@@ -11938,3 +11938,49 @@ builtins/read.def
|
||||
- read_builtin: check whether `delim' is not a newline before calling
|
||||
check_read_input
|
||||
Report from pourko2@tutamail.com
|
||||
|
||||
builtins/read.def
|
||||
- read_builtin: CHERI systems require that we update the unwind-protect
|
||||
after every xrealloc, not just if the pointer changes
|
||||
From https://savannah.gnu.org/bugs/?67586
|
||||
|
||||
10/7
|
||||
----
|
||||
doc/bash.1,lib/readline/doc/readline.3,lib/readline/doc/history.3
|
||||
- remove mention of Usenet and gnu.bash.bug. End of an era.
|
||||
|
||||
lib/sh/gettimeofday.c
|
||||
- gettimeofday: if we're replacing this function on a non-Windows
|
||||
system, prefer clock_gettime (CLOCK_REALTIME, ...) if it's available
|
||||
instead of just filling in the seconds from time(3)
|
||||
|
||||
10/9
|
||||
----
|
||||
lib/readline/text.c
|
||||
- rl_insert: don't try to optimize runs of typeahead characters if we
|
||||
are defining a keyboard macro
|
||||
Report and patch from Grisha Levit <grishalevit@gmail.com>
|
||||
|
||||
10/12
|
||||
-----
|
||||
variables.c
|
||||
- make_variable_value: make sure to check whether VALUE is non-NULL
|
||||
before trying to strdup it; not all callers check
|
||||
Report from Александр Ушаков <anushakov@edu.hse.ru>
|
||||
|
||||
10/13riable`
|
||||
-----
|
||||
builtins/declare.def
|
||||
- declare_internal: if we are trying to set the attributes or value
|
||||
for an unset nameref variable (attributes but no value), allow
|
||||
the attribute or value setting to happen on the nameref, and don't
|
||||
destroy the nameref variable on an assignment error
|
||||
Report from Александр Ушаков <anushakov@edu.hse.ru>
|
||||
|
||||
execute_cmd.c
|
||||
- execute_for_command,eval_arith_for_expr,execute_select_command,
|
||||
execute_case_command,execute_arith_command,execute_cond_command,
|
||||
execute_simple_command: save and restore currently_executing_command
|
||||
around calls to run_debug_trap the same way we do it for
|
||||
run_return_trap
|
||||
Report from Александр Ушаков <anushakov@edu.hse.ru>
|
||||
|
||||
+13
-2
@@ -775,10 +775,21 @@ restart_new_var_name:
|
||||
*/
|
||||
if (var == 0 && (mkglobal || flags_on || flags_off || offset))
|
||||
{
|
||||
refvar = mkglobal ? find_global_variable_last_nameref (name, 0) : find_variable_last_nameref (name, 0);
|
||||
refvar = mkglobal ? find_global_variable_last_nameref (name, 1) : find_variable_last_nameref (name, 1);
|
||||
if (refvar && nameref_p (refvar) == 0)
|
||||
refvar = 0;
|
||||
if (refvar)
|
||||
/* If we are trying to set attributes for an unset nameref variable,
|
||||
we have a couple of choices: we can set the attributes on the
|
||||
nameref itself, or we can remove the nameref attribute from the
|
||||
variable and treat it as an unset variable with the new
|
||||
attribute(s). The former is what bash has traditionally done; the
|
||||
latter is what ksh93 does. */
|
||||
if (refvar && nameref_cell (refvar) == 0)
|
||||
{
|
||||
var = refvar;
|
||||
refvar = 0;
|
||||
}
|
||||
if (refvar && nameref_cell (refvar))
|
||||
var = declare_find_variable (nameref_cell (refvar), mkglobal, 0);
|
||||
if (refvar && var == 0)
|
||||
{
|
||||
|
||||
@@ -525,7 +525,7 @@ extract_info (char *filename, FILE *structfile, FILE *externfile)
|
||||
if (stat (filename, &finfo) == -1)
|
||||
file_error (filename);
|
||||
|
||||
fd = open (filename, O_RDONLY, 0666);
|
||||
fd = open (filename, O_RDONLY);
|
||||
|
||||
if (fd == -1)
|
||||
file_error (filename);
|
||||
|
||||
@@ -817,7 +817,9 @@ read_builtin (WORD_LIST *list)
|
||||
x = (char *)xrealloc (input_string, size += 128);
|
||||
|
||||
/* Only need to change unwind-protect if input_string changes */
|
||||
#ifndef __CHERI_PURE_CAPABILITY__
|
||||
if (x != input_string)
|
||||
#endif
|
||||
{
|
||||
input_string = x;
|
||||
remove_unwind_protect ();
|
||||
|
||||
+10
-13
@@ -7514,8 +7514,8 @@ BBUUGG RREEPPOORRTTSS
|
||||
Once you have determined that a bug actually exists, use the _b_a_s_h_b_u_g
|
||||
command to submit a bug report. If you have a fix, you are encouraged
|
||||
to mail that as well! You may send suggestions and "philosophical" bug
|
||||
reports to <bug-bash@gnu.org> or post them to the Usenet newsgroup ggnnuu
|
||||
..bbaasshh..bbuugg.
|
||||
reports, as well as comments and bug reports concerning this manual
|
||||
page, to to <bug-bash@gnu.org>.
|
||||
|
||||
_A_l_l bug reports should include:
|
||||
|
||||
@@ -7534,26 +7534,23 @@ BBUUGG RREEPPOORRTTSS
|
||||
_b_a_s_h_b_u_g inserts the first three items automatically into the template
|
||||
it provides for filing a bug report.
|
||||
|
||||
Please send comments and bug reports concerning this manual page to
|
||||
<bug-bash@gnu.org>.
|
||||
|
||||
BBUUGGSS
|
||||
It's too big and too slow.
|
||||
|
||||
There are some subtle differences between bbaasshh and historical versions
|
||||
of sshh, due mostly to bbaasshh's independent implementation and the evolu-
|
||||
There are some subtle differences between bbaasshh and historical versions
|
||||
of sshh, due mostly to bbaasshh's independent implementation and the evolu-
|
||||
tion of the POSIX specification.
|
||||
|
||||
Aliases are confusing in some uses.
|
||||
|
||||
Shell builtin commands and functions are not stoppable/restartable.
|
||||
|
||||
Compound commands and command lists of the form "a ; b ; c" are not
|
||||
handled gracefully when combined with process suspension. When a
|
||||
process is stopped, the shell immediately executes the next command in
|
||||
the list or breaks out of any existing loops. It suffices to enclose
|
||||
the command in parentheses to force it into a subshell, which may be
|
||||
stopped as a unit, or to start the command in the background and imme-
|
||||
Compound commands and command lists of the form "a ; b ; c" are not
|
||||
handled gracefully when combined with process suspension. When a
|
||||
process is stopped, the shell immediately executes the next command in
|
||||
the list or breaks out of any existing loops. It suffices to enclose
|
||||
the command in parentheses to force it into a subshell, which may be
|
||||
stopped as a unit, or to start the command in the background and imme-
|
||||
diately bring it into the foreground.
|
||||
|
||||
Array variables may not (yet) be exported.
|
||||
|
||||
+5
-11
@@ -13562,13 +13562,12 @@ command to submit a bug report.
|
||||
If you have a fix, you are encouraged to mail that as well!
|
||||
You may send suggestions and
|
||||
.Q philosophical
|
||||
bug reports to
|
||||
bug reports,
|
||||
as well as comments and bug reports concerning this manual page,
|
||||
to
|
||||
to
|
||||
.MT bug\-bash@\*:gnu\*:.org
|
||||
.ME
|
||||
or post them to the
|
||||
Usenet
|
||||
newsgroup
|
||||
.BR gnu\*:.bash\*:.bug .
|
||||
.ME .
|
||||
.PP
|
||||
.I All
|
||||
bug reports should include:
|
||||
@@ -13626,11 +13625,6 @@ exercising the unexpected behavior.
|
||||
.I bashbug
|
||||
inserts the first three items automatically into the template
|
||||
it provides for filing a bug report.
|
||||
.PP
|
||||
Please send comments and bug reports concerning
|
||||
this manual page to
|
||||
.MT bug\-bash@\*:gnu\*:.org
|
||||
.ME .
|
||||
.SH BUGS
|
||||
It's too big and too slow.
|
||||
.PP
|
||||
|
||||
+5
-8
@@ -1,5 +1,5 @@
|
||||
<!-- Creator : groff version 1.23.0 -->
|
||||
<!-- CreationDate: Mon Oct 6 15:30:30 2025 -->
|
||||
<!-- CreationDate: Tue Oct 7 10:14:01 2025 -->
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
|
||||
"http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
@@ -16375,9 +16375,10 @@ and
|
||||
determined that a bug actually exists, use the
|
||||
<i>bashbug</i> command to submit a bug report. If you have a
|
||||
fix, you are encouraged to mail that as well! You may send
|
||||
suggestions and “philosophical” bug reports to
|
||||
<a href="mailto:bug-bash@gnu.org">bug-bash@gnu.org</a> or
|
||||
post them to the Usenet newsgroup <b>gnu.bash.bug</b>.</p>
|
||||
suggestions and “philosophical” bug reports, as
|
||||
well as comments and bug reports concerning this manual
|
||||
page, to to
|
||||
<a href="mailto:bug-bash@gnu.org">bug-bash@gnu.org</a>.</p>
|
||||
|
||||
<p style="margin-left:9%; margin-top: 1em"><i>All</i> bug
|
||||
reports should include:</p>
|
||||
@@ -16506,10 +16507,6 @@ the unexpected behavior.</p></td>
|
||||
inserts the first three items automatically into the
|
||||
template it provides for filing a bug report.</p>
|
||||
|
||||
<p style="margin-left:9%; margin-top: 1em">Please send
|
||||
comments and bug reports concerning this manual page to
|
||||
<a href="mailto:bug-bash@gnu.org">bug-bash@gnu.org</a>.</p>
|
||||
|
||||
<h2>BUGS
|
||||
<a name="BUGS"></a>
|
||||
</h2>
|
||||
|
||||
Binary file not shown.
@@ -84,7 +84,7 @@ cat_main (int argc, char **argv)
|
||||
fd = 0;
|
||||
closefd = 0;
|
||||
} else {
|
||||
fd = open(argv[i], O_RDONLY, 0666);
|
||||
fd = open(argv[i], O_RDONLY);
|
||||
if (fd < 0) {
|
||||
s = strerror(errno);
|
||||
write(2, "cat: cannot open ", 17);
|
||||
|
||||
+29
-2
@@ -3022,6 +3022,7 @@ execute_for_command (FOR_COM *for_command)
|
||||
{
|
||||
WORD_LIST *releaser, *list;
|
||||
SHELL_VAR *v;
|
||||
COMMAND *save_current;
|
||||
char *identifier;
|
||||
int retval, save_line_number;
|
||||
#if 0
|
||||
@@ -3081,7 +3082,10 @@ execute_for_command (FOR_COM *for_command)
|
||||
the_printed_command_except_trap = savestring (the_printed_command);
|
||||
}
|
||||
|
||||
save_current = currently_executing_command;
|
||||
retval = run_debug_trap ();
|
||||
currently_executing_command = save_current;
|
||||
|
||||
#if defined (DEBUGGER)
|
||||
/* In debugging mode, if the DEBUG trap returns a non-zero status, we
|
||||
skip the command. */
|
||||
@@ -3188,6 +3192,7 @@ eval_arith_for_expr (WORD_LIST *l, int *okp)
|
||||
intmax_t expresult;
|
||||
int r, eflag;
|
||||
char *expr, *temp;
|
||||
COMMAND *save_current;
|
||||
|
||||
expr = l->next ? string_list (l) : l->word->word;
|
||||
temp = expand_arith_string (expr, Q_DOUBLE_QUOTES|Q_ARITH);
|
||||
@@ -3206,7 +3211,10 @@ eval_arith_for_expr (WORD_LIST *l, int *okp)
|
||||
the_printed_command_except_trap = savestring (the_printed_command);
|
||||
}
|
||||
|
||||
save_current = currently_executing_command;
|
||||
r = run_debug_trap ();
|
||||
currently_executing_command = save_current;
|
||||
|
||||
#if defined (DEBUGGER)
|
||||
/* In debugging mode, if the DEBUG trap returns a non-zero status, we
|
||||
skip the command. */
|
||||
@@ -3499,6 +3507,7 @@ execute_select_command (SELECT_COM *select_command)
|
||||
SHELL_VAR *v;
|
||||
char *identifier, *ps3_prompt, *selection;
|
||||
int retval, list_len, show_menu, save_line_number;
|
||||
COMMAND *save_current;
|
||||
|
||||
if (check_identifier (select_command->name, 1) == 0)
|
||||
{
|
||||
@@ -3526,7 +3535,10 @@ execute_select_command (SELECT_COM *select_command)
|
||||
the_printed_command_except_trap = savestring (the_printed_command);
|
||||
}
|
||||
|
||||
save_current = currently_executing_command;
|
||||
retval = run_debug_trap ();
|
||||
currently_executing_command = save_current;
|
||||
|
||||
#if defined (DEBUGGER)
|
||||
/* In debugging mode, if the DEBUG trap returns a non-zero status, we
|
||||
skip the command. */
|
||||
@@ -3640,6 +3652,7 @@ execute_case_command (CASE_COM *case_command)
|
||||
PATTERN_LIST *clauses;
|
||||
char *word, *pattern;
|
||||
int retval, match, ignore_return, save_line_number, qflags;
|
||||
COMMAND *save_current;
|
||||
|
||||
save_line_number = line_number;
|
||||
line_number = case_command->line;
|
||||
@@ -3657,7 +3670,10 @@ execute_case_command (CASE_COM *case_command)
|
||||
the_printed_command_except_trap = savestring (the_printed_command);
|
||||
}
|
||||
|
||||
save_current = currently_executing_command;
|
||||
retval = run_debug_trap();
|
||||
currently_executing_command = save_current;
|
||||
|
||||
#if defined (DEBUGGER)
|
||||
/* In debugging mode, if the DEBUG trap returns a non-zero status, we
|
||||
skip the command. */
|
||||
@@ -3877,6 +3893,7 @@ execute_arith_command (ARITH_COM *arith_command)
|
||||
intmax_t expresult;
|
||||
WORD_LIST *new;
|
||||
char *exp, *t;
|
||||
COMMAND *save_current;
|
||||
|
||||
expresult = 0;
|
||||
|
||||
@@ -3898,7 +3915,10 @@ execute_arith_command (ARITH_COM *arith_command)
|
||||
/* Run the debug trap before each arithmetic command, but do it after we
|
||||
update the line number information and before we expand the various
|
||||
words in the expression. */
|
||||
save_current = currently_executing_command;
|
||||
retval = run_debug_trap ();
|
||||
currently_executing_command = save_current;
|
||||
|
||||
#if defined (DEBUGGER)
|
||||
/* In debugging mode, if the DEBUG trap returns a non-zero status, we
|
||||
skip the command. */
|
||||
@@ -4113,6 +4133,7 @@ static int
|
||||
execute_cond_command (COND_COM *cond_command)
|
||||
{
|
||||
int retval, save_line_number;
|
||||
COMMAND *save_current;
|
||||
|
||||
save_line_number = line_number;
|
||||
|
||||
@@ -4131,7 +4152,10 @@ execute_cond_command (COND_COM *cond_command)
|
||||
|
||||
/* Run the debug trap before each conditional command, but do it after we
|
||||
update the line number information. */
|
||||
save_current = currently_executing_command;
|
||||
retval = run_debug_trap ();
|
||||
currently_executing_command = save_current;
|
||||
|
||||
#if defined (DEBUGGER)
|
||||
/* In debugging mode, if the DEBUG trap returns a non-zero status, we
|
||||
skip the command. */
|
||||
@@ -4455,6 +4479,7 @@ execute_simple_command (SIMPLE_COM *simple_command, int pipe_in, int pipe_out, i
|
||||
pid_t old_last_async_pid;
|
||||
sh_builtin_func_t *builtin;
|
||||
SHELL_VAR *func;
|
||||
COMMAND *save_current;
|
||||
volatile int old_builtin, old_command_builtin;
|
||||
|
||||
result = EXECUTION_SUCCESS;
|
||||
@@ -4484,7 +4509,10 @@ execute_simple_command (SIMPLE_COM *simple_command, int pipe_in, int pipe_out, i
|
||||
|
||||
/* Run the debug trap before each simple command, but do it after we
|
||||
update the line number information. */
|
||||
save_current = currently_executing_command;
|
||||
result = run_debug_trap ();
|
||||
currently_executing_command = save_current;
|
||||
|
||||
#if defined (DEBUGGER)
|
||||
/* In debugging mode, if the DEBUG trap returns a non-zero status, we
|
||||
skip the command. */
|
||||
@@ -5396,13 +5424,13 @@ execute_function (SHELL_VAR *var, WORD_LIST *words, int flags, struct fd_bitmap
|
||||
showing_function_line = 1;
|
||||
save_current = currently_executing_command;
|
||||
result = run_debug_trap ();
|
||||
currently_executing_command = save_current;
|
||||
#if defined (DEBUGGER)
|
||||
/* In debugging mode, if the DEBUG trap returns a non-zero status, we
|
||||
skip the command. */
|
||||
if (debugging_mode == 0 || result == EXECUTION_SUCCESS)
|
||||
{
|
||||
showing_function_line = 0;
|
||||
currently_executing_command = save_current;
|
||||
result = execute_command_internal (fc, 0, NO_PIPE, NO_PIPE, fds_to_close);
|
||||
|
||||
/* Run the RETURN trap in the function's context */
|
||||
@@ -5411,7 +5439,6 @@ execute_function (SHELL_VAR *var, WORD_LIST *words, int flags, struct fd_bitmap
|
||||
currently_executing_command = save_current;
|
||||
}
|
||||
#else
|
||||
currently_executing_command = save_current;
|
||||
result = execute_command_internal (fc, 0, NO_PIPE, NO_PIPE, fds_to_close);
|
||||
|
||||
save_current = currently_executing_command;
|
||||
|
||||
+2
-2
@@ -967,12 +967,12 @@ _rl_read_file (char *filename, size_t *sizep)
|
||||
char *buffer;
|
||||
int i, file;
|
||||
|
||||
file = open (filename, O_RDONLY, 0666);
|
||||
file = open (filename, O_RDONLY);
|
||||
/* If the open is interrupted, retry once */
|
||||
if (file < 0 && errno == EINTR)
|
||||
{
|
||||
RL_CHECK_SIGNALS ();
|
||||
file = open (filename, O_RDONLY, 0666);
|
||||
file = open (filename, O_RDONLY);
|
||||
}
|
||||
|
||||
if ((file < 0) || (fstat (file, &finfo) < 0))
|
||||
|
||||
@@ -833,15 +833,8 @@ bug report to
|
||||
If you have a fix, you are welcome to mail that as well!
|
||||
Please send suggestions and
|
||||
.Q philosophical
|
||||
bug reports to
|
||||
.MT bug\-readline@\*:gnu\*:.org
|
||||
.ME
|
||||
or post them to the
|
||||
Usenet
|
||||
newsgroup
|
||||
.BR gnu\*:.bash\*:.bug .
|
||||
.PP
|
||||
Please send comments and bug reports concerning
|
||||
this manual page to
|
||||
bug reports,
|
||||
as well as comments and bug reports concerning this manual page,
|
||||
to
|
||||
.MT bug\-readline@\*:gnu\*:.org
|
||||
.ME .
|
||||
|
||||
@@ -1923,16 +1923,8 @@ bug report to
|
||||
If you have a fix, you are welcome to mail that as well!
|
||||
Please send suggestions and
|
||||
.Q philosophical
|
||||
bug reports
|
||||
bug reports,
|
||||
as well as comments and bug reports concerning this manual page,
|
||||
to
|
||||
.MT bug\-readline@\*:gnu\*:.org
|
||||
.ME
|
||||
or post them to the
|
||||
Usenet
|
||||
newsgroup
|
||||
.BR gnu\*:.bash\*:.bug .
|
||||
.PP
|
||||
Please send comments and bug reports concerning
|
||||
this manual page to
|
||||
.MT bug\-readline@\*:gnu\*:.org
|
||||
.ME .
|
||||
|
||||
@@ -354,7 +354,7 @@ read_history_range (const char *filename, int from, int to)
|
||||
if (input == 0)
|
||||
return 0;
|
||||
errno = 0;
|
||||
file = open (input, O_RDONLY|O_BINARY, 0666);
|
||||
file = open (input, O_RDONLY|O_BINARY);
|
||||
|
||||
if ((file < 0) || (fstat (file, &finfo) == -1))
|
||||
goto error_and_exit;
|
||||
@@ -623,7 +623,7 @@ history_truncate_file (const char *fname, int lines)
|
||||
if (filename == 0)
|
||||
return 0;
|
||||
tempname = 0;
|
||||
file = open (filename, O_RDONLY|O_BINARY, 0666);
|
||||
file = open (filename, O_RDONLY|O_BINARY);
|
||||
rv = exists = 0;
|
||||
|
||||
orig_lines = lines;
|
||||
|
||||
+1
-1
@@ -994,7 +994,7 @@ rl_insert (int count, int c)
|
||||
n = (unsigned short)-2;
|
||||
while (_rl_optimize_typeahead &&
|
||||
rl_num_chars_to_read == 0 &&
|
||||
(RL_ISSTATE (RL_STATE_INPUTPENDING|RL_STATE_MACROINPUT) == 0) &&
|
||||
(RL_ISSTATE (RL_STATE_INPUTPENDING|RL_STATE_MACROINPUT|RL_STATE_MACRODEF) == 0) &&
|
||||
_rl_pushed_input_available () == 0 &&
|
||||
_rl_input_queued (0) &&
|
||||
(n = rl_read_key ()) > 0 &&
|
||||
|
||||
@@ -119,6 +119,17 @@ gettimeofday (struct timeval *restrict tv, void *restrict tz)
|
||||
return 0;
|
||||
|
||||
#else /* !WINDOWS_NATIVE */
|
||||
# if defined (HAVE_CLOCK_GETTIME) && defined (CLOCK_REALTIME)
|
||||
struct timespec ts;
|
||||
int r;
|
||||
|
||||
r = clock_gettime (CLOCK_REALTIME, &ts);
|
||||
if (r == 0)
|
||||
{
|
||||
TIMESPEC_TO_TIMEVAL(tv, &ts);
|
||||
return 0;
|
||||
}
|
||||
# endif /* !CLOCK_GETTIME */
|
||||
|
||||
tv->tv_sec = (time_t) time ((time_t *)0);
|
||||
tv->tv_usec = 0;
|
||||
|
||||
@@ -522,7 +522,7 @@ use_tempfile:
|
||||
/* In an attempt to avoid races, we close the first fd only after opening
|
||||
the second. */
|
||||
/* Make the document really temporary. Also make it the input. */
|
||||
fd2 = open (filename, O_RDONLY|O_BINARY, 0600);
|
||||
fd2 = open (filename, O_RDONLY|O_BINARY);
|
||||
|
||||
if (fd2 < 0)
|
||||
{
|
||||
@@ -729,16 +729,6 @@ redir_open (char *filename, int flags, int mode, enum r_instruction ri)
|
||||
errno = e;
|
||||
}
|
||||
while (fd < 0 && errno == EINTR);
|
||||
|
||||
#if 0 /* reportedly no longer needed */
|
||||
#if defined (AFS)
|
||||
if ((fd < 0) && (errno == EACCES))
|
||||
{
|
||||
fd = open (filename, flags & ~O_CREAT, mode);
|
||||
errno = EACCES; /* restore errno */
|
||||
}
|
||||
#endif /* AFS */
|
||||
#endif
|
||||
}
|
||||
|
||||
return fd;
|
||||
|
||||
+4
-5
@@ -14,11 +14,10 @@
|
||||
. ./test-aux-functions
|
||||
|
||||
# this locale causes problems all over the place
|
||||
if locale -a | grep -i '^zh_TW\.big5' >/dev/null ; then
|
||||
:
|
||||
else
|
||||
if [ -z "$ZH_LOCALE" ]; then
|
||||
echo "glob2.sub: warning: you do not have the zh_TW.big5 locale installed;" >&2
|
||||
echo "glob2.sub: warning: that may cause some of these tests to fail." >&2
|
||||
ZH_LOCALE=$ZH_DEFAULT
|
||||
fi
|
||||
|
||||
var='ab\'
|
||||
@@ -41,7 +40,7 @@ esac
|
||||
[[ $var = $var ]] && echo ok 4
|
||||
[[ $var = $'ab\134' ]] && echo ok 5
|
||||
|
||||
LC_ALL=zh_TW.big5
|
||||
LC_ALL=$ZH_LOCALE
|
||||
|
||||
read a b c <<< $'\u3b1 b c\n'
|
||||
echo $b
|
||||
@@ -62,4 +61,4 @@ printf "%s" "a${alpha}b" | LC_ALL=C od -b | _intl_normalize_spaces
|
||||
a=$'\u3b1'
|
||||
[[ $a = $a ]] && echo ok 6
|
||||
|
||||
LC_ALL=zh_TW.big5 ${THIS_SH} -c $'[[ \u3b1 = \u3b1 ]]' && echo ok 7
|
||||
LC_ALL=${ZH_LOCALE} ${THIS_SH} -c $'[[ \u3b1 = \u3b1 ]]' && echo ok 7
|
||||
|
||||
+6
-5
@@ -183,7 +183,7 @@ declare -n foo="bar"
|
||||
./nameref11.sub: line 14: declare: `/': invalid variable name for name reference
|
||||
./nameref11.sub: line 15: declare: `/': invalid variable name for name reference
|
||||
./nameref11.sub: line 16: `/': not a valid identifier
|
||||
./nameref11.sub: line 17: declare: `/': not a valid identifier
|
||||
./nameref11.sub: line 17: declare: `/': invalid variable name for name reference
|
||||
./nameref11.sub: line 18: `/': not a valid identifier
|
||||
1) /
|
||||
#? ./nameref11.sub: line 19: `/': not a valid identifier
|
||||
@@ -243,12 +243,12 @@ declare -r RO2="a"
|
||||
declare -n r
|
||||
declare -a foo
|
||||
declare -a foo=([0]="7")
|
||||
./nameref12.sub: line 39: declare: `42': not a valid identifier
|
||||
./nameref12.sub: line 40: declare: x: not found
|
||||
./nameref12.sub: line 39: declare: `42': invalid variable name for name reference
|
||||
declare -n x
|
||||
declare -nr RO="foo"
|
||||
/
|
||||
./nameref12.sub: line 58: declare: `7*6': not a valid identifier
|
||||
./nameref12.sub: line 58: declare: foo: not found
|
||||
./nameref12.sub: line 58: declare: `7*6': invalid variable name for name reference
|
||||
declare -n foo
|
||||
./nameref12.sub: line 60: `7*6': not a valid identifier
|
||||
declare -n ref="var"
|
||||
declare -n ref="var"
|
||||
@@ -381,6 +381,7 @@ declare -- bar
|
||||
./nameref17.sub: line 28: declare: foo0: readonly variable
|
||||
declare -nr foo1
|
||||
./nameref17.sub: line 37: typeset: foo1: readonly variable
|
||||
./nameref17.sub: line 38: typeset: foo1: readonly variable
|
||||
declare -nr foo1
|
||||
declare -n foo2="bar"
|
||||
declare -r bar
|
||||
|
||||
@@ -19,3 +19,24 @@ test_runsub()
|
||||
|
||||
${THIS_SH} "$1"
|
||||
}
|
||||
|
||||
# some useful locale variables
|
||||
ZH_LOCALE=$(locale -a | grep -i '^zh_TW\.big5' | sed 1q)
|
||||
ZH_DEFAULT=$(locale | grep ^LC_CTYPE | sed 's:^.*=::' | tr -d '"')
|
||||
|
||||
US_LOCALE=$(locale -a | grep -i '^en_US\.utf-8' | sed 1q)
|
||||
if [ -z "$US_LOCALE" ]; then
|
||||
US_LOCALE=$(locale -a | grep -i '^en_US\.utf8' | sed 1q)
|
||||
fi
|
||||
CTYPE_DEFAULT=$ZH_DEFAULT
|
||||
|
||||
# figure out default locale; use LC_CTYPE value since that is what we use it for
|
||||
if [ -n "$LC_ALL" ]; then
|
||||
DEFAULT_LOCALE=${LC_ALL}
|
||||
elif [ -n "$LC_CTYPE" ]; then
|
||||
DEFAULT_LOCALE=${LC_CTYPE}
|
||||
elif [ -n "$LANG" ]; then
|
||||
DEFAULT_LOCALE=${LANG}
|
||||
else
|
||||
DEFAULT_LOCALE="C"
|
||||
fi
|
||||
|
||||
+7
-4
@@ -19,6 +19,8 @@ unset LC_ALL
|
||||
ErrorCnt=0
|
||||
TestCnt=0
|
||||
|
||||
. ./test-aux-functions
|
||||
|
||||
localewarn()
|
||||
{
|
||||
echo "unicode1.sub: warning: you do not have the $1 locale installed;" >&2
|
||||
@@ -98,8 +100,9 @@ fr_FR_ISO_8859_1=(
|
||||
)
|
||||
|
||||
# this locale causes problems all over the place
|
||||
if locale -a | grep -i '^fr_FR\.ISO8859.*1$' >/dev/null ; then
|
||||
TestCodePage fr_FR.ISO8859-1 fr_FR_ISO_8859_1
|
||||
FR_LOCALE=$(locale -a | grep -i '^fr_FR\.ISO8859-1' | sed 1q)
|
||||
if [ -n "$FR_LOCALE" ]; then
|
||||
TestCodePage ${FR_LOCALE} fr_FR_ISO_8859_1
|
||||
else
|
||||
localewarn fr_FR.ISO8859-1
|
||||
|
||||
@@ -118,8 +121,8 @@ zh_TW_BIG5=(
|
||||
)
|
||||
|
||||
# this locale causes problems all over the place
|
||||
if locale -a | grep -i '^zh_TW\.big5' >/dev/null ; then
|
||||
TestCodePage zh_TW.BIG5 zh_TW_BIG5
|
||||
if [ -n "$ZH_LOCALE" ]; then
|
||||
TestCodePage $ZH_LOCALE zh_TW_BIG5
|
||||
else
|
||||
localewarn zh_TW.BIG5
|
||||
fi
|
||||
|
||||
+1
-1
@@ -2971,7 +2971,7 @@ make_variable_value (SHELL_VAR *var, const char *value, int flags)
|
||||
if (value)
|
||||
strcpy (retval+olen, value);
|
||||
}
|
||||
else if (*value)
|
||||
else if (value && *value)
|
||||
retval = savestring (value);
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user