solaris-file 0.3.5 → 0.3.6
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +6 -0
- data/README +24 -30
- data/Rakefile +34 -40
- data/ext/solaris/sfile.c +244 -231
- data/ext/solaris/sfile.h +68 -59
- data/solaris-file.gemspec +28 -30
- data/test/test_solaris_file.rb +273 -273
- metadata +40 -16
data/ext/solaris/sfile.h
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
#define SOLARIS_VERSION "0.3.
|
1
|
+
#define SOLARIS_VERSION "0.3.6"
|
2
2
|
#define MAX_STRING 512
|
3
3
|
|
4
4
|
VALUE cSolarisFileError;
|
@@ -8,37 +8,38 @@ VALUE sACLStruct;
|
|
8
8
|
* Converts a numeric ACL type into a human readable string.
|
9
9
|
*/
|
10
10
|
static VALUE acl_type_string(int acl_type){
|
11
|
-
|
11
|
+
VALUE v_acl_type;
|
12
12
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
13
|
+
switch(acl_type){
|
14
|
+
case USER: case USER_OBJ:
|
15
|
+
v_acl_type = rb_str_new2("user");
|
16
|
+
break;
|
17
|
+
case GROUP: case GROUP_OBJ:
|
18
|
+
v_acl_type = rb_str_new2("group");
|
19
|
+
break;
|
20
|
+
case OTHER_OBJ:
|
21
|
+
v_acl_type = rb_str_new2("other");
|
22
|
+
break;
|
23
|
+
case CLASS_OBJ:
|
24
|
+
v_acl_type = rb_str_new2("mask");
|
25
|
+
break;
|
26
|
+
case DEF_USER: case DEF_USER_OBJ:
|
27
|
+
v_acl_type = rb_str_new2("defaultuser");
|
28
|
+
break;
|
29
|
+
case DEF_GROUP: case DEF_GROUP_OBJ:
|
30
|
+
v_acl_type = rb_str_new2("defaultgroup");
|
31
|
+
break;
|
32
|
+
case DEF_OTHER_OBJ:
|
33
|
+
v_acl_type = rb_str_new2("defaultother");
|
34
|
+
break;
|
35
|
+
case DEF_CLASS_OBJ:
|
36
|
+
v_acl_type = rb_str_new2("defaultmask");
|
37
|
+
break;
|
38
|
+
default:
|
39
|
+
v_acl_type = rb_str_new2("unknown");
|
40
|
+
}
|
41
|
+
|
42
|
+
return v_acl_type;
|
42
43
|
}
|
43
44
|
|
44
45
|
/*
|
@@ -47,32 +48,40 @@ static VALUE acl_type_string(int acl_type){
|
|
47
48
|
void do_acl_check(int aclcheck_val, int which){
|
48
49
|
char err[MAX_STRING];
|
49
50
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
51
|
+
switch(aclcheck_val){
|
52
|
+
case 0:
|
53
|
+
break; // Nothing wrong
|
54
|
+
case USER_ERROR:
|
55
|
+
sprintf(err,"Invalid ACL entry: %i; Multiple user entries", which);
|
56
|
+
rb_raise(cSolarisFileError, err);
|
57
|
+
break;
|
58
|
+
case GRP_ERROR:
|
59
|
+
sprintf(err,"Invalid ACL entry: %i; Multiple group entries", which);
|
60
|
+
rb_raise(cSolarisFileError, err);
|
61
|
+
break;
|
62
|
+
case OTHER_ERROR:
|
63
|
+
sprintf(err,"Invalid ACL entry: %i; Multiple other entries", which);
|
64
|
+
rb_raise(cSolarisFileError, err);
|
65
|
+
break;
|
66
|
+
case CLASS_ERROR:
|
67
|
+
sprintf(err,"Invalid ACL entry: %i; Multiple mask entries", which);
|
68
|
+
rb_raise(cSolarisFileError, err);
|
69
|
+
break;
|
70
|
+
case DUPLICATE_ERROR:
|
71
|
+
sprintf(err,"Invalid ACL entry: %i; Multiple user or group entries", which);
|
72
|
+
rb_raise(cSolarisFileError, err);
|
73
|
+
break;
|
74
|
+
case ENTRY_ERROR:
|
75
|
+
sprintf(err,"Invalid ACL entry: %i; Invalid entry type", which);
|
76
|
+
rb_raise(cSolarisFileError, err);
|
77
|
+
break;
|
78
|
+
case MISS_ERROR:
|
79
|
+
rb_raise(cSolarisFileError, "Missing ACL entries");
|
80
|
+
break;
|
81
|
+
case MEM_ERROR:
|
82
|
+
rb_raise(cSolarisFileError, "Out of memory!");
|
83
|
+
break;
|
84
|
+
default:
|
85
|
+
rb_raise(cSolarisFileError, "Unknown error");
|
86
|
+
};
|
78
87
|
}
|
data/solaris-file.gemspec
CHANGED
@@ -1,37 +1,35 @@
|
|
1
1
|
require 'rubygems'
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
3
|
+
Gem::Specification.new do |gem|
|
4
|
+
gem.name = 'solaris-file'
|
5
|
+
gem.version = '0.3.6'
|
6
|
+
gem.author = 'Daniel J. Berger'
|
7
|
+
gem.license = 'Artistic 2.0'
|
8
|
+
gem.email = 'djberg96@gmail.com'
|
9
|
+
gem.homepage = 'http://www.rubyforge.org/projects/solarisutils'
|
10
|
+
gem.platform = Gem::Platform::RUBY
|
11
|
+
gem.summary = 'ACL and other methods for the File class on Solaris'
|
12
|
+
gem.has_rdoc = true
|
13
|
+
gem.test_file = 'test/test_solaris_file.rb'
|
14
|
+
gem.extensions = ['ext/extconf.rb']
|
15
|
+
gem.files = Dir['**/*'].reject{ |f| f.include?('git') }
|
16
16
|
|
17
|
-
|
17
|
+
gem.rubyforge_project = 'solarisutils'
|
18
18
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
19
|
+
gem.extra_rdoc_files = [
|
20
|
+
'README',
|
21
|
+
'CHANGES',
|
22
|
+
'MANIFEST',
|
23
|
+
'ext/solaris/sfile.c'
|
24
|
+
]
|
25
25
|
|
26
|
-
|
27
|
-
|
26
|
+
gem.add_development_dependency('test-unit', '>= 2.1.1')
|
27
|
+
gem.add_development_dependency('sys-filesystem', '>= 0.3.1')
|
28
28
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
29
|
+
gem.description = <<-EOF
|
30
|
+
The solaris-file library provides Solaris-specific access control
|
31
|
+
methods to the File class. It also provides methods for identifying
|
32
|
+
trivial and door files, interfaces for the realpath() and resolvepath()
|
33
|
+
functions, and an overloaded ftype method.
|
34
|
+
EOF
|
35
35
|
end
|
36
|
-
|
37
|
-
Gem::Builder.new(spec).build
|
data/test/test_solaris_file.rb
CHANGED
@@ -13,278 +13,278 @@ require 'solaris/file'
|
|
13
13
|
require 'sys/filesystem'
|
14
14
|
|
15
15
|
class TC_Solaris_File < Test::Unit::TestCase
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
16
|
+
def self.startup
|
17
|
+
Dir.chdir(File.dirname(File.expand_path(__FILE__)))
|
18
|
+
|
19
|
+
@@ufs = Sys::Filesystem.stat(Dir.pwd).base_type == 'ufs'
|
20
|
+
@@file1 = File.join(Dir.pwd, 'foo.txt') # trivial
|
21
|
+
@@file2 = File.join(Dir.pwd, 'bar.txt') # non-trivial
|
22
|
+
|
23
|
+
@@acl_text = 'user::rw-,user:nobody:r--,group::r--,group:sys:r--,mask:r--,other:r--'
|
24
|
+
|
25
|
+
File.open(@@file1, 'w'){ |fh| fh.puts 'foo' }
|
26
|
+
File.open(@@file2, 'w'){ |fh| fh.puts 'bar' }
|
27
|
+
end
|
28
|
+
|
29
|
+
def setup
|
30
|
+
@dir = Dir.pwd
|
31
|
+
@door = '/var/run/syslog_door'
|
32
|
+
@stat = File::Stat.new(@door)
|
33
|
+
|
34
|
+
# Make @@file2 a non-trivial file. UFS only.
|
35
|
+
if @@ufs
|
36
|
+
system("chmod A=#{@@acl_text} #{@@file2}")
|
37
|
+
end
|
38
|
+
|
39
|
+
@handle1 = File.open(@@file1)
|
40
|
+
@handle2 = File.open(@@file2)
|
41
|
+
end
|
42
|
+
|
43
|
+
def test_version
|
44
|
+
assert_equal('0.3.6', File::SOLARIS_VERSION)
|
45
|
+
end
|
46
|
+
|
47
|
+
# SINGLETON METHODS
|
48
|
+
|
49
|
+
def test_singleton_acl_read_basic
|
50
|
+
omit_unless(@@ufs, 'skipped on non-ufs filesystem')
|
51
|
+
assert_respond_to(File, :acl_read)
|
52
|
+
assert_nothing_raised{ File.acl_read(@@file1) }
|
53
|
+
end
|
54
|
+
|
55
|
+
def test_singleton_acl_read
|
56
|
+
omit_unless(@@ufs, 'skipped on non-ufs filesystem')
|
57
|
+
assert_nil(File.acl_read(@@file1))
|
58
|
+
assert_kind_of(Array, File.acl_read(@@file2))
|
59
|
+
end
|
60
|
+
|
61
|
+
def test_singleton_acl_read_expected_errors
|
62
|
+
assert_raise(Errno::ENOENT){ File.acl_read('bogus') }
|
63
|
+
assert_raise(ArgumentError){ File.acl_read('bogus' * 500) }
|
64
|
+
assert_raise(ArgumentError){ File.acl_read }
|
65
|
+
assert_raise(TypeError){ File.acl_read(1) }
|
66
|
+
end
|
67
|
+
|
68
|
+
def test_singleton_acl_read_text_basic
|
69
|
+
omit_unless(@@ufs, 'skipped on non-ufs filesystem')
|
70
|
+
assert_respond_to(File, :acl_read_text)
|
71
|
+
assert_nothing_raised{ File.acl_read_text(@@file1) }
|
72
|
+
end
|
73
|
+
|
74
|
+
def test_singleton_acl_read_text
|
75
|
+
omit_unless(@@ufs, 'skipped on non-ufs filesystem')
|
76
|
+
assert_nil(File.acl_read_text(@@file1))
|
77
|
+
assert_kind_of(String,File.acl_read_text(@@file2))
|
78
|
+
end
|
79
|
+
|
80
|
+
def test_singleton_acl_read_text_expected_errors
|
81
|
+
assert_raise(Errno::ENOENT){ File.acl_read_text('bogus') }
|
82
|
+
assert_raise(ArgumentError){ File.acl_read_text }
|
83
|
+
assert_raise(TypeError){ File.acl_read_text(1) }
|
84
|
+
end
|
85
|
+
|
86
|
+
def test_singleton_acl_write_text
|
87
|
+
omit_unless(@@ufs, 'skipped on non-ufs filesystem')
|
88
|
+
acl_text = 'user::rw-,group::r--,mask:r--,other:---'
|
89
|
+
assert_respond_to(File, :acl_write_text)
|
90
|
+
assert_nothing_raised{ File.acl_write_text(@@file1, acl_text) }
|
91
|
+
end
|
92
|
+
|
93
|
+
def test_singleton_acl_write_text_expected_errors
|
94
|
+
assert_raise(File::SolarisError){ File.acl_write_text(@@file1, 'bogus') }
|
95
|
+
end
|
96
|
+
|
97
|
+
def test_singleton_acl_trivial_basic
|
98
|
+
assert_respond_to(File, :trivial?)
|
99
|
+
assert_nothing_raised{ File.trivial?(@@file1) }
|
100
|
+
assert_boolean(File.trivial?(@@file1))
|
101
|
+
end
|
102
|
+
|
103
|
+
def test_singleton_acl_trivial
|
104
|
+
omit_unless(@@ufs, 'skipped on non-ufs filesystem')
|
105
|
+
assert_true(File.trivial?(@@file1))
|
106
|
+
assert_false(File.trivial?(@@file2))
|
107
|
+
end
|
108
|
+
|
109
|
+
def test_singleton_acl_trivial_expected_errors
|
110
|
+
assert_raise(Errno::ENOENT){ File.trivial?('bogus') }
|
111
|
+
assert_raise(ArgumentError){ File.trivial?('bogus' * 500) }
|
112
|
+
assert_raise(ArgumentError){ File.trivial? }
|
113
|
+
assert_raise(TypeError){ File.trivial?(1) }
|
114
|
+
end
|
115
|
+
|
116
|
+
def test_singleton_acl_count
|
117
|
+
assert_respond_to(File, :acl_count)
|
118
|
+
assert_nothing_raised{ File.acl_count(@@file1) }
|
119
|
+
assert_kind_of(Fixnum, File.acl_count(@@file1))
|
120
|
+
end
|
121
|
+
|
122
|
+
def test_singleton_acl_count_expected_errors
|
123
|
+
assert_raise(Errno::ENOENT){ File.acl_count('bogus') }
|
124
|
+
assert_raise(ArgumentError){ File.acl_count('bogus' * 500) }
|
125
|
+
assert_raise(ArgumentError){ File.acl_count }
|
126
|
+
assert_raise(TypeError){ File.acl_count(1) }
|
127
|
+
end
|
128
|
+
|
129
|
+
def test_singleton_realpath_basic
|
130
|
+
assert_respond_to(File, :realpath)
|
131
|
+
assert_nothing_raised{ File.realpath(@dir) }
|
132
|
+
assert_kind_of(String, File.realpath(@dir))
|
133
|
+
end
|
134
|
+
|
135
|
+
def test_singleton_realpath
|
136
|
+
dir1 = File.join(File.dirname(Dir.pwd), 'examples')
|
137
|
+
dir2 = File.join(Dir.pwd, '/.././examples')
|
138
|
+
|
139
|
+
assert_equal(@dir, File.realpath(@dir))
|
140
|
+
assert_equal(dir1, File.realpath(dir2))
|
141
|
+
end
|
142
|
+
|
143
|
+
def test_singleton_realpath_expected_errors
|
144
|
+
assert_raise(Errno::ENOENT){ File.realpath('bogus') }
|
145
|
+
assert_raise(ArgumentError){ File.realpath }
|
146
|
+
assert_raise(TypeError){ File.realpath(1) }
|
147
|
+
end
|
148
|
+
|
149
|
+
def test_singleton_resolvepath_basic
|
150
|
+
assert_respond_to(File, :resolvepath)
|
151
|
+
assert_nothing_raised{ File.resolvepath(@dir) }
|
152
|
+
assert_kind_of(String, File.resolvepath(@dir))
|
153
|
+
end
|
154
|
+
|
155
|
+
def test_singleton_resolvepath
|
156
|
+
assert_equal(@dir, File.resolvepath(@dir))
|
157
|
+
assert_equal("../examples", File.resolvepath("../examples"))
|
158
|
+
end
|
159
|
+
|
160
|
+
def test_singleton_resolvepath_expected_errors
|
161
|
+
assert_raise(Errno::ENOENT){ File.resolvepath('bogus') }
|
162
|
+
assert_raise(ArgumentError){ File.resolvepath }
|
163
|
+
assert_raise(TypeError){ File.resolvepath(1) }
|
164
|
+
end
|
165
|
+
|
166
|
+
def test_singleton_is_door_basic
|
167
|
+
assert_respond_to(File, :door?)
|
168
|
+
assert_nothing_raised{ File.door?(@door) }
|
169
|
+
assert_boolean(File.door?(@door))
|
170
|
+
end
|
171
171
|
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
172
|
+
def test_singleton_is_door
|
173
|
+
assert_true(File.door?(@door))
|
174
|
+
assert_false(File.door?(Dir.pwd))
|
175
|
+
end
|
176
|
+
|
177
|
+
def test_singleton_is_door_expected_errors
|
178
|
+
assert_raise(Errno::ENOENT){ File.door?('bogus') }
|
179
|
+
assert_raise(ArgumentError){ File.door? }
|
180
|
+
assert_raise(TypeError){ File.door?(1) }
|
181
|
+
end
|
182
|
+
|
183
|
+
def test_singleton_ftype_basic
|
184
|
+
assert_respond_to(File, :ftype)
|
185
|
+
end
|
186
|
+
|
187
|
+
def test_singleton_ftype
|
188
|
+
assert_equal('door', File.ftype(@door))
|
189
|
+
assert_equal('directory', File.ftype(Dir.pwd))
|
190
|
+
end
|
191
|
+
|
192
|
+
def test_singleton_ftype_expected_errors
|
193
|
+
assert_raise(Errno::ENOENT){ File.ftype('bogus') }
|
194
|
+
assert_raise(ArgumentError){ File.ftype }
|
195
|
+
assert_raise(TypeError){ File.ftype(1) }
|
196
|
+
end
|
197
|
+
|
198
|
+
# INSTANCE METHODS
|
199
|
+
|
200
|
+
def test_instance_acl_basic
|
201
|
+
omit_unless(@@ufs, 'skipped on non-ufs filesystem')
|
202
|
+
assert_respond_to(@handle1, :acl_read)
|
203
|
+
assert_nothing_raised{ @handle1.acl_read }
|
204
|
+
end
|
205
|
+
|
206
|
+
def test_instance_acl
|
207
|
+
omit_unless(@@ufs, 'skipped on non-ufs filesystem')
|
208
|
+
assert_nil(@handle1.acl_read)
|
209
|
+
assert_kind_of(Array, @handle2.acl_read)
|
210
|
+
assert_kind_of(Struct::ACLStruct, @handle2.acl_read.first)
|
211
|
+
end
|
212
|
+
|
213
|
+
def test_instance_acl_read_text_basic
|
214
|
+
omit_unless(@@ufs, 'skipped on non-ufs filesystem')
|
215
|
+
assert_respond_to(@handle1, :acl_read_text)
|
216
|
+
assert_nothing_raised{ @handle1.acl_read_text }
|
217
|
+
end
|
218
|
+
|
219
|
+
def test_instance_acl_read_text
|
220
|
+
omit_unless(@@ufs, 'skipped on non-ufs filesystem')
|
221
|
+
assert_nil(@handle1.acl_read_text)
|
222
|
+
assert_kind_of(String, @handle2.acl_read_text)
|
223
|
+
end
|
224
|
+
|
225
|
+
def test_instance_acl_write_text
|
226
|
+
omit_unless(@@ufs, 'skipped on non-ufs filesystem')
|
227
|
+
acl_text = 'user::rw-,group::r--,mask:r--,other:---'
|
228
|
+
assert_respond_to(@handle2, :acl_write_text)
|
229
|
+
assert_nothing_raised{ @handle2.acl_write_text(acl_text) }
|
230
|
+
end
|
231
|
+
|
232
|
+
def test_instance_acl_write_text_expected_errors
|
233
|
+
assert_raise(File::SolarisError){ @handle2.acl_write_text('bogus') }
|
234
|
+
assert_raise(ArgumentError){ @handle2.acl_write_text }
|
235
|
+
assert_raise(TypeError){ @handle2.acl_write_text(1) }
|
236
|
+
end
|
237
|
+
|
238
|
+
def test_instance_acl_trivial_basic
|
239
|
+
assert_respond_to(@handle1, :trivial?)
|
240
|
+
assert_nothing_raised{ @handle1.trivial? }
|
241
|
+
assert_boolean(@handle1.trivial?)
|
242
|
+
end
|
243
|
+
|
244
|
+
def test_instance_acl_trivial
|
245
|
+
assert_true(@handle1.trivial?)
|
246
|
+
assert_false(@handle2.trivial?)
|
247
|
+
end
|
248
|
+
|
249
|
+
def test_instance_acl_count_basic
|
250
|
+
omit_unless(@@ufs, 'skipped on non-ufs filesystem')
|
251
|
+
assert_respond_to(@handle1, :acl_count)
|
252
|
+
assert_nothing_raised{ @handle1.acl_count }
|
253
|
+
assert_kind_of(Fixnum, @handle1.acl_count)
|
254
|
+
end
|
255
|
+
|
256
|
+
def test_instance_acl_count
|
257
|
+
omit_unless(@@ufs, 'skipped on non-ufs filesystem')
|
258
|
+
assert_equal(0, @handle1.acl_count)
|
259
|
+
assert_equal(6, @handle2.acl_count)
|
260
|
+
end
|
261
|
+
|
262
|
+
def test_stat_door
|
263
|
+
assert_respond_to(@stat, :door?)
|
264
|
+
assert_true(@stat.door?)
|
265
|
+
end
|
266
|
+
|
267
|
+
def test_stat_ftype
|
268
|
+
assert_respond_to(@stat, :ftype)
|
269
|
+
assert_equal('door', @stat.ftype)
|
270
|
+
end
|
271
|
+
|
272
|
+
def teardown
|
273
|
+
@handle1.close unless @handle1.closed?
|
274
|
+
@handle2.close unless @handle2.closed?
|
275
|
+
|
276
|
+
@dir = nil
|
277
|
+
@handle1 = nil
|
278
|
+
@handle2 = nil
|
279
|
+
end
|
280
|
+
|
281
|
+
def self.shutdown
|
282
|
+
File.delete(@@file1) if File.exists?(@@file1)
|
283
|
+
File.delete(@@file2) if File.exists?(@@file2)
|
284
|
+
|
285
|
+
@@ufs = nil
|
286
|
+
@@file1 = nil
|
287
|
+
@@file2 = nil
|
288
|
+
@@acl_text = nil
|
289
|
+
end
|
290
290
|
end
|