aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test_bindfs.rb
diff options
context:
space:
mode:
authorMartin Pärtel <martin.partel@gmail.com>2016-10-15 01:44:45 +0100
committerMartin Pärtel <martin.partel@gmail.com>2016-10-15 01:44:45 +0100
commit9b37e64eb3e625535a1a20f315d7932f2e74b399 (patch)
treeec9792c2b77478442b18a969043c9967f1be90c8 /tests/test_bindfs.rb
parent3285e0aee6ea92da2eef119cb66c54cf74c255dc (diff)
downloadbindfs-9b37e64eb3e625535a1a20f315d7932f2e74b399.tar.gz
Fix #41 (seeking in directory).
Since version 1.31.1, bindfs has implemented readdir by always reading the entire directory and passing 0 offset to filler, but this does not work if the same directory pointer is rewound and reused. We remove the opendir and closedir implementations (which FUSE permits) and now always opendir() and closedir() in readdir. Alternatively we could have added a rewinddir() to our readdir.
Diffstat (limited to 'tests/test_bindfs.rb')
-rwxr-xr-xtests/test_bindfs.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/test_bindfs.rb b/tests/test_bindfs.rb
index c0ae5dd..e355e2a 100755
--- a/tests/test_bindfs.rb
+++ b/tests/test_bindfs.rb
@@ -678,6 +678,18 @@ root_testenv("", :title => "ioctl not enabled by default") do
assert { `chattr +a mnt/file 2>&1`; !$?.success? }
end
+# Issue #41
+testenv("", :title => "reading directory with rewind") do
+ touch('mnt/file1')
+ touch('mnt/file2')
+ mkdir('mnt/subdir')
+
+ Dir.chdir 'mnt' do
+ system("#{$tests_dir}/test_dir_rewind")
+ assert { $?.success? }
+ end
+end
+
# FIXME: this stuff around testenv is a hax, and testenv may also exit(), which defeats the 'ensure' below.
# the test setup ought to be refactored. It might well use MiniTest or something.
if Process.uid == 0