Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 873931 | Differences between
and this patch

Collapse All | Expand All

(-)MANIFEST (+1 lines)
Lines 1131-1136 tests/extglob4.sub f Link Here
1131
tests/extglob5.sub	f
1131
tests/extglob5.sub	f
1132
tests/extglob6.sub	f
1132
tests/extglob6.sub	f
1133
tests/extglob7.sub	f
1133
tests/extglob7.sub	f
1134
tests/extglob8.sub	f
1134
tests/func.tests	f
1135
tests/func.tests	f
1135
tests/func.right	f
1136
tests/func.right	f
1136
tests/func1.sub		f
1137
tests/func1.sub		f
(-)builtins/common.h (+4 lines)
Lines 257-262 extern int print_shift_error; Link Here
257
extern int expand_once_flag;
257
extern int expand_once_flag;
258
#endif
258
#endif
259
259
260
#if defined (EXTENDED_GLOB)
261
extern int extglob_flag;
262
#endif
263
260
/* variables from source.def */
264
/* variables from source.def */
261
extern int source_searches_cwd;
265
extern int source_searches_cwd;
262
extern int source_uses_path;
266
extern int source_uses_path;
(-)builtins/shopt.def (-3 / +21 lines)
Lines 1-7 Link Here
1
This file is shopt.def, from which is created shopt.c.
1
This file is shopt.def, from which is created shopt.c.
2
It implements the Bash `shopt' builtin.
2
It implements the Bash `shopt' builtin.
3
3
4
Copyright (C) 1994-2021 Free Software Foundation, Inc.
4
Copyright (C) 1994-2022 Free Software Foundation, Inc.
5
5
6
This file is part of GNU Bash, the Bourne Again SHell.
6
This file is part of GNU Bash, the Bourne Again SHell.
7
7
Lines 149-154 static int shopt_set_complete_direxpand PARAMS((char *, int)); Link Here
149
static int set_assoc_expand PARAMS((char *, int));
149
static int set_assoc_expand PARAMS((char *, int));
150
#endif
150
#endif
151
151
152
#if defined (EXTENDED_GLOB)
153
int extglob_flag = EXTGLOB_DEFAULT;
154
static int shopt_set_extglob PARAMS((char *, int));
155
#endif
156
152
static int shopt_set_debug_mode PARAMS((char *, int));
157
static int shopt_set_debug_mode PARAMS((char *, int));
153
158
154
static int shopt_login_shell;
159
static int shopt_login_shell;
Lines 203-209 static struct { Link Here
203
  { "extdebug", &debugging_mode, shopt_set_debug_mode },
208
  { "extdebug", &debugging_mode, shopt_set_debug_mode },
204
#endif
209
#endif
205
#if defined (EXTENDED_GLOB)
210
#if defined (EXTENDED_GLOB)
206
  { "extglob", &extended_glob, (shopt_set_func_t *)NULL },
211
  { "extglob", &extglob_flag, shopt_set_extglob },
207
#endif
212
#endif
208
  { "extquote", &extended_quote, (shopt_set_func_t *)NULL },
213
  { "extquote", &extended_quote, (shopt_set_func_t *)NULL },
209
  { "failglob", &fail_glob_expansion, (shopt_set_func_t *)NULL },
214
  { "failglob", &fail_glob_expansion, (shopt_set_func_t *)NULL },
Lines 374-380 reset_shopt_options () Link Here
374
#endif
379
#endif
375
380
376
#if defined (EXTENDED_GLOB)
381
#if defined (EXTENDED_GLOB)
377
  extended_glob = EXTGLOB_DEFAULT;
382
  extended_glob = extglob_flag = EXTGLOB_DEFAULT;
378
#endif
383
#endif
379
384
380
#if defined (ARRAY_VARS)
385
#if defined (ARRAY_VARS)
Lines 631-641 shopt_set_debug_mode (option_name, mode) Link Here
631
  return (0);
636
  return (0);
632
}
637
}
633
638
639
#if defined (EXTENDED_GLOB)
640
static int
641
shopt_set_extglob (option_name, mode)
642
     char *option_name;
643
     int mode;
644
{
645
  extended_glob = extglob_flag;
646
  return 0;
647
}
648
#endif
649
634
#if defined (READLINE)
650
#if defined (READLINE)
635
static int
651
static int
636
shopt_enable_hostname_completion (option_name, mode)
652
shopt_enable_hostname_completion (option_name, mode)
637
     char *option_name;
653
     char *option_name;
638
     int mode;
654
     int mode;
655
656
639
{
657
{
640
  return (enable_hostname_completion (mode));
658
  return (enable_hostname_completion (mode));
641
}
659
}
(-)execute_cmd.c (-3 / +1 lines)
Lines 3990-4002 execute_cond_node (cond) Link Here
3990
      else
3990
      else
3991
#endif /* COND_REGEXP */
3991
#endif /* COND_REGEXP */
3992
	{
3992
	{
3993
	  int oe;
3994
	  oe = extended_glob;
3995
	  extended_glob = 1;
3993
	  extended_glob = 1;
3996
	  result = binary_test (cond->op->word, arg1, arg2, TEST_PATMATCH|TEST_ARITHEXP|TEST_LOCALE)
3994
	  result = binary_test (cond->op->word, arg1, arg2, TEST_PATMATCH|TEST_ARITHEXP|TEST_LOCALE)
3997
				  ? EXECUTION_SUCCESS
3995
				  ? EXECUTION_SUCCESS
3998
				  : EXECUTION_FAILURE;
3996
				  : EXECUTION_FAILURE;
3999
	  extended_glob = oe;
3997
	  extended_glob = extglob_flag;
4000
	}
3998
	}
4001
      if (arg1 != nullstr)
3999
      if (arg1 != nullstr)
4002
	free (arg1);
4000
	free (arg1);
(-)parse.y (-9 / +13 lines)
Lines 125-131 do { \ Link Here
125
} while (0)
125
} while (0)
126
126
127
#if defined (EXTENDED_GLOB)
127
#if defined (EXTENDED_GLOB)
128
extern int extended_glob;
128
extern int extended_glob, extglob_flag;
129
#endif
129
#endif
130
130
131
#if defined (TRANSLATABLE_STRINGS)
131
#if defined (TRANSLATABLE_STRINGS)
Lines 312-319 static int token_before_that; Link Here
312
/* The token read prior to token_before_that. */
312
/* The token read prior to token_before_that. */
313
static int two_tokens_ago;
313
static int two_tokens_ago;
314
314
315
static int global_extglob;
316
317
/* The line number in a script where the word in a `case WORD', `select WORD'
315
/* The line number in a script where the word in a `case WORD', `select WORD'
318
   or `for WORD' begins.  This is a nested command maximum, since the array
316
   or `for WORD' begins.  This is a nested command maximum, since the array
319
   index is decremented after a case, select, or for command is parsed. */
317
   index is decremented after a case, select, or for command is parsed. */
Lines 3304-3310 reset_parser () Link Here
3304
#if defined (EXTENDED_GLOB)
3302
#if defined (EXTENDED_GLOB)
3305
  /* Reset to global value of extended glob */
3303
  /* Reset to global value of extended glob */
3306
  if (parser_state & (PST_EXTPAT|PST_CMDSUBST))
3304
  if (parser_state & (PST_EXTPAT|PST_CMDSUBST))
3307
    extended_glob = global_extglob;
3305
    extended_glob = extglob_flag;
3308
#endif
3306
#endif
3309
3307
3310
  parser_state = 0;
3308
  parser_state = 0;
Lines 4118-4127 parse_comsub (qc, open, close, lenp, flags) Link Here
4118
    expand_aliases = posixly_correct != 0;
4116
    expand_aliases = posixly_correct != 0;
4119
#if defined (EXTENDED_GLOB)
4117
#if defined (EXTENDED_GLOB)
4120
  /* If (parser_state & PST_EXTPAT), we're parsing an extended pattern for a
4118
  /* If (parser_state & PST_EXTPAT), we're parsing an extended pattern for a
4121
     conditional command and have already set global_extglob appropriately. */
4119
     conditional command and have already set extended_glob appropriately. */
4122
  if (shell_compatibility_level <= 51 && was_extpat == 0)
4120
  if (shell_compatibility_level <= 51 && was_extpat == 0)
4123
    {
4121
    {
4124
      local_extglob = global_extglob = extended_glob;
4122
      local_extglob = extended_glob;
4125
      extended_glob = 1;
4123
      extended_glob = 1;
4126
    }
4124
    }
4127
#endif
4125
#endif
Lines 4229-4235 xparse_dolparen (base, string, indp, flags) Link Here
4229
{
4227
{
4230
  sh_parser_state_t ps;
4228
  sh_parser_state_t ps;
4231
  sh_input_line_state_t ls;
4229
  sh_input_line_state_t ls;
4232
  int orig_ind, nc, sflags, start_lineno;
4230
  int orig_ind, nc, sflags, start_lineno, local_extglob;
4233
  char *ret, *ep, *ostring;
4231
  char *ret, *ep, *ostring;
4234
4232
4235
/*debug_parser(1);*/
4233
/*debug_parser(1);*/
Lines 4272-4278 xparse_dolparen (base, string, indp, flags) Link Here
4272
     old value will be restored by restore_parser_state(). */
4270
     old value will be restored by restore_parser_state(). */
4273
  expand_aliases = 0;
4271
  expand_aliases = 0;
4274
#if defined (EXTENDED_GLOB)
4272
#if defined (EXTENDED_GLOB)
4275
  global_extglob = extended_glob;		/* for reset_parser() */
4273
  local_extglob = extended_glob;
4276
#endif
4274
#endif
4277
4275
4278
  token_to_read = DOLPAREN;			/* let's trick the parser */
4276
  token_to_read = DOLPAREN;			/* let's trick the parser */
Lines 4290-4295 xparse_dolparen (base, string, indp, flags) Link Here
4290
  restore_input_line_state (&ls);
4288
  restore_input_line_state (&ls);
4291
  restore_parser_state (&ps);
4289
  restore_parser_state (&ps);
4292
4290
4291
#if defined (EXTENDED_GLOB)
4292
  extended_glob = local_extglob;
4293
#endif
4293
  token_to_read = 0;
4294
  token_to_read = 0;
4294
4295
4295
  /* If parse_string returns < 0, we need to jump to top level with the
4296
  /* If parse_string returns < 0, we need to jump to top level with the
Lines 4724-4735 cond_term () Link Here
4724
	}
4725
	}
4725
4726
4726
      /* rhs */
4727
      /* rhs */
4728
#if defined (EXTENDED_GLOB)
4727
      local_extglob = extended_glob;
4729
      local_extglob = extended_glob;
4728
      if (parser_state & PST_EXTPAT)
4730
      if (parser_state & PST_EXTPAT)
4729
	extended_glob = 1;
4731
	extended_glob = 1;
4732
#endif
4730
      tok = read_token (READ);
4733
      tok = read_token (READ);
4734
#if defined (EXTENDED_GLOB)
4731
      if (parser_state & PST_EXTPAT)
4735
      if (parser_state & PST_EXTPAT)
4732
	extended_glob = local_extglob;
4736
	extended_glob = local_extglob;
4737
#endif
4733
      parser_state &= ~(PST_REGEXP|PST_EXTPAT);
4738
      parser_state &= ~(PST_REGEXP|PST_EXTPAT);
4734
4739
4735
      if (tok == WORD)
4740
      if (tok == WORD)
Lines 4776-4782 parse_cond_command () Link Here
4776
{
4781
{
4777
  COND_COM *cexp;
4782
  COND_COM *cexp;
4778
4783
4779
  global_extglob = extended_glob;
4780
  cexp = cond_expr ();
4784
  cexp = cond_expr ();
4781
  return (make_cond_command (cexp));
4785
  return (make_cond_command (cexp));
4782
}
4786
}
(-)patchlevel.h (-1 / +1 lines)
Lines 1-6 Link Here
1
/* patchlevel.h -- current bash patch level */
1
/* patchlevel.h -- current bash patch level */
2
2
3
/* Copyright (C) 2001-2021 Free Software Foundation, Inc.
3
/* Copyright (C) 2001-2022 Free Software Foundation, Inc.
4
4
5
   This file is part of GNU Bash, the Bourne Again SHell.
5
   This file is part of GNU Bash, the Bourne Again SHell.
6
6
(-)tests/extglob.right (+7 lines)
Lines 182-184 no dotglob: .a .foo bar Link Here
182
? . .. .a .foo
182
? . .. .a .foo
183
*
183
*
184
bar
184
bar
185
extglob        	off
186
x
187
extglob        	off
188
extglob        	off
189
extglob        	off
190
extglob        	off
191
extglob        	off
(-)tests/extglob.tests (+1 lines)
Lines 386-390 ${THIS_SH} ./extglob4.sub Link Here
386
${THIS_SH} ./extglob5.sub
386
${THIS_SH} ./extglob5.sub
387
${THIS_SH} ./extglob6.sub
387
${THIS_SH} ./extglob6.sub
388
${THIS_SH} ./extglob7.sub
388
${THIS_SH} ./extglob7.sub
389
${THIS_SH} ./extglob8.sub
389
390
390
exit 0
391
exit 0
(-)tests/extglob8.sub (+33 lines)
Line 0 Link Here
1
#   This program is free software: you can redistribute it and/or modify
2
#   it under the terms of the GNU General Public License as published by
3
#   the Free Software Foundation, either version 3 of the License, or
4
#   (at your option) any later version.
5
#
6
#   This program is distributed in the hope that it will be useful,
7
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
8
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
9
#   GNU General Public License for more details.
10
#
11
#   You should have received a copy of the GNU General Public License
12
#   along with this program.  If not, see <http://www.gnu.org/licenses/>.
13
#
14
# extglob option interaction with other parts of the shell that force
15
# extended_glob on; only an issue in compatibility mode
16
17
shopt -u extglob
18
19
BASH_COMPAT=50
20
shopt extglob
21
22
echo $(echo $(echo $(echo $(echo $(echo x) ) ) ) )
23
shopt extglob
24
25
shopt -u extglob
26
27
[[ '' = $(shopt extglob >&2) ]]
28
shopt extglob
29
30
shopt -u extglob
31
32
[[ foo = $(: $(shopt extglob >&2)) ]]
33
shopt extglob
(-)tests/run-extglob (-1 / +1 lines)
Lines 1-4 Link Here
1
PATH=$PATH:`pwd`
1
PATH=$PATH:`pwd`
2
export PATH
2
export PATH
3
${THIS_SH} ./extglob.tests | grep -v '^expect' > ${BASH_TSTOUT}
3
${THIS_SH} ./extglob.tests 2>&1 | grep -v '^expect' > ${BASH_TSTOUT}
4
diff ${BASH_TSTOUT} extglob.right && rm -f ${BASH_TSTOUT}
4
diff ${BASH_TSTOUT} extglob.right && rm -f ${BASH_TSTOUT}

Return to bug 873931