arrayfunc.c
- array_expand_index: call evalexp with EXP_EXPANDED flag, since we
have run the string through expand_arith_string already
+
+ 1/11
+ ----
+parser.h
+ - PST_ENDALIAS: new state, means we just consumed the last character
+ of an alias expansion and returned the fake space
+
+parse.y
+ - shell_getc: add PST_ENDALIAS to parser_state before returning the
+ fake space that marks the end of the alias, making sure to do it
+ only once. With that set, fall through to the pop_string(), making
+ sure to unset PST_ENDALIAS. Fixes alias bug reported by
+ Ante Peric <synthmeat@gmail.com>
+
+ 1/12
+ ----
+lib/glob/glob.c
+ - {extglob,wextglob}_skipname: make sure we check the rest of the
+ pattern if the extglob pattern is null, and therefore won't match
+ anything. If that is followed by a `.', quoted or unquoted, we can
+ match a leading `.' in the pathname. This code is currently not
+ active.
+
+builtins/hash.def
+ - hash_builtin: if -d is supplied without an argument, print an error
+ message and return failure, just like -t without an argument. Fixes
+ inconsistency reported by Dan Jacobson <jidanni@jidanni.org>
+
+ 1/13
+ ----
+parse.y
+ - shell_getc: use shellblank when testing the last character of an
+ alias to determine whether or not to add a trailing space instead
+ of testing against a space only. These are the non-shell-metacharacters
+ that can delimit words. Used together with PST_ENDALIAS
list = loptend;
/* hash -t requires at least one argument. */
- if (list == 0 && list_targets)
+ if (list == 0 && (delete || list_targets))
{
- sh_needarg ("-t");
+ sh_needarg (delete ? "-d" : "-t");
return (EXECUTION_FAILURE);
}
int flags;
{
char *pp, *pe, *t, *se;
- int n, r, negate, wild;
+ int n, r, negate, wild, nullpat;
negate = *pat == '!';
wild = *pat == '*' || *pat == '?';
return r;
}
+ /* Is the extglob pattern between the parens the null pattern? The null
+ pattern can match nothing, so should we check any remaining portion of
+ the pattern? */
+ nullpat = pe >= (pat + 2) && pe[-2] == '(' && pe[-1] == ')';
+
/* check every subpattern */
while (t = glob_patscan (pp, pe, '|'))
{
{
#if EXTENDED_GLOB
wchar_t *pp, *pe, *t, n, *se;
- int r, negate, wild;
+ int r, negate, wild, nullpat;
negate = *pat == L'!';
wild = *pat == L'*' || *pat == L'?';
return r;
}
+ /* Is the extglob pattern between the parens the null pattern? The null
+ pattern can match nothing, so should we check any remaining portion of
+ the pattern? */
+ nullpat = pe >= (pat + 2) && pe[-2] == L'(' && pe[-1] == L')';
+
/* check every subpattern */
while (t = glob_patscan_wc (pp, pe, '|'))
{
if (uc == 0 && pushed_string_list && pushed_string_list->flags != PSH_SOURCE &&
pushed_string_list->flags != PSH_DPAREN &&
(parser_state & PST_COMMENT) == 0 &&
+ (parser_state & PST_ENDALIAS) == 0 && /* only once */
shell_input_line_index > 0 &&
- shell_input_line[shell_input_line_index-1] != ' ' &&
+ shellblank (shell_input_line[shell_input_line_index-1]) == 0 &&
shell_input_line[shell_input_line_index-1] != '\n' &&
shellmeta (shell_input_line[shell_input_line_index-1]) == 0 &&
(current_delimiter (dstack) != '\'' && current_delimiter (dstack) != '"'))
{
+ parser_state |= PST_ENDALIAS;
return ' '; /* END_ALIAS */
}
#endif
/* This case works for PSH_DPAREN as well */
if (uc == 0 && pushed_string_list && pushed_string_list->flags != PSH_SOURCE)
{
+ parser_state &= ~PST_ENDALIAS;
pop_string ();
uc = shell_input_line[shell_input_line_index];
if (uc)
/* parser.h -- Everything you wanted to know about the parser, but were
afraid to ask. */
-/* Copyright (C) 1995-2010 Free Software Foundation, Inc.
+/* Copyright (C) 1995-2019 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
#define PST_REPARSE 0x040000 /* re-parsing in parse_string_to_word_list */
#define PST_REDIRLIST 0x080000 /* parsing a list of redirections preceding a simple command name */
#define PST_COMMENT 0x100000 /* parsing a shell comment; used by aliases */
+#define PST_ENDALIAS 0x200000 /* just finished expanding and consuming an alias */
/* Definition of the delimiter stack. Needed by parse.y and bashhist.c. */
struct dstack {
# comment
comment foo bar
+
+# alias ending in a tab
+alias foo="\
+ echo \"bar\" \
+ "
+
+foo
using the cached exportstr... */
list[list_index] = USE_EXPORTSTR ? savestring (value)
: mk_env_string (var->name, value, function_p (var));
-
if (USE_EXPORTSTR == 0)
SAVE_EXPORTSTR (var, list[list_index]);