diff options
author | Chet Ramey <chet.ramey@case.edu> | 2012-01-09 08:24:22 -0500 |
---|---|---|
committer | Chet Ramey <chet.ramey@case.edu> | 2012-01-09 08:24:22 -0500 |
commit | 19baff85a2c24b3becd290921ad077ecf6817df7 (patch) | |
tree | 2e66c375d4b69926fd31cabdec0ac9dd5b45933c /execute_cmd.c | |
parent | 9efb1fb32f201c9297be9761dc12112affd04274 (diff) | |
download | bash-19baff85a2c24b3becd290921ad077ecf6817df7.tar.gz |
commit bash-20110720 snapshot
Diffstat (limited to 'execute_cmd.c')
-rw-r--r-- | execute_cmd.c | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/execute_cmd.c b/execute_cmd.c index 9007dff9..16a2f9a9 100644 --- a/execute_cmd.c +++ b/execute_cmd.c @@ -3652,7 +3652,7 @@ static void fix_assignment_words (words) WORD_LIST *words; { - WORD_LIST *w; + WORD_LIST *w, *wcmd; struct builtin *b; int assoc; @@ -3662,16 +3662,24 @@ fix_assignment_words (words) b = 0; assoc = 0; + wcmd = words; for (w = words; w; w = w->next) if (w->word->flags & W_ASSIGNMENT) { if (b == 0) { - b = builtin_address_internal (words->word->word, 0); + /* Posix (post-2008) says that `command' doesn't change whether + or not the builtin it shadows is a `declaration command', even + though it removes other special builtin properties. In Posix + mode, we skip over one or more instances of `command' and + deal with the next word as the assignment builtin. */ + while (posixly_correct && wcmd && wcmd->word && wcmd->word->word && STREQ (wcmd->word->word, "command")) + wcmd = wcmd->next; + b = builtin_address_internal (wcmd->word->word, 0); if (b == 0 || (b->flags & ASSIGNMENT_BUILTIN) == 0) return; else if (b && (b->flags & ASSIGNMENT_BUILTIN)) - words->word->flags |= W_ASSNBLTIN; + wcmd->word->flags |= W_ASSNBLTIN; } w->word->flags |= (W_NOSPLIT|W_NOGLOB|W_TILDEEXP|W_ASSIGNARG); #if defined (ARRAY_VARS) @@ -3686,13 +3694,15 @@ fix_assignment_words (words) { if (b == 0) { - b = builtin_address_internal (words->word->word, 0); + while (posixly_correct && wcmd && wcmd->word && wcmd->word->word && STREQ (wcmd->word->word, "command")) + wcmd = wcmd->next; + b = builtin_address_internal (wcmd->word->word, 0); if (b == 0 || (b->flags & ASSIGNMENT_BUILTIN) == 0) return; else if (b && (b->flags & ASSIGNMENT_BUILTIN)) - words->word->flags |= W_ASSNBLTIN; + wcmd->word->flags |= W_ASSNBLTIN; } - if (words->word->flags & W_ASSNBLTIN) + if (wcmd->word->flags & W_ASSNBLTIN) assoc = 1; } #endif |