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

(-)subst.c (+8 lines)
Lines 1798-1803 extract_heredoc_dolbrace_string (string, sindex, quoted, flags) Link Here
1798
  return (result);
1798
  return (result);
1799
}
1799
}
1800
1800
1801
#define PARAMEXPNEST_MAX	32	// for now
1802
static int dbstate[PARAMEXPNEST_MAX];
1803
1801
/* Extract a parameter expansion expression within ${ and } from STRING.
1804
/* Extract a parameter expansion expression within ${ and } from STRING.
1802
   Obey the Posix.2 rules for finding the ending `}': count braces while
1805
   Obey the Posix.2 rules for finding the ending `}': count braces while
1803
   skipping over enclosed quoted strings and command substitutions.
1806
   skipping over enclosed quoted strings and command substitutions.
Lines 1828-1833 extract_dollar_brace_string (string, sindex, quoted, flags) Link Here
1828
  if (quoted == Q_HERE_DOCUMENT && dolbrace_state == DOLBRACE_QUOTE && (flags & SX_NOALLOC) == 0)
1831
  if (quoted == Q_HERE_DOCUMENT && dolbrace_state == DOLBRACE_QUOTE && (flags & SX_NOALLOC) == 0)
1829
    return (extract_heredoc_dolbrace_string (string, sindex, quoted, flags));
1832
    return (extract_heredoc_dolbrace_string (string, sindex, quoted, flags));
1830
1833
1834
  dbstate[0] = dolbrace_state;
1835
1831
  pass_character = 0;
1836
  pass_character = 0;
1832
  nesting_level = 1;
1837
  nesting_level = 1;
1833
  slen = strlen (string + *sindex) + *sindex;
1838
  slen = strlen (string + *sindex) + *sindex;
Lines 1852-1857 extract_dollar_brace_string (string, sindex, quoted, flags) Link Here
1852
1857
1853
      if (string[i] == '$' && string[i+1] == LBRACE)
1858
      if (string[i] == '$' && string[i+1] == LBRACE)
1854
	{
1859
	{
1860
	  if (nesting_level < PARAMEXPNEST_MAX)
1861
	    dbstate[nesting_level] = dolbrace_state;
1855
	  nesting_level++;
1862
	  nesting_level++;
1856
	  i += 2;
1863
	  i += 2;
1857
	  if (dolbrace_state == DOLBRACE_QUOTE || dolbrace_state == DOLBRACE_WORD)
1864
	  if (dolbrace_state == DOLBRACE_QUOTE || dolbrace_state == DOLBRACE_WORD)
Lines 1864-1869 extract_dollar_brace_string (string, sindex, quoted, flags) Link Here
1864
	  nesting_level--;
1871
	  nesting_level--;
1865
	  if (nesting_level == 0)
1872
	  if (nesting_level == 0)
1866
	    break;
1873
	    break;
1874
	  dolbrace_state = (nesting_level < PARAMEXPNEST_MAX) ? dbstate[nesting_level] : dbstate[0];	/* Guess using initial state */
1867
	  i++;
1875
	  i++;
1868
	  continue;
1876
	  continue;
1869
	}
1877
	}

Return to bug 873931