From 8de2a9abf99684677ae2b2367a0783bd9c25ffb5 Mon Sep 17 00:00:00 2001 From: michaelbeaumont Date: Wed, 12 Jun 2013 11:09:50 +0200 Subject: [PATCH] Fix infinite add_watches loop with symbolic links Added a check to ensure that add_watches doesn't run on the same folder over and over again. This occurs at least when circular symbolic links are present. Fix #543 --- powerline/lib/tree_watcher.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/powerline/lib/tree_watcher.py b/powerline/lib/tree_watcher.py index b2f11fb7..7b932e42 100644 --- a/powerline/lib/tree_watcher.py +++ b/powerline/lib/tree_watcher.py @@ -50,6 +50,10 @@ class INotifyTreeWatcher(INotify): ''' Add watches for this directory and all its descendant directories, recursively. ''' base = realpath(base) + # There may exist a link which leads to an endless + # add_watches loop or to maximum recursion depth exceeded + if not top_level and base in self.watched_dirs: + return try: is_dir = self.add_watch(base) except OSError as e: