Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
pyfs
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
pyfs
Commits
1fabf762
Commit
1fabf762
authored
Sep 26, 2010
by
rfkelly0
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix race condition in watch_inotify
parent
c56bc5e2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
7 deletions
+17
-7
fs/osfs/watch_inotify.py
+1
-3
fs/tests/test_xattr.py
+8
-2
fs/watch.py
+8
-2
No files found.
fs/osfs/watch_inotify.py
View file @
1fabf762
...
...
@@ -47,7 +47,6 @@ class OSFSWatchMixin(WatchableFSMixin):
OSFSWatchMixin
.
__watch_thread
=
None
finally
:
self
.
__watch_lock
.
release
()
def
add_watcher
(
self
,
callback
,
path
=
"/"
,
events
=
None
,
recursive
=
True
):
super_add_watcher
=
super
(
OSFSWatchMixin
,
self
)
.
add_watcher
...
...
@@ -203,7 +202,7 @@ class SharedThreadedNotifier(threading.Thread):
def
__init__
(
self
):
super
(
SharedThreadedNotifier
,
self
)
.
__init__
()
self
.
daemon
=
True
self
.
running
=
Fals
e
self
.
running
=
Tru
e
self
.
_pipe_r
,
self
.
_pipe_w
=
os
.
pipe
()
self
.
_poller
=
select
.
poll
()
self
.
_poller
.
register
(
self
.
_pipe_r
,
select
.
POLLIN
)
...
...
@@ -231,7 +230,6 @@ class SharedThreadedNotifier(threading.Thread):
_select_error
=
select
.
error
_select_POLLIN
=
select
.
POLLIN
# Loop until stopped, dispatching to individual notifiers.
self
.
running
=
True
while
self
.
running
:
try
:
ready_fds
=
self
.
_poller
.
poll
()
...
...
fs/tests/test_xattr.py
View file @
1fabf762
...
...
@@ -143,12 +143,18 @@ class TestXAttr_TempFS(unittest.TestCase,FSTestCases,XAttrTestCases):
self
.
fs
=
ensure_xattrs
(
fs
)
def
tearDown
(
self
):
td
=
self
.
fs
.
_temp_dir
try
:
td
=
self
.
fs
.
_temp_dir
except
AttributeError
:
td
=
self
.
fs
.
wrapped_fs
.
_temp_dir
self
.
fs
.
close
()
self
.
assert_
(
not
os
.
path
.
exists
(
td
))
def
check
(
self
,
p
):
td
=
self
.
fs
.
_temp_dir
try
:
td
=
self
.
fs
.
_temp_dir
except
AttributeError
:
td
=
self
.
fs
.
wrapped_fs
.
_temp_dir
return
os
.
path
.
exists
(
os
.
path
.
join
(
td
,
relpath
(
p
)))
...
...
fs/watch.py
View file @
1fabf762
...
...
@@ -314,9 +314,15 @@ class WatchableFS(WatchableFSMixin,WrapFS):
raise
DirectoryNotEmptyError
(
path
)
else
:
for
nm
in
self
.
listdir
(
path
,
dirs_only
=
True
):
self
.
removedir
(
pathjoin
(
path
,
nm
),
force
=
True
)
try
:
self
.
removedir
(
pathjoin
(
path
,
nm
),
force
=
True
)
except
ResourceNotFoundError
:
pass
for
nm
in
self
.
listdir
(
path
,
files_only
=
True
):
self
.
remove
(
pathjoin
(
path
,
nm
))
try
:
self
.
remove
(
pathjoin
(
path
,
nm
))
except
ResourceNotFoundError
:
pass
super
(
WatchableFS
,
self
)
.
removedir
(
path
)
self
.
notify_watchers
(
REMOVED
,
path
)
if
recursive
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment