prefer nanosleep for sleep loadable builtin; changes for overflow in indexed array indices; make sure dynamic loading and unloading builtins updates programmable completion; document that assignment to PATH clears the command hash table; fix small memory leak from readline filename rewrite hook

This commit is contained in:
Chet Ramey
2023-07-05 16:38:35 -04:00
parent 935fe11af0
commit 6cca378e82
24 changed files with 3353 additions and 3206 deletions
+50
View File
@@ -7025,3 +7025,53 @@ lib/readline/complete.c
- rl_username_completion_function: simplify things by just skipping the
function body if HAVE_GETPWENT is not defined.
From a report by Grisha Levit <grishalevit@gmail.com>
lib/sh/ufuncs.c
- fsleep: broke into three functions: nsleep, which uses nanosleep,
ssleep, which uses select/pselect, and ancientsleep, which uses
sleep. Prefer nanosleep, use the others depending on what's
defined.
From a report and patch by Grisha Levit <grishalevit@gmail.com>
arrayfunc.c
- assign_compound_array_list: now behaves more like a series of
assignment statements (a=(one two) is more like a[0]=one a[1]=two)
in terms of error handling -- break after the first invalid
assignment -- and return value -- now return int, 0 on failure and
1 on success so the callers can throw assignment errors
- assign_compound_array_list: if we have an explicit [subscript]=value
assignment, use the negative-indices-count-back-from-the-end strategy;
otherwise use last_ind and throw an error on overflow. This is like
standalone assignment statements
- assign_array_var_from_string: catch new return value from
assign_compound_array_list; return NULL if assign_compound_array_list
returns failure
subst.c
- do_compound_assignment: if assign_compound_array_list or
assign_array_var_from_string return error (0 or NULL, respectively),
treat as an assignment error similar to assigning to a readonly
variable
Inspired by a report from Emanuele Torre <torreemanuele6@gmail.com>
arrayfunc.h
- assign_compound_array_list: new return type
7/5
---
builtins/enable.def
- enable_builtin: make sure dynamic builtin loading and unloading
updates the `enabled' and `disabled' programmable completion lists.
From a report and patch by Grisha Levit <grishalevit@gmail.com>
doc/bash.1,doc/bashref.texi
- hash: add note that assigment to PATH clears the hash table.
Report by Sebastian Carlos <sebaaa1754@gmail.com>
lib/readline/complete.c
- rl_filename_completion_function: make sure the results of
*rl_filename_rewrite_hook are freed consistently if the function
returns newly-allocated memory
From a report and patch by Grisha Levit <grishalevit@gmail.com>
back in May
+48 -35
View File
@@ -529,18 +529,21 @@ assign_array_var_from_word_list (SHELL_VAR *var, WORD_LIST *list, int flags)
a = array_cell (var);
i = (flags & ASS_APPEND) ? array_max_index (a) + 1 : 0;
if (a && i < 0) /* overflow */
{
char *num;
num = itos (i);
report_error ("%s[%s]: %s", var->name, num, bash_badsub_errmsg);
free (num);
return (var); /* XXX */
}
for (l = list; l; l = l->next, i++)
bind_array_var_internal (var, i, 0, l->word->word, flags & ~ASS_APPEND);
{
if (a && i < 0) /* overflow */
{
char *num;
num = itos (i);
report_error ("%s[%s]: %s", var->name, num, bash_badsub_errmsg);
free (num);
return (var); /* XXX */
}
bind_array_var_internal (var, i, 0, l->word->word, flags & ~ASS_APPEND);
}
VUNSETATTR (var, att_invisible); /* no longer invisible */
@@ -690,14 +693,14 @@ expand_and_quote_kvpair_word (const char *w)
If this is an associative array, we perform the assignments into NHASH and
set NHASH to be the value of VAR after processing the assignments in NLIST */
void
int
assign_compound_array_list (SHELL_VAR *var, WORD_LIST *nlist, int flags)
{
ARRAY *a;
HASH_TABLE *h, *nhash;
WORD_LIST *list;
char *w, *val, *nval, *savecmd;
int len, iflags, free_val;
int len, iflags, free_val, any_failed;
arrayind_t ind, last_ind;
char *akey;
@@ -707,6 +710,8 @@ assign_compound_array_list (SHELL_VAR *var, WORD_LIST *nlist, int flags)
akey = (char *)0;
ind = 0;
any_failed = 0;
/* Now that we are ready to assign values to the array, kill the existing
value. */
if ((flags & ASS_APPEND) == 0)
@@ -717,8 +722,6 @@ assign_compound_array_list (SHELL_VAR *var, WORD_LIST *nlist, int flags)
nhash = assoc_create (h->nbuckets);
}
last_ind = (a && (flags & ASS_APPEND)) ? array_max_index (a) + 1 : 0;
#if ASSOC_KVPAIR_ASSIGNMENT
if (assoc_p (var) && kvpair_assignment_p (nlist))
{
@@ -730,10 +733,12 @@ assign_compound_array_list (SHELL_VAR *var, WORD_LIST *nlist, int flags)
var_setassoc (var, nhash);
assoc_dispose (h);
}
return;
return 1; /* XXX - check return value */
}
#endif
last_ind = (a && (flags & ASS_APPEND)) ? array_max_index (a) + 1 : 0;
for (list = nlist; list; list = list->next)
{
/* Don't allow var+=(values) to make assignments in VALUES append to
@@ -741,16 +746,6 @@ assign_compound_array_list (SHELL_VAR *var, WORD_LIST *nlist, int flags)
iflags = flags & ~ASS_APPEND;
w = list->word->word;
if (array_p (var) && last_ind < 0) /* overflow */
{
char *num;
num = itos (last_ind);
report_error ("%s[%s]: %s", var->name, num, bash_badsub_errmsg);
free (num);
return;
}
/* We have a word of the form [ind]=value */
if ((list->word->flags & W_ASSIGNMENT) && w[0] == '[')
{
@@ -762,10 +757,11 @@ assign_compound_array_list (SHELL_VAR *var, WORD_LIST *nlist, int flags)
/* XXX - changes for `+=' */
if (w[len] != ']' || (w[len+1] != '=' && (w[len+1] != '+' || w[len+2] != '=')))
{
if (assoc_p (var))
if (assoc_p (var) || last_ind < 0)
{
err_badarraysub (w);
continue;
any_failed++;
break;
}
nval = make_variable_value (var, w, flags);
if (var->assign_func)
@@ -780,14 +776,16 @@ assign_compound_array_list (SHELL_VAR *var, WORD_LIST *nlist, int flags)
if (len == 1)
{
err_badarraysub (w);
continue;
any_failed++;
break;
}
if (ALL_ELEMENT_SUB (w[1]) && len == 2 && array_p (var))
{
set_exit_status (EXECUTION_FAILURE);
report_error (_("%s: cannot assign to non-numeric index"), w);
continue;
any_failed++;
break;
}
if (array_p (var))
@@ -803,7 +801,8 @@ assign_compound_array_list (SHELL_VAR *var, WORD_LIST *nlist, int flags)
if (ind < 0)
{
err_badarraysub (w);
continue;
any_failed++;
break;
}
last_ind = ind;
@@ -819,7 +818,8 @@ assign_compound_array_list (SHELL_VAR *var, WORD_LIST *nlist, int flags)
{
err_badarraysub (w);
FREE (akey);
continue;
any_failed++;
break;
}
}
@@ -836,7 +836,8 @@ assign_compound_array_list (SHELL_VAR *var, WORD_LIST *nlist, int flags)
{
set_exit_status (EXECUTION_FAILURE);
report_error (_("%s: %s: must use subscript when assigning associative array"), var->name, w);
continue;
any_failed++;
break;
}
else /* No [ind]=value, just a stray `=' */
{
@@ -844,6 +845,16 @@ assign_compound_array_list (SHELL_VAR *var, WORD_LIST *nlist, int flags)
val = w;
}
if (array_p (var) && ind < 0) /* overflow */
{
char *num;
num = itos (ind);
report_error ("%s[%s]: %s", var->name, num, bash_badsub_errmsg);
free (num);
return 0;
}
free_val = 0;
/* See above; we need to expand the value here */
if (assoc_p (var))
@@ -877,6 +888,8 @@ assign_compound_array_list (SHELL_VAR *var, WORD_LIST *nlist, int flags)
var_setassoc (var, nhash);
assoc_dispose (h);
}
return (any_failed ? 0 : 1);
}
/* Perform a compound array assignment: VAR->name=( VALUE ). The
@@ -886,7 +899,7 @@ SHELL_VAR *
assign_array_var_from_string (SHELL_VAR *var, char *value, int flags)
{
WORD_LIST *nlist;
int aflags;
int aflags, r;
if (value == 0)
return var;
@@ -896,7 +909,7 @@ assign_array_var_from_string (SHELL_VAR *var, char *value, int flags)
expand_compound_array_assignment performs word expansions. Honors
array_expand_once; allows @ and * as associative array keys. */
aflags = flags | (array_expand_once ? ASS_NOEXPAND : 0) | ASS_ALLOWALLSUB;
assign_compound_array_list (var, nlist, aflags);
r = assign_compound_array_list (var, nlist, aflags);
if (nlist)
dispose_words (nlist);
@@ -904,7 +917,7 @@ assign_array_var_from_string (SHELL_VAR *var, char *value, int flags)
if (var)
VUNSETATTR (var, att_invisible); /* no longer invisible */
return (var);
return (r == 0 ? (SHELL_VAR *)0 : var);
}
/* Quote globbing chars and characters in $IFS before the `=' in an assignment
+1 -1
View File
@@ -89,7 +89,7 @@ extern SHELL_VAR *assign_array_from_string (const char *, char *, int);
extern SHELL_VAR *assign_array_var_from_word_list (SHELL_VAR *, WORD_LIST *, int);
extern WORD_LIST *expand_compound_array_assignment (SHELL_VAR *, char *, int);
extern void assign_compound_array_list (SHELL_VAR *, WORD_LIST *, int);
extern int assign_compound_array_list (SHELL_VAR *, WORD_LIST *, int);
extern SHELL_VAR *assign_array_var_from_string (SHELL_VAR *, char *, int);
extern char *expand_and_quote_assoc_word (char *, int);
+6
View File
@@ -193,6 +193,8 @@ enable_builtin (WORD_LIST *list)
result = EXECUTION_FAILURE; /* normalize return value */
#if defined (PROGRAMMABLE_COMPLETION)
set_itemlist_dirty (&it_builtins);
set_itemlist_dirty (&it_enabled);
set_itemlist_dirty (&it_disabled);
#endif
}
#endif
@@ -208,6 +210,8 @@ enable_builtin (WORD_LIST *list)
}
#if defined (PROGRAMMABLE_COMPLETION)
set_itemlist_dirty (&it_builtins);
set_itemlist_dirty (&it_enabled);
set_itemlist_dirty (&it_disabled);
#endif
}
#endif
@@ -237,6 +241,8 @@ enable_builtin (WORD_LIST *list)
opt = r;
#if defined (PROGRAMMABLE_COMPLETION)
set_itemlist_dirty (&it_builtins);
set_itemlist_dirty (&it_enabled);
set_itemlist_dirty (&it_disabled);
#endif
}
#endif
+681 -680
View File
File diff suppressed because it is too large Load Diff
+1
View File
@@ -9160,6 +9160,7 @@ The
.B \-r
option causes the shell to forget all
remembered locations.
Assigning to the \fBPATH\fP variable also clears all hashed filenames.
The
.B \-d
option causes the shell to forget the remembered location of each \fIname\fP.
+3 -2
View File
@@ -11537,6 +11537,7 @@ The
option causes the shell to forget all
remembered locations.
Assigning to the <B>PATH</B> variable also clears all hashed filenames.
The
<B>-d</B>
@@ -15156,7 +15157,7 @@ There may be only one active coprocess at a time.
<DT><A HREF="#lbDI">BUGS</A><DD>
</DL>
<HR>
This document was created by man2html from /usr/local/src/bash/bash-20230626/doc/bash.1.<BR>
Time: 28 June 2023 14:10:33 EDT
This document was created by man2html from /usr/local/src/bash/bash-20230703/doc/bash.1.<BR>
Time: 05 July 2023 11:27:18 EDT
</BODY>
</HTML>
+120 -122
View File
@@ -1,9 +1,9 @@
This is bash.info, produced by makeinfo version 6.8 from bashref.texi.
This text is a brief description of the features that are present in the
Bash shell (version 5.3, 28 June 2023).
Bash shell (version 5.3, 29 June 2023).
This is Edition 5.3, last updated 28 June 2023, of 'The GNU Bash
This is Edition 5.3, last updated 29 June 2023, of 'The GNU Bash
Reference Manual', for 'Bash', Version 5.3.
Copyright (C) 1988-2023 Free Software Foundation, Inc.
@@ -26,10 +26,10 @@ Bash Features
*************
This text is a brief description of the features that are present in the
Bash shell (version 5.3, 28 June 2023). The Bash home page is
Bash shell (version 5.3, 29 June 2023). The Bash home page is
<http://www.gnu.org/software/bash/>.
This is Edition 5.3, last updated 28 June 2023, of 'The GNU Bash
This is Edition 5.3, last updated 29 June 2023, of 'The GNU Bash
Reference Manual', for 'Bash', Version 5.3.
Bash contains features that appear in other popular shells, and some
@@ -1658,7 +1658,7 @@ substitution.
After these expansions are performed, quote characters present in the
original word are removed unless they have been quoted themselves
("quote removal").
("quote removal"). *Note Quote Removal:: for more details.
Only brace expansion, word splitting, and filename expansion can
increase the number of words of the expansion; other expansions expand a
@@ -1666,9 +1666,6 @@ single word to a single word. The only exceptions to this are the
expansions of '"$@"' and '$*' (*note Special Parameters::), and
'"${NAME[@]}"' and '${NAME[*]}' (*note Arrays::).
After all expansions, 'quote removal' (*note Quote Removal::) is
performed.

File: bash.info, Node: Brace Expansion, Next: Tilde Expansion, Up: Shell Expansions
@@ -3453,14 +3450,15 @@ standard.
'hash'
hash [-r] [-p FILENAME] [-dt] [NAME]
Each time 'hash' is invoked, it remembers the full pathnames of the
Each time 'hash' is invoked, it remembers the full filenames of the
commands specified as NAME arguments, so they need not be searched
for on subsequent invocations. The commands are found by searching
through the directories listed in '$PATH'. Any
previously-remembered pathname is discarded. The '-p' option
previously-remembered filename is discarded. The '-p' option
inhibits the path search, and FILENAME is used as the location of
NAME. The '-r' option causes the shell to forget all remembered
locations. The '-d' option causes the shell to forget the
locations. Assigning to the 'PATH' variable also clears all hashed
filenames. The '-d' option causes the shell to forget the
remembered location of each NAME. If the '-t' option is supplied,
the full pathname to which each NAME corresponds is printed. If
multiple NAME arguments are supplied with '-t', the NAME is printed
@@ -12030,7 +12028,7 @@ D.1 Index of Shell Builtin Commands
* :: Bourne Shell Builtins.
(line 11)
* [: Bourne Shell Builtins.
(line 280)
(line 281)
* alias: Bash Builtins. (line 11)
* bg: Job Control Builtins.
(line 7)
@@ -12092,36 +12090,36 @@ D.1 Index of Shell Builtin Commands
* pushd: Directory Stack Builtins.
(line 69)
* pwd: Bourne Shell Builtins.
(line 217)
(line 218)
* read: Bash Builtins. (line 504)
* readarray: Bash Builtins. (line 601)
* readonly: Bourne Shell Builtins.
(line 227)
(line 228)
* return: Bourne Shell Builtins.
(line 246)
(line 247)
* set: The Set Builtin. (line 11)
* shift: Bourne Shell Builtins.
(line 267)
(line 268)
* shopt: The Shopt Builtin. (line 9)
* source: Bash Builtins. (line 610)
* suspend: Job Control Builtins.
(line 116)
* test: Bourne Shell Builtins.
(line 280)
(line 281)
* times: Bourne Shell Builtins.
(line 365)
(line 366)
* trap: Bourne Shell Builtins.
(line 371)
(line 372)
* true: Bourne Shell Builtins.
(line 433)
(line 434)
* type: Bash Builtins. (line 615)
* typeset: Bash Builtins. (line 653)
* ulimit: Bash Builtins. (line 659)
* umask: Bourne Shell Builtins.
(line 438)
(line 439)
* unalias: Bash Builtins. (line 765)
* unset: Bourne Shell Builtins.
(line 456)
(line 457)
* wait: Job Control Builtins.
(line 76)
@@ -12828,106 +12826,106 @@ Node: Shell Parameters61911
Node: Positional Parameters66296
Node: Special Parameters67195
Node: Shell Expansions70406
Node: Brace Expansion72530
Node: Tilde Expansion75261
Node: Shell Parameter Expansion77879
Node: Command Substitution96278
Node: Arithmetic Expansion99739
Node: Process Substitution100704
Node: Word Splitting101821
Node: Filename Expansion103866
Node: Pattern Matching106796
Node: Quote Removal111795
Node: Redirections112087
Node: Executing Commands121777
Node: Simple Command Expansion122444
Node: Command Search and Execution124551
Node: Command Execution Environment126935
Node: Environment129967
Node: Exit Status131627
Node: Signals133408
Node: Shell Scripts136854
Node: Shell Builtin Commands139878
Node: Bourne Shell Builtins141913
Node: Bash Builtins164244
Node: Modifying Shell Behavior196240
Node: The Set Builtin196582
Node: The Shopt Builtin207177
Node: Special Builtins223181
Node: Shell Variables224157
Node: Bourne Shell Variables224591
Node: Bash Variables226692
Node: Bash Features261646
Node: Invoking Bash262656
Node: Bash Startup Files268666
Node: Interactive Shells273794
Node: What is an Interactive Shell?274202
Node: Is this Shell Interactive?274848
Node: Interactive Shell Behavior275660
Node: Bash Conditional Expressions279286
Node: Shell Arithmetic283925
Node: Aliases286883
Node: Arrays289774
Node: The Directory Stack296334
Node: Directory Stack Builtins297115
Node: Controlling the Prompt301372
Node: The Restricted Shell304334
Node: Bash POSIX Mode306941
Node: Shell Compatibility Mode322854
Node: Job Control331095
Node: Job Control Basics331552
Node: Job Control Builtins336551
Node: Job Control Variables342343
Node: Command Line Editing343496
Node: Introduction and Notation345164
Node: Readline Interaction346784
Node: Readline Bare Essentials347972
Node: Readline Movement Commands349758
Node: Readline Killing Commands350715
Node: Readline Arguments352633
Node: Searching353674
Node: Readline Init File355857
Node: Readline Init File Syntax357115
Node: Conditional Init Constructs380903
Node: Sample Init File385096
Node: Bindable Readline Commands388217
Node: Commands For Moving389418
Node: Commands For History391466
Node: Commands For Text396457
Node: Commands For Killing400103
Node: Numeric Arguments403133
Node: Commands For Completion404269
Node: Keyboard Macros408457
Node: Miscellaneous Commands409142
Node: Readline vi Mode415177
Node: Programmable Completion416081
Node: Programmable Completion Builtins423858
Node: A Programmable Completion Example434975
Node: Using History Interactively440220
Node: Bash History Facilities440901
Node: Bash History Builtins443903
Node: History Interaction448924
Node: Event Designators452541
Node: Word Designators453892
Node: Modifiers455649
Node: Installing Bash457454
Node: Basic Installation458588
Node: Compilers and Options462307
Node: Compiling For Multiple Architectures463045
Node: Installation Names464734
Node: Specifying the System Type466840
Node: Sharing Defaults467554
Node: Operation Controls468224
Node: Optional Features469179
Node: Reporting Bugs480395
Node: Major Differences From The Bourne Shell481726
Node: GNU Free Documentation License498572
Node: Indexes523746
Node: Builtin Index524197
Node: Reserved Word Index531295
Node: Variable Index533740
Node: Function Index550871
Node: Concept Index564652
Node: Brace Expansion72491
Node: Tilde Expansion75222
Node: Shell Parameter Expansion77840
Node: Command Substitution96239
Node: Arithmetic Expansion99700
Node: Process Substitution100665
Node: Word Splitting101782
Node: Filename Expansion103827
Node: Pattern Matching106757
Node: Quote Removal111756
Node: Redirections112048
Node: Executing Commands121738
Node: Simple Command Expansion122405
Node: Command Search and Execution124512
Node: Command Execution Environment126896
Node: Environment129928
Node: Exit Status131588
Node: Signals133369
Node: Shell Scripts136815
Node: Shell Builtin Commands139839
Node: Bourne Shell Builtins141874
Node: Bash Builtins164278
Node: Modifying Shell Behavior196274
Node: The Set Builtin196616
Node: The Shopt Builtin207211
Node: Special Builtins223215
Node: Shell Variables224191
Node: Bourne Shell Variables224625
Node: Bash Variables226726
Node: Bash Features261680
Node: Invoking Bash262690
Node: Bash Startup Files268700
Node: Interactive Shells273828
Node: What is an Interactive Shell?274236
Node: Is this Shell Interactive?274882
Node: Interactive Shell Behavior275694
Node: Bash Conditional Expressions279320
Node: Shell Arithmetic283959
Node: Aliases286917
Node: Arrays289808
Node: The Directory Stack296368
Node: Directory Stack Builtins297149
Node: Controlling the Prompt301406
Node: The Restricted Shell304368
Node: Bash POSIX Mode306975
Node: Shell Compatibility Mode322888
Node: Job Control331129
Node: Job Control Basics331586
Node: Job Control Builtins336585
Node: Job Control Variables342377
Node: Command Line Editing343530
Node: Introduction and Notation345198
Node: Readline Interaction346818
Node: Readline Bare Essentials348006
Node: Readline Movement Commands349792
Node: Readline Killing Commands350749
Node: Readline Arguments352667
Node: Searching353708
Node: Readline Init File355891
Node: Readline Init File Syntax357149
Node: Conditional Init Constructs380937
Node: Sample Init File385130
Node: Bindable Readline Commands388251
Node: Commands For Moving389452
Node: Commands For History391500
Node: Commands For Text396491
Node: Commands For Killing400137
Node: Numeric Arguments403167
Node: Commands For Completion404303
Node: Keyboard Macros408491
Node: Miscellaneous Commands409176
Node: Readline vi Mode415211
Node: Programmable Completion416115
Node: Programmable Completion Builtins423892
Node: A Programmable Completion Example435009
Node: Using History Interactively440254
Node: Bash History Facilities440935
Node: Bash History Builtins443937
Node: History Interaction448958
Node: Event Designators452575
Node: Word Designators453926
Node: Modifiers455683
Node: Installing Bash457488
Node: Basic Installation458622
Node: Compilers and Options462341
Node: Compiling For Multiple Architectures463079
Node: Installation Names464768
Node: Specifying the System Type466874
Node: Sharing Defaults467588
Node: Operation Controls468258
Node: Optional Features469213
Node: Reporting Bugs480429
Node: Major Differences From The Bourne Shell481760
Node: GNU Free Documentation License498606
Node: Indexes523780
Node: Builtin Index524231
Node: Reserved Word Index531329
Node: Variable Index533774
Node: Function Index550905
Node: Concept Index564686

End Tag Table
BIN
View File
Binary file not shown.
+1499 -1482
View File
File diff suppressed because it is too large Load Diff
+120 -122
View File
@@ -2,9 +2,9 @@ This is bashref.info, produced by makeinfo version 6.8 from
bashref.texi.
This text is a brief description of the features that are present in the
Bash shell (version 5.3, 28 June 2023).
Bash shell (version 5.3, 29 June 2023).
This is Edition 5.3, last updated 28 June 2023, of 'The GNU Bash
This is Edition 5.3, last updated 29 June 2023, of 'The GNU Bash
Reference Manual', for 'Bash', Version 5.3.
Copyright (C) 1988-2023 Free Software Foundation, Inc.
@@ -27,10 +27,10 @@ Bash Features
*************
This text is a brief description of the features that are present in the
Bash shell (version 5.3, 28 June 2023). The Bash home page is
Bash shell (version 5.3, 29 June 2023). The Bash home page is
<http://www.gnu.org/software/bash/>.
This is Edition 5.3, last updated 28 June 2023, of 'The GNU Bash
This is Edition 5.3, last updated 29 June 2023, of 'The GNU Bash
Reference Manual', for 'Bash', Version 5.3.
Bash contains features that appear in other popular shells, and some
@@ -1659,7 +1659,7 @@ substitution.
After these expansions are performed, quote characters present in the
original word are removed unless they have been quoted themselves
("quote removal").
("quote removal"). *Note Quote Removal:: for more details.
Only brace expansion, word splitting, and filename expansion can
increase the number of words of the expansion; other expansions expand a
@@ -1667,9 +1667,6 @@ single word to a single word. The only exceptions to this are the
expansions of '"$@"' and '$*' (*note Special Parameters::), and
'"${NAME[@]}"' and '${NAME[*]}' (*note Arrays::).
After all expansions, 'quote removal' (*note Quote Removal::) is
performed.

File: bashref.info, Node: Brace Expansion, Next: Tilde Expansion, Up: Shell Expansions
@@ -3454,14 +3451,15 @@ standard.
'hash'
hash [-r] [-p FILENAME] [-dt] [NAME]
Each time 'hash' is invoked, it remembers the full pathnames of the
Each time 'hash' is invoked, it remembers the full filenames of the
commands specified as NAME arguments, so they need not be searched
for on subsequent invocations. The commands are found by searching
through the directories listed in '$PATH'. Any
previously-remembered pathname is discarded. The '-p' option
previously-remembered filename is discarded. The '-p' option
inhibits the path search, and FILENAME is used as the location of
NAME. The '-r' option causes the shell to forget all remembered
locations. The '-d' option causes the shell to forget the
locations. Assigning to the 'PATH' variable also clears all hashed
filenames. The '-d' option causes the shell to forget the
remembered location of each NAME. If the '-t' option is supplied,
the full pathname to which each NAME corresponds is printed. If
multiple NAME arguments are supplied with '-t', the NAME is printed
@@ -12031,7 +12029,7 @@ D.1 Index of Shell Builtin Commands
* :: Bourne Shell Builtins.
(line 11)
* [: Bourne Shell Builtins.
(line 280)
(line 281)
* alias: Bash Builtins. (line 11)
* bg: Job Control Builtins.
(line 7)
@@ -12093,36 +12091,36 @@ D.1 Index of Shell Builtin Commands
* pushd: Directory Stack Builtins.
(line 69)
* pwd: Bourne Shell Builtins.
(line 217)
(line 218)
* read: Bash Builtins. (line 504)
* readarray: Bash Builtins. (line 601)
* readonly: Bourne Shell Builtins.
(line 227)
(line 228)
* return: Bourne Shell Builtins.
(line 246)
(line 247)
* set: The Set Builtin. (line 11)
* shift: Bourne Shell Builtins.
(line 267)
(line 268)
* shopt: The Shopt Builtin. (line 9)
* source: Bash Builtins. (line 610)
* suspend: Job Control Builtins.
(line 116)
* test: Bourne Shell Builtins.
(line 280)
(line 281)
* times: Bourne Shell Builtins.
(line 365)
(line 366)
* trap: Bourne Shell Builtins.
(line 371)
(line 372)
* true: Bourne Shell Builtins.
(line 433)
(line 434)
* type: Bash Builtins. (line 615)
* typeset: Bash Builtins. (line 653)
* ulimit: Bash Builtins. (line 659)
* umask: Bourne Shell Builtins.
(line 438)
(line 439)
* unalias: Bash Builtins. (line 765)
* unset: Bourne Shell Builtins.
(line 456)
(line 457)
* wait: Job Control Builtins.
(line 76)
@@ -12829,106 +12827,106 @@ Node: Shell Parameters61998
Node: Positional Parameters66386
Node: Special Parameters67288
Node: Shell Expansions70502
Node: Brace Expansion72629
Node: Tilde Expansion75363
Node: Shell Parameter Expansion77984
Node: Command Substitution96386
Node: Arithmetic Expansion99850
Node: Process Substitution100818
Node: Word Splitting101938
Node: Filename Expansion103986
Node: Pattern Matching106919
Node: Quote Removal111921
Node: Redirections112216
Node: Executing Commands121909
Node: Simple Command Expansion122579
Node: Command Search and Execution124689
Node: Command Execution Environment127076
Node: Environment130111
Node: Exit Status131774
Node: Signals133558
Node: Shell Scripts137007
Node: Shell Builtin Commands140034
Node: Bourne Shell Builtins142072
Node: Bash Builtins164406
Node: Modifying Shell Behavior196405
Node: The Set Builtin196750
Node: The Shopt Builtin207348
Node: Special Builtins223355
Node: Shell Variables224334
Node: Bourne Shell Variables224771
Node: Bash Variables226875
Node: Bash Features261832
Node: Invoking Bash262845
Node: Bash Startup Files268858
Node: Interactive Shells273989
Node: What is an Interactive Shell?274400
Node: Is this Shell Interactive?275049
Node: Interactive Shell Behavior275864
Node: Bash Conditional Expressions279493
Node: Shell Arithmetic284135
Node: Aliases287096
Node: Arrays289990
Node: The Directory Stack296553
Node: Directory Stack Builtins297337
Node: Controlling the Prompt301597
Node: The Restricted Shell304562
Node: Bash POSIX Mode307172
Node: Shell Compatibility Mode323088
Node: Job Control331332
Node: Job Control Basics331792
Node: Job Control Builtins336794
Node: Job Control Variables342589
Node: Command Line Editing343745
Node: Introduction and Notation345416
Node: Readline Interaction347039
Node: Readline Bare Essentials348230
Node: Readline Movement Commands350019
Node: Readline Killing Commands350979
Node: Readline Arguments352900
Node: Searching353944
Node: Readline Init File356130
Node: Readline Init File Syntax357391
Node: Conditional Init Constructs381182
Node: Sample Init File385378
Node: Bindable Readline Commands388502
Node: Commands For Moving389706
Node: Commands For History391757
Node: Commands For Text396751
Node: Commands For Killing400400
Node: Numeric Arguments403433
Node: Commands For Completion404572
Node: Keyboard Macros408763
Node: Miscellaneous Commands409451
Node: Readline vi Mode415489
Node: Programmable Completion416396
Node: Programmable Completion Builtins424176
Node: A Programmable Completion Example435296
Node: Using History Interactively440544
Node: Bash History Facilities441228
Node: Bash History Builtins444233
Node: History Interaction449257
Node: Event Designators452877
Node: Word Designators454231
Node: Modifiers455991
Node: Installing Bash457799
Node: Basic Installation458936
Node: Compilers and Options462658
Node: Compiling For Multiple Architectures463399
Node: Installation Names465091
Node: Specifying the System Type467200
Node: Sharing Defaults467917
Node: Operation Controls468590
Node: Optional Features469548
Node: Reporting Bugs480767
Node: Major Differences From The Bourne Shell482101
Node: GNU Free Documentation License498950
Node: Indexes524127
Node: Builtin Index524581
Node: Reserved Word Index531682
Node: Variable Index534130
Node: Function Index551264
Node: Concept Index565048
Node: Brace Expansion72590
Node: Tilde Expansion75324
Node: Shell Parameter Expansion77945
Node: Command Substitution96347
Node: Arithmetic Expansion99811
Node: Process Substitution100779
Node: Word Splitting101899
Node: Filename Expansion103947
Node: Pattern Matching106880
Node: Quote Removal111882
Node: Redirections112177
Node: Executing Commands121870
Node: Simple Command Expansion122540
Node: Command Search and Execution124650
Node: Command Execution Environment127037
Node: Environment130072
Node: Exit Status131735
Node: Signals133519
Node: Shell Scripts136968
Node: Shell Builtin Commands139995
Node: Bourne Shell Builtins142033
Node: Bash Builtins164440
Node: Modifying Shell Behavior196439
Node: The Set Builtin196784
Node: The Shopt Builtin207382
Node: Special Builtins223389
Node: Shell Variables224368
Node: Bourne Shell Variables224805
Node: Bash Variables226909
Node: Bash Features261866
Node: Invoking Bash262879
Node: Bash Startup Files268892
Node: Interactive Shells274023
Node: What is an Interactive Shell?274434
Node: Is this Shell Interactive?275083
Node: Interactive Shell Behavior275898
Node: Bash Conditional Expressions279527
Node: Shell Arithmetic284169
Node: Aliases287130
Node: Arrays290024
Node: The Directory Stack296587
Node: Directory Stack Builtins297371
Node: Controlling the Prompt301631
Node: The Restricted Shell304596
Node: Bash POSIX Mode307206
Node: Shell Compatibility Mode323122
Node: Job Control331366
Node: Job Control Basics331826
Node: Job Control Builtins336828
Node: Job Control Variables342623
Node: Command Line Editing343779
Node: Introduction and Notation345450
Node: Readline Interaction347073
Node: Readline Bare Essentials348264
Node: Readline Movement Commands350053
Node: Readline Killing Commands351013
Node: Readline Arguments352934
Node: Searching353978
Node: Readline Init File356164
Node: Readline Init File Syntax357425
Node: Conditional Init Constructs381216
Node: Sample Init File385412
Node: Bindable Readline Commands388536
Node: Commands For Moving389740
Node: Commands For History391791
Node: Commands For Text396785
Node: Commands For Killing400434
Node: Numeric Arguments403467
Node: Commands For Completion404606
Node: Keyboard Macros408797
Node: Miscellaneous Commands409485
Node: Readline vi Mode415523
Node: Programmable Completion416430
Node: Programmable Completion Builtins424210
Node: A Programmable Completion Example435330
Node: Using History Interactively440578
Node: Bash History Facilities441262
Node: Bash History Builtins444267
Node: History Interaction449291
Node: Event Designators452911
Node: Word Designators454265
Node: Modifiers456025
Node: Installing Bash457833
Node: Basic Installation458970
Node: Compilers and Options462692
Node: Compiling For Multiple Architectures463433
Node: Installation Names465125
Node: Specifying the System Type467234
Node: Sharing Defaults467951
Node: Operation Controls468624
Node: Optional Features469582
Node: Reporting Bugs480801
Node: Major Differences From The Bourne Shell482135
Node: GNU Free Documentation License498984
Node: Indexes524161
Node: Builtin Index524615
Node: Reserved Word Index531716
Node: Variable Index534164
Node: Function Index551298
Node: Concept Index565082

End Tag Table
+50 -25
View File
@@ -1,12 +1,12 @@
This is pdfTeX, Version 3.141592653-2.6-1.40.22 (TeX Live 2021/MacPorts 2021.58693_0) (preloaded format=etex 2021.8.30) 16 JUN 2023 12:11
This is pdfTeX, Version 3.141592653-2.6-1.40.22 (TeX Live 2021/MacPorts 2021.58693_0) (preloaded format=pdfetex 2021.8.30) 5 JUL 2023 11:27
entering extended mode
restricted \write18 enabled.
file:line:error style messages enabled.
%&-line parsing enabled.
**\nonstopmode \input /usr/local/src/bash/bash-20230616/doc/bashref.texi \input
/usr/local/src/bash/bash-20230616/doc/bashref.texi
(/usr/local/src/bash/bash-20230616/doc/bashref.texi
(/usr/local/src/bash/bash-20230616/doc/texinfo.tex
**\input /usr/local/src/bash/bash-20230703/doc/bashref.texi \input /usr/local/s
rc/bash/bash-20230703/doc/bashref.texi
(/usr/local/src/bash/bash-20230703/doc/bashref.texi
(/usr/local/src/bash/bash-20230703/doc/texinfo.tex
Loading texinfo [version 2015-11-22.14]:
\outerhsize=\dimen16
\outervsize=\dimen17
@@ -162,20 +162,23 @@ This is `epsf.tex' v2.7.4 <14 February 2011>
texinfo.tex: doing @include of version.texi
(/usr/local/src/bash/bash-20230616/doc/version.texi) [1] [2]
(/usr/local/build/bash/bash-20230616/doc/bashref.toc [-1] [-2] [-3]) [-4]
Chapter 1
(/usr/local/src/bash/bash-20230703/doc/version.texi) [1{/opt/local/var/db/texmf
/fonts/map/pdftex/updmap/pdftex.map}] [2]
(/usr/local/build/bash/bash-20230703/doc/bashref.toc [-1] [-2] [-3]) [-4]
(/usr/local/build/bash/bash-20230703/doc/bashref.toc)
(/usr/local/build/bash/bash-20230703/doc/bashref.toc) Chapter 1
\openout0 = `bashref.toc'.
(/usr/local/build/bash/bash-20230616/doc/bashref.aux)
(/usr/local/build/bash/bash-20230703/doc/bashref.aux)
\openout1 = `bashref.aux'.
Chapter 2
[1] [2]
Chapter 2 [1] [2]
@cpindfile=@write2
\openout2 = `bashref.cp'.
[3] Chapter 3 [4] [5] [6] [7]
[3] Chapter 3 [4] [5] [6] [7]
@vrindfile=@write3
\openout3 = `bashref.vr'.
@@ -227,7 +230,7 @@ Overfull \hbox (5.95723pt too wide) in paragraph at lines 724--725
[49] [50] [51]
[52] [53] [54] [55] [56] [57] [58] [59] [60] [61] [62] [63] [64] [65] [66]
[67]
Overfull \hbox (38.26585pt too wide) in paragraph at lines 5357--5357
Overfull \hbox (38.26585pt too wide) in paragraph at lines 5355--5355
[]@texttt set [-abefhkmnptuvxBCEHPT] [-o @textttsl option-name@texttt ] [--] [
-] [@textttsl ar-gu-ment []@texttt ][]
@@ -240,7 +243,7 @@ Overfull \hbox (38.26585pt too wide) in paragraph at lines 5357--5357
.etc.
Overfull \hbox (38.26585pt too wide) in paragraph at lines 5358--5358
Overfull \hbox (38.26585pt too wide) in paragraph at lines 5356--5356
[]@texttt set [+abefhkmnptuvxBCEHPT] [+o @textttsl option-name@texttt ] [--] [
-] [@textttsl ar-gu-ment []@texttt ][]
@@ -259,7 +262,7 @@ Overfull \hbox (38.26585pt too wide) in paragraph at lines 5358--5358
[118] [119]
texinfo.tex: doing @include of rluser.texi
(/usr/local/src/bash/bash-20230616/lib/readline/doc/rluser.texi
(/usr/local/src/bash/bash-20230703/lib/readline/doc/rluser.texi
Chapter 8 [120] [121] [122] [123] [124] [125] [126] [127] [128] [129] [130]
[131]
Underfull \hbox (badness 7540) in paragraph at lines 874--880
@@ -309,10 +312,10 @@ gnored[]
texinfo.tex: doing @include of hsuser.texi
(/usr/local/src/bash/bash-20230616/lib/readline/doc/hsuser.texi Chapter 9
(/usr/local/src/bash/bash-20230703/lib/readline/doc/hsuser.texi Chapter 9
[156] [157] [158] [159] [160] [161]) Chapter 10 [162] [163] [164] [165]
[166]
Underfull \hbox (badness 10000) in paragraph at lines 9656--9665
Underfull \hbox (badness 10000) in paragraph at lines 9662--9671
[]@textrm All of the fol-low-ing op-tions ex-cept for `@texttt alt-array-implem
entation[]@textrm '[],
@@ -325,7 +328,7 @@ entation[]@textrm '[],
.etc.
Underfull \hbox (badness 10000) in paragraph at lines 9656--9665
Underfull \hbox (badness 10000) in paragraph at lines 9662--9671
@textrm `@texttt disabled-builtins[]@textrm '[], `@texttt direxpand-default[]@t
extrm '[], `@texttt strict-posix-default[]@textrm '[], and
@@ -341,16 +344,38 @@ extrm '[], `@texttt strict-posix-default[]@textrm '[], and
[176] [177] Appendix C [178]
texinfo.tex: doing @include of fdl.texi
(/usr/local/src/bash/bash-20230616/doc/fdl.texi
(/usr/local/src/bash/bash-20230703/doc/fdl.texi
[179] [180] [181] [182] [183] [184] [185]) Appendix D [186] [187] [188]
[189] [190] [191] [192] [193] [194] [195] )
Here is how much of TeX's memory you used:
3531 strings out of 497096
40273 string characters out of 6206923
87714 words of memory out of 5000000
4700 multiletter control sequences out of 15000+600000
4102 strings out of 497086
47608 string characters out of 6206517
142074 words of memory out of 5000000
4869 multiletter control sequences out of 15000+600000
34315 words of font info for 116 fonts, out of 8000000 for 9000
51 hyphenation exceptions out of 8191
16i,6n,16p,402b,942s stack positions out of 5000i,500n,10000p,200000b,80000s
16i,6n,16p,389b,983s stack positions out of 5000i,500n,10000p,200000b,80000s
{/opt/local/share/texmf-texlive/font
s/enc/dvips/cm-super/cm-super-t1.enc}</opt/local/share/texmf-texlive/fonts/type
1/public/amsfonts/cm/cmbx12.pfb></opt/local/share/texmf-texlive/fonts/type1/pub
lic/amsfonts/cm/cmcsc10.pfb></opt/local/share/texmf-texlive/fonts/type1/public/
amsfonts/cm/cmmi10.pfb></opt/local/share/texmf-texlive/fonts/type1/public/amsfo
nts/cm/cmmi12.pfb></opt/local/share/texmf-texlive/fonts/type1/public/amsfonts/c
m/cmmi9.pfb></opt/local/share/texmf-texlive/fonts/type1/public/amsfonts/cm/cmr1
0.pfb></opt/local/share/texmf-texlive/fonts/type1/public/amsfonts/cm/cmr9.pfb><
/opt/local/share/texmf-texlive/fonts/type1/public/amsfonts/cm/cmsl10.pfb></opt/
local/share/texmf-texlive/fonts/type1/public/amsfonts/cm/cmsltt10.pfb></opt/loc
al/share/texmf-texlive/fonts/type1/public/amsfonts/cm/cmsy10.pfb></opt/local/sh
are/texmf-texlive/fonts/type1/public/amsfonts/cm/cmti10.pfb></opt/local/share/t
exmf-texlive/fonts/type1/public/amsfonts/cm/cmtt10.pfb></opt/local/share/texmf-
texlive/fonts/type1/public/amsfonts/cm/cmtt12.pfb></opt/local/share/texmf-texli
ve/fonts/type1/public/amsfonts/cm/cmtt9.pfb></opt/local/share/texmf-texlive/fon
ts/type1/public/cm-super/sfrm1095.pfb></opt/local/share/texmf-texlive/fonts/typ
e1/public/cm-super/sfrm1440.pfb>
Output written on bashref.pdf (201 pages, 809290 bytes).
PDF statistics:
2808 PDF objects out of 2984 (max. 8388607)
2560 compressed objects within 26 object streams
329 named destinations out of 1000 (max. 500000)
1157 words of extra memory for PDF output out of 10000 (max. 10000000)
Output written on bashref.dvi (201 pages, 842012 bytes).
BIN
View File
Binary file not shown.
+3 -2
View File
@@ -4077,15 +4077,16 @@ If @code{getopts} is silent, then a colon (@samp{:}) is placed in
hash [-r] [-p @var{filename}] [-dt] [@var{name}]
@end example
Each time @code{hash} is invoked, it remembers the full pathnames of the
Each time @code{hash} is invoked, it remembers the full filenames of the
commands specified as @var{name} arguments,
so they need not be searched for on subsequent invocations.
The commands are found by searching through the directories listed in
@env{$PATH}.
Any previously-remembered pathname is discarded.
Any previously-remembered filename is discarded.
The @option{-p} option inhibits the path search, and @var{filename} is
used as the location of @var{name}.
The @option{-r} option causes the shell to forget all remembered locations.
Assigning to the @env{PATH} variable also clears all hashed filenames.
The @option{-d} option causes the shell to forget the remembered location
of each @var{name}.
If the @option{-t} option is supplied, the full pathname to which each
+655 -654
View File
File diff suppressed because it is too large Load Diff
+1 -2
View File
@@ -147,8 +147,7 @@ sleep_builtin (WORD_LIST *list)
*
* A heuristic: if the conversion failed, but the argument appears to
* contain a GNU-like interval specifier (e.g. "1m30s"), try to parse
* it. If we can't, return the right exit code to tell
* execute_builtin to try and execute a disk command instead.
* it. If we can't, it's an error.
*/
if (r == 0 && (strchr ("dhms", *ep) || strpbrk (list->word->word, "dhms")))
r = parse_gnutimefmt (list->word->word, &sec, &usec);
+9 -6
View File
@@ -2566,17 +2566,20 @@ rl_filename_completion_function (const char *text, int state)
if (filename_len == 0)
{
if (_rl_match_hidden_files == 0 && HIDDEN_FILE (convfn))
continue;
{
if (convfn != dentry)
xfree (convfn);
continue;
}
if (convfn[0] != '.' ||
(convfn[1] && (convfn[1] != '.' || convfn[2])))
break;
}
else
{
if (complete_fncmp (convfn, convlen, filename, filename_len))
break;
}
else if (complete_fncmp (convfn, convlen, filename, filename_len))
break;
else if (convfn != dentry)
xfree (convfn);
}
if (entry == 0)
+11 -22
View File
@@ -286,8 +286,7 @@ static char syscom[1024];
/* List the file(s) named in arg. */
int
com_list (arg)
char *arg;
com_list (char *arg)
{
if (!arg)
arg = "";
@@ -297,8 +296,7 @@ com_list (arg)
}
int
com_view (arg)
char *arg;
com_view (char *arg)
{
if (!valid_argument ("view", arg))
return 1;
@@ -313,16 +311,14 @@ com_view (arg)
}
int
com_rename (arg)
char *arg;
com_rename (char *arg)
{
too_dangerous ("rename");
return (1);
}
int
com_stat (arg)
char *arg;
com_stat (char *arg)
{
struct stat finfo;
@@ -350,8 +346,7 @@ com_stat (arg)
}
int
com_delete (arg)
char *arg;
com_delete (char *arg)
{
too_dangerous ("delete");
return (1);
@@ -360,8 +355,7 @@ com_delete (arg)
/* Print out help for ARG, or for all of the commands if ARG is
not present. */
int
com_help (arg)
char *arg;
com_help (char *arg)
{
register int i;
int printed = 0;
@@ -400,8 +394,7 @@ com_help (arg)
/* Change to the directory ARG. */
int
com_cd (arg)
char *arg;
com_cd (char *arg)
{
if (chdir (arg) == -1)
{
@@ -415,8 +408,7 @@ com_cd (arg)
/* Print out the current working directory. */
int
com_pwd (ignore)
char *ignore;
com_pwd (char *ignore)
{
char dir[1024], *s;
@@ -433,8 +425,7 @@ com_pwd (ignore)
/* The user wishes to quit using this program. Just set DONE non-zero. */
int
com_quit (arg)
char *arg;
com_quit (char *arg)
{
done = 1;
return (0);
@@ -442,8 +433,7 @@ com_quit (arg)
/* Function which tells you that you can't do this. */
void
too_dangerous (caller)
char *caller;
too_dangerous (char *caller)
{
fprintf (stderr,
"%s: Too dangerous for me to distribute. Write it yourself.\n",
@@ -453,8 +443,7 @@ too_dangerous (caller)
/* Return non-zero if ARG is a valid argument for CALLER, else print
an error message and return zero. */
int
valid_argument (caller, arg)
char *caller, *arg;
valid_argument (char *caller, char *arg)
{
if (!arg || !*arg)
{
+54 -16
View File
@@ -41,11 +41,13 @@ extern int errno;
# include "stat-time.h"
#endif
#include "error.h"
/* A version of `alarm' using setitimer if it's available. */
#if defined (HAVE_SETITIMER)
unsigned int
falarm(unsigned int secs, unsigned int usecs)
falarm (unsigned int secs, unsigned int usecs)
{
struct itimerval it, oit;
@@ -82,57 +84,93 @@ falarm (unsigned int secs, unsigned int usecs)
/* A version of sleep using fractional seconds and select. I'd like to use
`usleep', but it's already taken */
#if defined (HAVE_NANOSLEEP)
static int
nsleep (unsigned int sec, unsigned int usec)
{
int r;
struct timespec req, rem;
req.tv_sec = sec;
req.tv_nsec = usec * 1000;
for (;;)
{
QUIT;
r = nanosleep (&req, &rem);
if (r == 0 || errno != EINTR)
return r;
req = rem;
}
return r;
}
#endif
#if defined (HAVE_TIMEVAL) && (defined (HAVE_SELECT) || defined (HAVE_PSELECT))
int
fsleep(unsigned int sec, unsigned int usec)
static int
ssleep (unsigned int sec, unsigned int usec)
{
int e, r;
sigset_t blocked_sigs;
#if defined (HAVE_PSELECT)
# if defined (HAVE_PSELECT)
struct timespec ts;
#else
# else
sigset_t prevmask;
struct timeval tv;
#endif
# endif
sigemptyset (&blocked_sigs);
# if defined (SIGCHLD)
sigaddset (&blocked_sigs, SIGCHLD);
# endif
#if defined (HAVE_PSELECT)
# if defined (HAVE_PSELECT)
ts.tv_sec = sec;
ts.tv_nsec = usec * 1000;
#else
# else
sigemptyset (&prevmask);
tv.tv_sec = sec;
tv.tv_usec = usec;
#endif /* !HAVE_PSELECT */
# endif /* !HAVE_PSELECT */
do
{
#if defined (HAVE_PSELECT)
# if defined (HAVE_PSELECT)
r = pselect(0, (fd_set *)0, (fd_set *)0, (fd_set *)0, &ts, &blocked_sigs);
#else
# else
sigprocmask (SIG_SETMASK, &blocked_sigs, &prevmask);
r = select(0, (fd_set *)0, (fd_set *)0, (fd_set *)0, &tv);
sigprocmask (SIG_SETMASK, &prevmask, NULL);
#endif
# endif
e = errno;
if (r < 0 && errno == EINTR)
return -1; /* caller will handle */
return -1; /* caller will handle XXX - QUIT;? */
errno = e;
}
while (r < 0 && errno == EINTR);
return r;
}
#else /* !HAVE_TIMEVAL || !HAVE_SELECT */
int
fsleep(unsigned int sec, unsigned int usec)
#endif
#if !defined (HAVE_SELECT)
static int
ancientsleep(unsigned int sec, unsigned int usec)
{
if (usec >= 500000) /* round */
sec++;
return (sleep(sec));
}
#endif
int
fsleep(unsigned int sec, unsigned int usec)
{
#if defined (HAVE_NANOSLEEP)
return (nsleep (sec, usec));
#elif defined (HAVE_TIMEVAL) && (defined (HAVE_SELECT) || defined (HAVE_PSELECT))
return (ssleep (sec, usec));
#else /* !HAVE_TIMEVAL || !HAVE_SELECT */
return (ancientsleep (sec, usec));
#endif /* !HAVE_TIMEVAL || !HAVE_SELECT */
}
BIN
View File
Binary file not shown.
+23 -23
View File
@@ -57,7 +57,7 @@ msgstr "bash_execute_unix_command: nije moguće pronaći prečac (keymap) za nar
#: bashline.c:4637
#, c-format
msgid "%s: first non-whitespace character is not `\"'"
msgstr "%s: prvi nebijeli znak nije „\"“"
msgstr "%s: prvi ne bijeli znak nije „\"“"
#: bashline.c:4666
#, c-format
@@ -1012,7 +1012,7 @@ msgstr "%s: nevezana varijabla"
#: eval.c:243
msgid "\atimed out waiting for input: auto-logout\n"
msgstr "\avrijeme čekanja na ulaz je isteklo: automatska-odjava\n"
msgstr "\atimed out, čekanje na ulaz je isteklo: auto-logout, automatska-odjava\n"
#: execute_cmd.c:555
#, c-format
@@ -1098,7 +1098,7 @@ msgstr "podlijevanje stȏga rekurzija (prazni stȏg)"
#: expr.c:478
msgid "syntax error in expression"
msgstr "sintaktična greška u izrazu"
msgstr "sintaktička greška u izrazu"
#: expr.c:522
msgid "attempted assignment to non-variable"
@@ -1106,7 +1106,7 @@ msgstr "pokušaj dodjeljivanja ne-varijabli (objektu koji nije varijabla)"
#: expr.c:531
msgid "syntax error in variable assignment"
msgstr "sintaktična greška u dodjeljivanju varijabli"
msgstr "sintaktička greška u dodjeljivanju varijabli"
#: expr.c:545 expr.c:912
msgid "division by 0"
@@ -1134,11 +1134,11 @@ msgstr "nedostaje „)“"
#: expr.c:1108 expr.c:1492
msgid "syntax error: operand expected"
msgstr "sintaktična greška: očekivan je operand"
msgstr "sintaktička greška: očekivan je operand"
#: expr.c:1494
msgid "syntax error: invalid arithmetic operator"
msgstr "sintaktična greška: nevaljan aritmetički operator"
msgstr "sintaktička greška: nevaljan aritmetički operator"
#: expr.c:1518
#, c-format
@@ -1471,16 +1471,16 @@ msgstr "Pošta u %s je već pročitana\n"
#: make_cmd.c:314
msgid "syntax error: arithmetic expression required"
msgstr "sintaktična greška: nužan je aritmetički izraz"
msgstr "sintaktička greška: nužan je aritmetički izraz"
#: make_cmd.c:316
msgid "syntax error: `;' unexpected"
msgstr "sintaktična greška: neočekivan „;“ znak"
msgstr "sintaktička greška: neočekivan „;“ znak"
#: make_cmd.c:317
#, c-format
msgid "syntax error: `((%s))'"
msgstr "sintaktična greška: „((%s))“"
msgstr "sintaktička greška: „((%s))“"
#: make_cmd.c:569
#, c-format
@@ -1520,11 +1520,11 @@ msgstr "neočekivan kraj datoteke (EOF) pri traženju „]]“"
#: parse.y:4457
#, c-format
msgid "syntax error in conditional expression: unexpected token `%s'"
msgstr "sintaktična greška u uvjetnom izrazu: neočekivan simbol „%s“"
msgstr "sintaktička greška u uvjetnom izrazu: neočekivan simbol „%s“"
#: parse.y:4461
msgid "syntax error in conditional expression"
msgstr "sintaktična greška u uvjetnom izrazu"
msgstr "sintaktička greška u uvjetnom izrazu"
#: parse.y:4539
#, c-format
@@ -1580,20 +1580,20 @@ msgstr "neočekivan simbol %d u uvjetnoj naredbi"
#: parse.y:6118
#, c-format
msgid "syntax error near unexpected token `%s'"
msgstr "sintaktična greška blizu neočekivanog simbola „%s“"
msgstr "sintaktička greška blizu neočekivanog simbola „%s“"
#: parse.y:6137
#, c-format
msgid "syntax error near `%s'"
msgstr "sintaktična greška blizu „%s“"
msgstr "sintaktička greška blizu „%s“"
#: parse.y:6151
msgid "syntax error: unexpected end of file"
msgstr "sintaktična greška: neočekivani kraj datoteke"
msgstr "sintaktička greška: neočekivani kraj datoteke"
#: parse.y:6151
msgid "syntax error"
msgstr "sintaktična greška"
msgstr "sintaktička greška"
#: parse.y:6216
#, c-format
@@ -2086,7 +2086,7 @@ msgstr "nedostaje „]“"
#: test.c:914
#, c-format
msgid "syntax error: `%s' unexpected"
msgstr "sintaktična greška: neočekivan „%s“"
msgstr "sintaktička greška: neočekivan „%s“"
#: trap.c:220
msgid "invalid signal number"
@@ -2531,7 +2531,7 @@ msgstr "printf [-v VARIJABLA] FORMAT [ARGUMENTI]"
msgid "complete [-abcdefgjksuv] [-pr] [-DEI] [-o option] [-A action] [-G globpat] [-W wordlist] [-F function] [-C command] [-X filterpat] [-P prefix] [-S suffix] [name ...]"
msgstr ""
"complete [-abcdefgjksuv] [-pr] [-DEI] [-o OPCIJA] [-A AKCIJA] [-C NAREDBA]\n"
" [-F FUNCIJA] [-G GLOB_UZORAK] [-P PREFIKS] [-S SUFIKS]\n"
" [-F FUNKCIJA] [-G GLOB_UZORAK] [-P PREFIKS] [-S SUFIKS]\n"
" [-W POPIS_RIJEČI] [-X FILTAR_UZORAKA] [IME...]"
#: builtins.c:235
@@ -2641,8 +2641,8 @@ msgid ""
msgstr ""
"Prikaže i postavlja „Readline“ prečace (key binding) i varijable.\n"
"\n"
" Veže sekvenciju tipki (key sequence, prečac) na „Readline“\n"
" funkciju ili na makro ili na „Readline“ varijablu. Sintaksa za argumente\n"
" Veže sekvenciju tipki (key sequence, prečac) na „Readline“ funkciju\n"
" ili na makronaredbe ili na „Readline“ varijablu. Sintaksa za argumente\n"
" koji nisu opcija je ista kao za ~/.inputrc, ali moraju biti proslijeđeni\n"
" kao jedan argument; primjer: bind '\"\\C-x\\C-r\": re-read-init-file'\n"
"\n"
@@ -2658,9 +2658,9 @@ msgstr ""
" koji se može iskoristiti kao ulaz\n"
" -r PREČAC razveže PREČAC (ukloni sekvenciju tipki za prečac)\n"
" -q FUNKCIJA ispita i ispiše tipke koje pozivaju tu FUNKCIJU\n"
" -S izlista prečace (sekvencije tipki) koje pozivaju makroe\n"
" s njihovim vrijednostima\n"
" -s ispiše sekvencije tipki poje pozivaju makroe s\n"
" -S izlista prečace (sekvencije tipki) koje pozivaju\n"
" makronaredbe s njihovim vrijednostima\n"
" -s ispiše sekvencije tipki koje pozivaju makronaredbe s\n"
" njihovim vrijednostima u obliku koji se može\n"
" iskoristiti kao ulaz\n"
" -u FUNKCIJA razveže sve prečace vezane na tu FUNKCIJU\n"
@@ -4981,7 +4981,7 @@ msgstr ""
" kao regularni izraz.\n"
"\n"
" Operatori „&&“ i „|| ne vrednuju IZRAZ2 ako je IZRAZ1 dovoljan za\n"
" određivanje konačnog rezurlata.\n"
" određivanje konačnog rezulata.\n"
"\n"
" Završi s uspjehom ili 1 ovisno o IZRAZU."
+7 -3
View File
@@ -3422,7 +3422,7 @@ static SHELL_VAR *
do_compound_assignment (const char *name, char *value, int flags)
{
SHELL_VAR *v;
int mklocal, mkassoc, mkglobal, chklocal;
int mklocal, mkassoc, mkglobal, chklocal, r;
WORD_LIST *list;
char *newname; /* used for local nameref references */
@@ -3447,9 +3447,11 @@ do_compound_assignment (const char *name, char *value, int flags)
else if (v == 0 || (array_p (v) == 0 && assoc_p (v) == 0) || v->context != variable_context)
v = make_local_array_variable (newname, 0);
if (v)
assign_compound_array_list (v, list, flags);
r = assign_compound_array_list (v, list, flags);
if (list)
dispose_words (list);
if (r == 0) /* compound assignment error */
return ((SHELL_VAR *)0);
}
/* In a function but forcing assignment in global context. CHKLOCAL means to
check for an existing local variable first. */
@@ -3478,9 +3480,11 @@ do_compound_assignment (const char *name, char *value, int flags)
else if (v && mkassoc == 0 && array_p (v) == 0)
v = convert_var_to_array (v);
if (v)
assign_compound_array_list (v, list, flags);
r = assign_compound_array_list (v, list, flags);
if (list)
dispose_words (list);
if (r == 0) /* compound assignment error */
return ((SHELL_VAR *)0);
}
else
{
+9 -9
View File
@@ -55,8 +55,8 @@ this
./array.tests: line 125: d[7]: cannot assign list to array member
./array.tests: line 127: []=abcde: bad array subscript
./array.tests: line 127: [*]=last: cannot assign to non-numeric index
./array.tests: line 127: [-65]=negative: bad array subscript
./array.tests: line 128: [*]=last: cannot assign to non-numeric index
./array.tests: line 129: [-65]=negative: bad array subscript
declare -a BASH_ARGC=()
declare -a BASH_ARGV=()
declare -a BASH_LINENO=([0]="0")
@@ -69,8 +69,8 @@ declare -ar c
declare -a d=([1]="test test")
declare -a e=()
declare -a f=([0]="" [1]="bdef" [2]="hello world" [3]="test" [4]="ninth element")
./array.tests: line 135: unset: ps1: not an array variable
./array.tests: line 139: declare: c: cannot destroy array variables in this way
./array.tests: line 137: unset: ps1: not an array variable
./array.tests: line 141: declare: c: cannot destroy array variables in this way
this of
this is a test of read using arrays
this test
@@ -129,7 +129,7 @@ grep [ 123 ] *
6 7 9 5
length = 3
value = new1 new2 new3
./array.tests: line 255: narray: unbound variable
./array.tests: line 257: narray: unbound variable
./array1.sub: line 1: syntax error near unexpected token `('
./array1.sub: line 1: `printf "%s\n" -a a=(a 'b c')'
./array2.sub: line 1: declare: `[]=asdf': not a valid identifier
@@ -156,10 +156,10 @@ for case if then else
12 14 16 18 20
4414758999202
aaa bbb
./array.tests: line 305: syntax error near unexpected token `<>'
./array.tests: line 305: `metas=( <> < > ! )'
./array.tests: line 306: syntax error near unexpected token `<>'
./array.tests: line 306: `metas=( [1]=<> [2]=< [3]=> [4]=! )'
./array.tests: line 307: syntax error near unexpected token `<>'
./array.tests: line 307: `metas=( <> < > ! )'
./array.tests: line 308: syntax error near unexpected token `<>'
./array.tests: line 308: `metas=( [1]=<> [2]=< [3]=> [4]=! )'
abc 3
case 4
abc case if then else 5
+2
View File
@@ -125,6 +125,8 @@ echo ${c[-4]}
d[7]=(abdedfegeee)
d=([]=abcde [1]="test test" [*]=last [-65]=negative )
d=([0]=abcde [1]="test test" [*]=last )
d=([1]="test test" [-65]=negative )
unset d[12]
unset e[*]