Skip to content
Permalink
Browse files

complete: Don't allow wrapping a command with itself

Double-fixes #5541, by not allowing it to happen.
  • Loading branch information...
faho committed Jan 17, 2019
1 parent 84339d5 commit 58b696bed16d2b5c859f218e00fd82570be60ead
Showing with 5 additions and 0 deletions.
  1. +5 −0 src/complete.cpp
@@ -1656,6 +1656,11 @@ bool complete_add_wrapper(const wcstring &command, const wcstring &new_target) {
return false;
}

// If the command and the target are the same,
// there's no point in following the wrap-chain because we'd only complete the same thing.
// TODO: This should maybe include full cycle detection.
if (command == new_target) return false;

auto locked_map = wrapper_map.acquire();
wrapper_map_t &wraps = *locked_map;
wcstring_list_t *targets = &wraps[command];

0 comments on commit 58b696b

Please sign in to comment.
You can’t perform that action at this time.