[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [stem/master] Skipping non-regular files when the reader crawls
commit ebed653be563f2e16c384d9d3b235ad2ecb11566
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date: Wed Jun 6 08:47:54 2012 -0700
Skipping non-regular files when the reader crawls
When the reader encounters block devices it can get stuck, causing the integ
test for stop() to fail. Caught by nickm.
---
stem/descriptor/reader.py | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/stem/descriptor/reader.py b/stem/descriptor/reader.py
index acc9f8f..51eb46c 100644
--- a/stem/descriptor/reader.py
+++ b/stem/descriptor/reader.py
@@ -386,6 +386,11 @@ class DescriptorReader:
self._notify_skip_listeners(target, AlreadyRead(last_modified, last_used))
return
+ # Block devices and such are never descriptors, and can cause us to block
+ # for quite a while so skipping anything that isn't a regular file.
+
+ if not os.path.isfile(target): return
+
# The mimetypes module only checks the file extension. To actually
# check the content (like the 'file' command) we'd need something like
# pymagic (https://github.com/cloudburst/pymagic).
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits