]> git.ipfire.org Git - thirdparty/bash.git/blobdiff - subst.c
commit bash-20090129 snapshot
[thirdparty/bash.git] / subst.c
diff --git a/subst.c b/subst.c
index d6c64be0f08737e632718dcfa2362cf3d07d2617..62a3d028e45b9831cb7f597bf4a7ea6e4d927c9b 100644 (file)
--- a/subst.c
+++ b/subst.c
@@ -7363,7 +7363,12 @@ add_string:
             assignment statements.  We now do tilde expansion on such words
             even in POSIX mode. */     
          if (word->flags & (W_ASSIGNRHS|W_NOTILDE))
-           goto add_character;
+           {
+             if (isexp == 0 && isifs (c))
+               goto add_ifs_character;
+             else
+               goto add_character;
+           }
          /* If we're not in posix mode or forcing assignment-statement tilde
             expansion, note where the `=' appears in the word and prepare to
             do tilde expansion following the first `='. */
@@ -7379,16 +7384,28 @@ add_string:
                   string[sindex+1] == '~')
            word->flags |= W_ITILDE;
 #endif
-         goto add_character;
+         if (isexp == 0 && isifs (c))
+           goto add_ifs_character;
+         else
+           goto add_character;
 
        case ':':
          if (word->flags & W_NOTILDE)
-           goto add_character;
+           {
+             if (isexp == 0 && isifs (c))
+               goto add_ifs_character;
+             else
+               goto add_character;
+           }
 
          if ((word->flags & (W_ASSIGNMENT|W_ASSIGNRHS|W_TILDEEXP)) &&
              string[sindex+1] == '~')
            word->flags |= W_ITILDE;
-         goto add_character;
+
+         if (isexp == 0 && isifs (c))
+           goto add_ifs_character;
+         else
+           goto add_character;
 
        case '~':
          /* If the word isn't supposed to be tilde expanded, or we're not
@@ -7399,7 +7416,10 @@ add_string:
              (quoted & (Q_DOUBLE_QUOTES|Q_HERE_DOCUMENT)))
            {
              word->flags &= ~W_ITILDE;
-             goto add_character;
+             if (isexp == 0 && isifs (c) && (quoted & (Q_DOUBLE_QUOTES|Q_HERE_DOCUMENT)) == 0)
+               goto add_ifs_character;
+             else
+               goto add_character;
            }
 
          if (word->flags & W_ASSIGNRHS)
@@ -7739,6 +7759,7 @@ add_twochars:
 
        default:
          /* This is the fix for " $@ " */
+       add_ifs_character:
          if ((quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)) || (isexp == 0 && isifs (c)))
            {
              if (string[sindex])       /* from old goto dollar_add_string */