aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test_bindfs.rb
diff options
context:
space:
mode:
authorMartin Pärtel <martin.partel@gmail.com>2017-01-29 17:09:33 +0000
committerMartin Pärtel <martin.partel@gmail.com>2017-01-29 17:09:33 +0000
commit8f4b7de90989ab17260b6d7b926b2b71012475b3 (patch)
treede0b08e038cc2272c80d067502f248cdde0a3067 /tests/test_bindfs.rb
parent18300876c860cad126fb316a82509a95c002d766 (diff)
downloadbindfs-8f4b7de90989ab17260b6d7b926b2b71012475b3.tar.gz
Fixed #47 by not setting `-ofsname=` when it would contain a comma.
Also banned some other characters that are likely to lead to trouble.
Diffstat (limited to 'tests/test_bindfs.rb')
-rwxr-xr-xtests/test_bindfs.rb31
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/test_bindfs.rb b/tests/test_bindfs.rb
index 39f709e..96d6660 100755
--- a/tests/test_bindfs.rb
+++ b/tests/test_bindfs.rb
@@ -695,6 +695,37 @@ testenv("", :title => "reading directory with rewind") do
end
end
+# Issue 47
+testenv("", :title => "srcdir with comma", :srcdir_name => "a,b") do
+ touch('a,b/f')
+ assert { File.exist?('mnt/f') }
+end
+
+testenv("", :title => "mntdir with comma", :mntdir_name => "a,b") do
+ touch('src/f')
+ assert { File.exist?('a,b/f') }
+end
+
+testenv("", :title => "srcdir with space", :srcdir_name => "a b") do
+ touch('a b/f')
+ assert { File.exist?('mnt/f') }
+end
+
+testenv("", :title => "mntdir with space", :mntdir_name => "a b") do
+ touch('src/f')
+ assert { File.exist?('a b/f') }
+end
+
+testenv("", :title => "srcdir with newline", :srcdir_name => "a\nb") do
+ touch("a\nb/f")
+ assert { File.exist?('mnt/f') }
+end
+
+testenv("", :title => "mntdir with newline", :mntdir_name => "a\nb") do
+ touch('src/f')
+ assert { File.exist?("a\nb/f") }
+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