rfuse 1.0.3 → 1.0.4.RC0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.travis.yml +8 -0
- data/CHANGES.md +11 -0
- data/Rakefile +6 -0
- data/ext/rfuse/rfuse.c +5 -2
- data/lib/rfuse/version.rb +1 -1
- data/lib/rfuse.rb +19 -2
- data/rfuse.gemspec +1 -0
- data/spec/basic_spec.rb +26 -12
- data/spec/options_spec.rb +26 -3
- data/spec/xattr_spec.rb +9 -1
- metadata +25 -5
data/.travis.yml
ADDED
data/CHANGES.md
CHANGED
@@ -1,9 +1,20 @@
|
|
1
|
+
1.0.4 -
|
2
|
+
------------------
|
3
|
+
|
4
|
+
|
5
|
+
Bugfixes
|
6
|
+
|
7
|
+
* {RFuse.parse_options} fix if only local options supplied
|
8
|
+
* Fix for listing extended attributes
|
9
|
+
* Prevent old exceptions from raising at unmount
|
10
|
+
|
1
11
|
1.0.3 - 2012/08/16
|
2
12
|
------------------
|
3
13
|
|
4
14
|
Cleanup compile warnings
|
5
15
|
|
6
16
|
Bugfixes
|
17
|
+
|
7
18
|
* {RFuse::Fuse#statfs} potential segfault
|
8
19
|
* {RFuse::Fuse#release} not receiving FileInfo
|
9
20
|
|
data/Rakefile
CHANGED
@@ -2,9 +2,15 @@
|
|
2
2
|
require "bundler/gem_tasks"
|
3
3
|
require 'yard'
|
4
4
|
require 'rspec/core/rake_task'
|
5
|
+
require 'rake/extensiontask'
|
5
6
|
|
6
7
|
RSpec::Core::RakeTask.new(:spec)
|
7
8
|
|
8
9
|
YARD::Rake::YardocTask.new
|
9
10
|
|
11
|
+
Rake::ExtensionTask.new('rfuse') do |ext|
|
12
|
+
ext.lib_dir = "lib/rfuse"
|
13
|
+
end
|
14
|
+
|
15
|
+
task :spec => :compile
|
10
16
|
task :default => :spec
|
data/ext/rfuse/rfuse.c
CHANGED
@@ -52,8 +52,11 @@ static int unsafe_return_error(VALUE *args)
|
|
52
52
|
{
|
53
53
|
|
54
54
|
if (rb_respond_to(rb_errinfo(),rb_intern("errno"))) {
|
55
|
+
VALUE res;
|
55
56
|
//We expect these and they get passed on the fuse so be quiet...
|
56
|
-
|
57
|
+
res = rb_funcall(rb_errinfo(),rb_intern("errno"),0);
|
58
|
+
rb_set_errinfo(Qnil);
|
59
|
+
return res;
|
57
60
|
} else {
|
58
61
|
VALUE info;
|
59
62
|
VALUE bt_ary;
|
@@ -1003,7 +1006,7 @@ static int rf_setxattr(const char *path,const char *name,
|
|
1003
1006
|
@param [String] name
|
1004
1007
|
|
1005
1008
|
@return [String] attribute value
|
1006
|
-
@raise [Errno]
|
1009
|
+
@raise [Errno] Errno::ENODATA if attribute does not exist
|
1007
1010
|
|
1008
1011
|
*/
|
1009
1012
|
static VALUE unsafe_getxattr(VALUE *args)
|
data/lib/rfuse/version.rb
CHANGED
data/lib/rfuse.rb
CHANGED
@@ -10,7 +10,7 @@ module RFuse
|
|
10
10
|
def self.packxattr(xattrs)
|
11
11
|
case xattrs
|
12
12
|
when Array
|
13
|
-
xattrs.join("\000")
|
13
|
+
xattrs.join("\000").concat("\000")
|
14
14
|
when String
|
15
15
|
#assume already \0 separated list of keys
|
16
16
|
xattrs
|
@@ -81,6 +81,10 @@ module RFuse
|
|
81
81
|
result[:help] = true
|
82
82
|
end
|
83
83
|
|
84
|
+
if argv.include?("-d")
|
85
|
+
result[:debug] = true
|
86
|
+
end
|
87
|
+
|
84
88
|
opt_index = ( argv.find_index("-o") || -1 ) + 1
|
85
89
|
|
86
90
|
if opt_index > 1 && opt_index < argv.length
|
@@ -98,12 +102,25 @@ module RFuse
|
|
98
102
|
local_opts.include?(opt_sym)
|
99
103
|
end
|
100
104
|
|
101
|
-
|
105
|
+
if options.empty?
|
106
|
+
argv.slice!(opt_index - 1,2)
|
107
|
+
else
|
108
|
+
argv[opt_index] = options.join(",")
|
109
|
+
end
|
102
110
|
end
|
103
111
|
|
104
112
|
result
|
105
113
|
end
|
106
114
|
|
115
|
+
# Generate a usage string
|
116
|
+
#
|
117
|
+
# @param [String] device a description of how the device field should be used
|
118
|
+
# @param [String] exec the executable
|
119
|
+
# @return [String] the usage string
|
120
|
+
def self.usage(device=nil,exec=File.basename($0))
|
121
|
+
"Usage:\n\t #{exec} #{device} mountpoint [-h] [-o [opt,optkey=value,...]]\n"
|
122
|
+
end
|
123
|
+
|
107
124
|
class Fuse
|
108
125
|
|
109
126
|
# Main processing loop
|
data/rfuse.gemspec
CHANGED
@@ -22,6 +22,7 @@ Gem::Specification.new do |s|
|
|
22
22
|
s.extra_rdoc_files = 'CHANGES.md'
|
23
23
|
|
24
24
|
s.add_development_dependency("rake")
|
25
|
+
s.add_development_dependency("rake-compiler")
|
25
26
|
s.add_development_dependency("rspec")
|
26
27
|
s.add_development_dependency("yard")
|
27
28
|
s.add_development_dependency("redcarpet")
|
data/spec/basic_spec.rb
CHANGED
@@ -135,30 +135,44 @@ describe RFuse::Fuse do
|
|
135
135
|
|
136
136
|
it "should read files" do
|
137
137
|
|
138
|
-
file_stat.size =
|
139
|
-
mockfs.stub(:getattr)
|
140
|
-
case path
|
141
|
-
when "/test"
|
142
|
-
file_stat
|
143
|
-
else
|
144
|
-
raise Errno::ENOENT
|
145
|
-
end
|
146
|
-
|
147
|
-
}
|
138
|
+
file_stat.size = 12
|
139
|
+
mockfs.stub(:getattr).with(anything(),"/test").and_return(file_stat)
|
148
140
|
|
141
|
+
|
149
142
|
reads = 0
|
150
143
|
mockfs.stub(:read) { |ctx,path,size,offset,ffi|
|
151
144
|
reads += 2
|
152
|
-
"hello\000world"[offset,reads]
|
145
|
+
"hello\000world\000"[offset,reads]
|
153
146
|
}
|
154
147
|
|
155
148
|
with_fuse(mountpoint,mockfs) do
|
156
149
|
File.open("#{mountpoint}/test") do |f|
|
157
150
|
val = f.gets
|
158
|
-
val.should == "hello\000world"
|
151
|
+
val.should == "hello\000world\000"
|
159
152
|
end
|
160
153
|
end
|
161
154
|
end
|
155
|
+
|
156
|
+
it "should read over null characters in a real file" do
|
157
|
+
file_stat.size = 2
|
158
|
+
File.open("/tmp/nulltest","w") { |f| f.print "\000\000" }
|
159
|
+
|
160
|
+
mockfs.stub(:getattr).with(anything(),"/testnull").and_return(file_stat)
|
161
|
+
|
162
|
+
mockfs.stub(:read) { |ctx,path,size,offset,ffi|
|
163
|
+
IO.read("/tmp/nulltest",size,offset)
|
164
|
+
}
|
165
|
+
|
166
|
+
with_fuse(mountpoint,mockfs) do
|
167
|
+
File.open("#{mountpoint}/testnull") do |f|
|
168
|
+
val = f.gets
|
169
|
+
val.should == "\000\000"
|
170
|
+
val.size.should == 2
|
171
|
+
puts val
|
172
|
+
end
|
173
|
+
end
|
174
|
+
end
|
175
|
+
|
162
176
|
end
|
163
177
|
|
164
178
|
context "exceptions" do
|
data/spec/options_spec.rb
CHANGED
@@ -67,6 +67,12 @@ describe RFuse do
|
|
67
67
|
result[:debug].should be_true
|
68
68
|
end
|
69
69
|
|
70
|
+
it "detects debug as -d" do
|
71
|
+
argv = [ "/mountpoint","-o","someopt","-d" ]
|
72
|
+
result = RFuse.parse_options(argv)
|
73
|
+
result[:debug].should be_true
|
74
|
+
end
|
75
|
+
|
70
76
|
it "should remove local options" do
|
71
77
|
argv = [ "/mountpoint","-o","debug,myoption" ]
|
72
78
|
|
@@ -75,7 +81,25 @@ describe RFuse do
|
|
75
81
|
result[:debug].should be_true
|
76
82
|
result[:myoption].should be_true
|
77
83
|
|
78
|
-
argv
|
84
|
+
argv.should == [ "/mountpoint", "-o", "debug" ]
|
85
|
+
end
|
86
|
+
|
87
|
+
it "should remove the only local option" do
|
88
|
+
argv = ["/mountpoint","-o","myoption" ]
|
89
|
+
|
90
|
+
result = RFuse.parse_options(argv,:myoption)
|
91
|
+
|
92
|
+
result[:myoption].should be_true
|
93
|
+
argv.should == [ "/mountpoint" ]
|
94
|
+
end
|
95
|
+
|
96
|
+
|
97
|
+
it "parses the value from the only local option" do
|
98
|
+
argv = [ "adevice", "/mountpoint", "-o","someopt=somevalue"]
|
99
|
+
result = RFuse.parse_options(argv,:someopt)
|
100
|
+
|
101
|
+
result[:someopt].should == "somevalue"
|
102
|
+
argv.should == [ "/mountpoint" ]
|
79
103
|
end
|
80
104
|
|
81
105
|
it "should parse values from options" do
|
@@ -104,8 +128,7 @@ describe RFuse do
|
|
104
128
|
result[:debug].should be_true
|
105
129
|
result[:default_permissions].should be_true
|
106
130
|
|
107
|
-
argv.
|
108
|
-
argv.join(" ").should == "/mountpoint -o rw,debug,default_permissions"
|
131
|
+
argv.should == [ "/mountpoint" , "-o", "rw,debug,default_permissions" ]
|
109
132
|
end
|
110
133
|
|
111
134
|
end
|
data/spec/xattr_spec.rb
CHANGED
@@ -14,6 +14,8 @@ describe RFuse::Fuse do
|
|
14
14
|
"1"
|
15
15
|
when "user.two"
|
16
16
|
"2"
|
17
|
+
else
|
18
|
+
""
|
17
19
|
end
|
18
20
|
}
|
19
21
|
|
@@ -32,8 +34,14 @@ describe RFuse::Fuse do
|
|
32
34
|
xattr['user.one'].should == "1"
|
33
35
|
xattr['user.two'].should == "2"
|
34
36
|
xattr['user.three']= "updated"
|
37
|
+
xattr['xxxxx'].should be_nil
|
35
38
|
xattr.remove('user.one')
|
39
|
+
# And now with a non-ruby system #TODO. There'd be a way to guard this properly
|
40
|
+
if system("getfattr --version")
|
41
|
+
system("getfattr -d #{mountpoint}/myfile").should be_true
|
42
|
+
else
|
43
|
+
puts "Warning Skipping getfattr test"
|
44
|
+
end
|
36
45
|
end
|
37
46
|
end
|
38
|
-
|
39
47
|
end
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rfuse
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
5
|
-
prerelease:
|
4
|
+
version: 1.0.4.RC0
|
5
|
+
prerelease: 6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Grant Gardner
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-12-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
@@ -27,6 +27,22 @@ dependencies:
|
|
27
27
|
- - ! '>='
|
28
28
|
- !ruby/object:Gem::Version
|
29
29
|
version: '0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: rake-compiler
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
type: :development
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
30
46
|
- !ruby/object:Gem::Dependency
|
31
47
|
name: rspec
|
32
48
|
requirement: !ruby/object:Gem::Requirement
|
@@ -101,6 +117,7 @@ extra_rdoc_files:
|
|
101
117
|
- CHANGES.md
|
102
118
|
files:
|
103
119
|
- .gitignore
|
120
|
+
- .travis.yml
|
104
121
|
- .yardopts
|
105
122
|
- CHANGES.md
|
106
123
|
- Gemfile
|
@@ -151,12 +168,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
151
168
|
- - ! '>='
|
152
169
|
- !ruby/object:Gem::Version
|
153
170
|
version: '0'
|
171
|
+
segments:
|
172
|
+
- 0
|
173
|
+
hash: 927008359791353354
|
154
174
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
155
175
|
none: false
|
156
176
|
requirements:
|
157
|
-
- - ! '
|
177
|
+
- - ! '>'
|
158
178
|
- !ruby/object:Gem::Version
|
159
|
-
version:
|
179
|
+
version: 1.3.1
|
160
180
|
requirements: []
|
161
181
|
rubyforge_project:
|
162
182
|
rubygems_version: 1.8.24
|