extattr 0.1.2-x86-mingw32 → 0.2-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
metadata CHANGED
@@ -1,68 +1,91 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: extattr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
5
- prerelease:
4
+ version: '0.2'
6
5
  platform: x86-mingw32
7
6
  authors:
8
7
  - dearblue
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-02-22 00:00:00.000000000 Z
13
- dependencies: []
14
- description: ! 'extattr is extended attribute operation library for ruby.
15
-
16
- Supported for FreeBSD, Gnu/Linux and Microsoft Windows.
17
-
18
- '
11
+ date: 2014-03-16 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rspec
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '2.14'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '2.14'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ description: |
42
+ extattr is extended file attribute operation library for ruby.
43
+ Supported for FreeBSD (extattr), GNU/Linux (xattr) and Microsoft Windows (NTFS ADS + Extended Attributes).
19
44
  email: dearblue@users.sourceforge.jp
20
45
  executables: []
21
46
  extensions: []
22
- extra_rdoc_files:
23
- - README.txt
24
- - LICENSE.txt
25
- - ext/extattr.c
47
+ extra_rdoc_files: []
26
48
  files:
27
- - README.txt
28
- - LICENSE.txt
29
- - ext/extconf.rb
49
+ - LICENSE.md
50
+ - README.md
51
+ - Rakefile
52
+ - ext/extattr-extattr.h
53
+ - ext/extattr-windows.h
54
+ - ext/extattr-xattr.h
30
55
  - ext/extattr.c
31
- - ext/extattr.bsd
32
- - ext/extattr.linux
33
- - ext/extattr.windows
34
- - lib/extattr.rb
56
+ - ext/extconf.rb
35
57
  - lib/1.9.1/extattr.so
36
58
  - lib/2.0.0/extattr.so
37
- - rspecs/extattr.rb
59
+ - lib/2.1.0/extattr.so
60
+ - lib/extattr.rb
61
+ - spec/extattr_spec.rb
38
62
  homepage: http://sourceforge.jp/projects/rutsubo/
39
63
  licenses:
40
64
  - 2-clause BSD License
65
+ metadata: {}
41
66
  post_install_message:
42
67
  rdoc_options:
43
- - -e
68
+ - "--charset"
44
69
  - UTF-8
45
- - -m
46
- - README.txt
70
+ - "--main"
71
+ - README.md
47
72
  require_paths:
48
73
  - lib
49
74
  required_ruby_version: !ruby/object:Gem::Requirement
50
- none: false
51
75
  requirements:
52
- - - ! '>='
76
+ - - ">="
53
77
  - !ruby/object:Gem::Version
54
78
  version: 1.9.3
55
79
  required_rubygems_version: !ruby/object:Gem::Requirement
56
- none: false
57
80
  requirements:
58
- - - ! '>='
81
+ - - ">="
59
82
  - !ruby/object:Gem::Version
60
83
  version: '0'
61
84
  requirements: []
62
85
  rubyforge_project:
63
- rubygems_version: 1.8.24
86
+ rubygems_version: 2.2.2
64
87
  signing_key:
65
- specification_version: 3
88
+ specification_version: 4
66
89
  summary: extended attribute operation library for ruby
67
90
  test_files: []
68
- has_rdoc: false
91
+ has_rdoc:
data/README.txt DELETED
@@ -1,73 +0,0 @@
1
- = extattr
2
-
3
- extattr is filesystem extended attributes operation library for FreeBSD, GNU/Linux and Microsoft Windows.
4
-
5
- ----
6
-
7
- extattr はファイルシステムの拡張属性を操作するライブラリで、FreeBSD、GNU/Linux、Windows に対応しています。
8
-
9
- サポートされる環境で、統一的なメソッドを提供します。
10
-
11
-
12
- == test system
13
-
14
- - Microsoft Windows XP Professional SP3
15
- - PC-BSD/AMD64 9.0
16
- - lubuntu 12.04
17
-
18
-
19
- == 簡易リファレンスマニュアル
20
-
21
- クラスメソッドに『!』がついているものはシンボリックリンクに対する操作となります。
22
-
23
- キーワード引数の <code>namespace</code> を与えると、拡張属性の名前空間を指定できます。
24
- 規定値は <code>EXTATTR_NAMESPACE_USER</code> で、ほかの値は <code>EXTATTR_NAMESPACE_SYSTEM</code> のみが指定できます
25
- (Windows 版では <code>EXTATTR_NAMESPACE_USER</code> のみが指定可能です)。
26
-
27
- 拡張属性の属性名を取得:
28
-
29
- File#extattr_list(namespace: File::EXTATTR_NAMESPACE_USER) -> array
30
- File#extattr_list(namespace: File::EXTATTR_NAMESPACE_USER) { |name| ... } -> nil
31
- File.extattr_list(path, namespace: File::EXTATTR_NAMESPACE_USER) -> array
32
- File.extattr_list(path, namespace: File::EXTATTR_NAMESPACE_USER) { |name| ... } -> nil
33
- File.extattr_list!(path, namespace: File::EXTATTR_NAMESPACE_USER) -> array
34
- File.extattr_list!(path, namespace: File::EXTATTR_NAMESPACE_USER) { |name| ... } -> nil
35
-
36
- 拡張属性の要素の大きさを取得:
37
-
38
- File#extattr_size(name, namespace: File::EXTATTR_NAMESPACE_USER) -> size
39
- File.extattr_size(path, name, namespace: File::EXTATTR_NAMESPACE_USER) -> size
40
- File.extattr_size!(path, name, namespace: File::EXTATTR_NAMESPACE_USER) -> size
41
-
42
- 拡張属性の要素を取得:
43
-
44
- File#extattr_get(name, namespace: File::EXTATTR_NAMESPACE_USER) -> data (String)
45
- File.extattr_get(path, name, namespace: File::EXTATTR_NAMESPACE_USER) -> data (String)
46
- File.extattr_get!(path, name, namespace: File::EXTATTR_NAMESPACE_USER) -> data (String)
47
-
48
- 拡張属性の要素を設定:
49
-
50
- File#extattr_set(name, data, namespace: File::EXTATTR_NAMESPACE_USER) -> nil
51
- File.extattr_set(path, name, data, namespace: File::EXTATTR_NAMESPACE_USER) -> nil
52
- File.extattr_set!(path, name, data, namespace: File::EXTATTR_NAMESPACE_USER) -> nil
53
-
54
- 拡張属性の要素を削除:
55
-
56
- File#extattr_delete(name, namespace: File::EXTATTR_NAMESPACE_USER) -> nil
57
- File.extattr_delete(path, name, namespace: File::EXTATTR_NAMESPACE_USER) -> nil
58
- File.extattr_delete!(path, name, namespace: File::EXTATTR_NAMESPACE_USER) -> nil
59
-
60
-
61
- == Microsoft Windows における諸注意
62
-
63
- Windows 2000 以降でのみ動作します。Windows 9X シリーズでは <code>require "extattr"</code> の段階で例外が発生するでしょう。
64
-
65
- リパースポイント (ジャンクションやシンボリックリンク) に対する ADS は要素の取得や設定、削除は出来ません。
66
- 必ずリンク先に対する操作となります。
67
-
68
- 64 KiB を超える ADS は取得も設定も出来ません。
69
- これは『拡張属性』と捉えた場合、巨大なデータを扱えるべきではないという考えによるためです
70
- (本当のところは FreeBSD の拡張属性が最大 64KiB 弱であることが由来です)。
71
- 巨大な ADS を扱いたい場合は、<code>File.open</code> でファイルとして扱えるので自由に読み書きできます
72
- (これは ruby に限ったことではなく、Windows による仕様です)。
73
- この場合の与えるファイル名は、<code>path + ":" + name</code> という形になります。
data/ext/extattr.bsd DELETED
@@ -1,186 +0,0 @@
1
- #include <sys/types.h>
2
- #include <sys/extattr.h>
3
-
4
-
5
- static void
6
- split_name(const char list[], size_t size, void (*func)(void *, VALUE), void *userdata)
7
- {
8
- // Each list entry consists of a single byte containing the length of
9
- // the attribute name, followed by the attribute name.
10
- // The attribute name is not terminated by ASCII 0 (nul).
11
- const char *ptr = list;
12
- const char *end = list + size;
13
-
14
- while (ptr < end) {
15
- size_t len = (uint8_t)*ptr ++;
16
- if (ptr + len > end) { return; }
17
- func(userdata, rb_str_new(ptr, len));
18
- ptr += len;
19
- }
20
- }
21
-
22
- static int
23
- get_extattr_list_size(int (*extattr_list)(), intptr_t d, int namespace)
24
- {
25
- int size = extattr_list(d, namespace, NULL, 0);
26
- if (size < 0) { rb_sys_fail("extattr_list call error"); }
27
- return size;
28
- }
29
-
30
- static VALUE
31
- extattr_list0(int (*extattr_list)(), intptr_t d, int namespace)
32
- {
33
- size_t size = get_extattr_list_size(extattr_list, d, namespace);
34
- VALUE buf = rb_str_buf_new(size);
35
- char *ptr = RSTRING_PTR(buf);
36
-
37
- ssize_t size1 = extattr_list(d, namespace, ptr, size);
38
- if (size1 < 0) { rb_sys_fail("extattr_list call error"); }
39
-
40
- VALUE list = Qnil;
41
- if (rb_block_given_p()) {
42
- split_name(ptr, size1, (void (*)(void *, VALUE))rb_yield_values, (void *)(1));
43
- } else {
44
- list = rb_ary_new();
45
- split_name(ptr, size1, (void (*)(void *, VALUE))rb_ary_push, (void *)list);
46
- }
47
- rb_free_tmp_buffer(&buf);
48
-
49
- return list;
50
- }
51
-
52
- static VALUE
53
- file_extattr_list0(VALUE file, int fd, int namespace)
54
- {
55
- return extattr_list0(extattr_list_fd, fd, namespace);
56
- }
57
-
58
- static VALUE
59
- file_s_extattr_list0(VALUE path, int namespace)
60
- {
61
- return extattr_list0(extattr_list_file, (intptr_t)StringValueCStr(path), namespace);
62
- }
63
-
64
- static VALUE
65
- file_s_extattr_list_link0(VALUE path, int namespace)
66
- {
67
- return extattr_list0(extattr_list_link, (intptr_t)StringValueCStr(path), namespace);
68
- }
69
-
70
-
71
- static VALUE
72
- extattr_size0(int (*extattr_get)(), intptr_t d, int namespace, VALUE name)
73
- {
74
- ssize_t size = extattr_get(d, namespace, RSTRING_PTR(name), NULL, 0);
75
- if (size < 0) { rb_sys_fail("extattr_get call error"); }
76
- return SIZET2NUM(size);
77
- }
78
-
79
- static VALUE
80
- file_extattr_size0(VALUE file, int fd, int namespace, VALUE name)
81
- {
82
- return extattr_size0(extattr_get_fd, fd, namespace, name);
83
- }
84
-
85
- static VALUE
86
- file_s_extattr_size0(VALUE path, int namespace, VALUE name)
87
- {
88
- return extattr_size0(extattr_get_file, (intptr_t)StringValueCStr(path), namespace, name);
89
- }
90
-
91
- static VALUE
92
- file_s_extattr_size_link0(VALUE path, int namespace, VALUE name)
93
- {
94
- return extattr_size0(extattr_get_link, (intptr_t)StringValueCStr(path), namespace, name);
95
- }
96
-
97
-
98
- static VALUE
99
- extattr_get0(int (*extattr_get)(), intptr_t d, VALUE path, int namespace, VALUE name)
100
- {
101
- ssize_t size = extattr_get(d, namespace, RSTRING_PTR(name), NULL, 0);
102
- if (size < 0) { rb_sys_fail(StringValueCStr(path)); }
103
- VALUE buf = rb_str_buf_new(size);
104
- size = extattr_get(d, namespace, RSTRING_PTR(name), RSTRING_PTR(buf), size);
105
- if (size < 0) { rb_sys_fail(StringValueCStr(path)); }
106
- rb_str_set_len(buf, size);
107
- return buf;
108
- }
109
-
110
- static VALUE
111
- file_extattr_get0(VALUE file, int fd, int namespace, VALUE name)
112
- {
113
- return extattr_get0(extattr_get_fd, fd, RFILE(file)->fptr->pathv, namespace, name);
114
- }
115
-
116
- static VALUE
117
- file_s_extattr_get0(VALUE path, int namespace, VALUE name)
118
- {
119
- return extattr_get0(extattr_get_file, (intptr_t)StringValueCStr(path), path, namespace, name);
120
- }
121
-
122
- static VALUE
123
- file_s_extattr_get_link0(VALUE path, int namespace, VALUE name)
124
- {
125
- return extattr_get0(extattr_get_link, (intptr_t)StringValueCStr(path), path, namespace, name);
126
- }
127
-
128
-
129
- static VALUE
130
- extattr_set0(int (*extattr_set)(), intptr_t d, int namespace, VALUE name, VALUE data)
131
- {
132
- int status = extattr_set(d, namespace, RSTRING_PTR(name), RSTRING_PTR(data), RSTRING_LEN(data));
133
- if (status < 0) { rb_sys_fail("extattr_set call error"); }
134
- return Qnil;
135
- }
136
-
137
- static VALUE
138
- file_extattr_set0(VALUE file, int fd, int namespace, VALUE name, VALUE data)
139
- {
140
- return extattr_set0(extattr_set_fd, fd, namespace, name, data);
141
- }
142
-
143
- static VALUE
144
- file_s_extattr_set0(VALUE path, int namespace, VALUE name, VALUE data)
145
- {
146
- return extattr_set0(extattr_set_file, (intptr_t)StringValueCStr(path), namespace, name, data);
147
- }
148
-
149
- static VALUE
150
- file_s_extattr_set_link0(VALUE path, int namespace, VALUE name, VALUE data)
151
- {
152
- return extattr_set0(extattr_set_link, (intptr_t)StringValueCStr(path), namespace, name, data);
153
- }
154
-
155
-
156
- static VALUE
157
- extattr_delete0(int (*extattr_delete)(), intptr_t d, int namespace, VALUE name)
158
- {
159
- int status = extattr_delete(d, namespace, RSTRING_PTR(name), NULL, 0);
160
- if (status < 0) { rb_sys_fail("extattr_delete call error"); }
161
- return Qnil;
162
- }
163
-
164
- static VALUE
165
- file_extattr_delete0(VALUE file, int fd, int namespace, VALUE name)
166
- {
167
- return extattr_delete0(extattr_delete_fd, fd, namespace, name);
168
- }
169
-
170
- static VALUE
171
- file_s_extattr_delete0(VALUE path, int namespace, VALUE name)
172
- {
173
- return extattr_delete0(extattr_delete_file, (intptr_t)StringValueCStr(path), namespace, name);
174
- }
175
-
176
- static VALUE
177
- file_s_extattr_delete_link0(VALUE path, int namespace, VALUE name)
178
- {
179
- return extattr_delete0(extattr_delete_link, (intptr_t)StringValueCStr(path), namespace, name);
180
- }
181
-
182
-
183
- static void
184
- setup(void)
185
- {
186
- }
data/ext/extattr.linux DELETED
@@ -1,222 +0,0 @@
1
- #include <sys/types.h>
2
- #if HAVE_ATTR_XATTR_H
3
- # include <attr/xattr.h>
4
- #else
5
- # include <sys/xattr.h>
6
- #endif
7
-
8
- enum {
9
- EXTATTR_NAMESPACE_USER,
10
- EXTATTR_NAMESPACE_SYSTEM,
11
- EXTATTR_NAMESPACE_TRUSTED,
12
- EXTATTR_NAMESPACE_SECURITY,
13
- };
14
-
15
-
16
- static VALUE NAMESPACE_USER_PREFIX, NAMESPACE_SYSTEM_PREFIX;
17
-
18
-
19
- static VALUE
20
- xattr_name(int namespace, VALUE name)
21
- {
22
- switch (namespace) {
23
- case EXTATTR_NAMESPACE_USER:
24
- return rb_str_plus(NAMESPACE_USER_PREFIX, name);
25
- case EXTATTR_NAMESPACE_SYSTEM:
26
- return rb_str_plus(NAMESPACE_SYSTEM_PREFIX, name);
27
- default:
28
- rb_raise(rb_eRuntimeError, "namespace error");
29
- return Qnil;
30
- }
31
- }
32
-
33
-
34
- static inline void
35
- extattr_list_name(const char *ptr, size_t size, int namespace, VALUE (*reduce)(void *, VALUE), void *user)
36
- {
37
- const char *end = ptr + size;
38
- while (ptr < end) {
39
- int len = strlen(ptr);
40
- VALUE name;
41
- if (namespace == EXTATTR_NAMESPACE_USER && len > 5 && strncmp(ptr, "user.", 5) == 0) {
42
- ptr += 5;
43
- } else if (namespace == EXTATTR_NAMESPACE_SYSTEM && len > 7 && strncmp(ptr, "system.", 7) == 0) {
44
- ptr += 7;
45
- } else {
46
- ptr += len + 1;
47
- continue;
48
- }
49
-
50
- name = rb_str_new_cstr(ptr);
51
- reduce(user, name);
52
- ptr += RSTRING_LEN(name) + 1; // 最後の『+1』は、ヌルバイトの分。
53
- }
54
- }
55
-
56
- static VALUE
57
- extattr_list0(ssize_t (*func)(), void *d, int namespace)
58
- {
59
- ssize_t size = 65536;
60
- VALUE buf = rb_str_buf_new(size);
61
- char *ptr = RSTRING_PTR(buf);
62
- size = func(d, ptr, size);
63
- if (size < 0) { rb_sys_fail("listxattr call error"); }
64
-
65
- if (rb_block_given_p()) {
66
- extattr_list_name(ptr, size, namespace,
67
- (VALUE (*)(void *, VALUE))rb_yield_values,
68
- (void *)1);
69
- return Qnil;
70
- } else {
71
- VALUE list = rb_ary_new();
72
- extattr_list_name(ptr, size, namespace,
73
- (VALUE (*)(void *, VALUE))rb_ary_push,
74
- (void *)list);
75
- return list;
76
- }
77
- }
78
-
79
- static VALUE
80
- file_extattr_list0(VALUE file, int fd, int namespace)
81
- {
82
- return extattr_list0(flistxattr, (void *)fd, namespace);
83
- }
84
-
85
- static VALUE
86
- file_s_extattr_list0(VALUE path, int namespace)
87
- {
88
- return extattr_list0(listxattr, StringValueCStr(path), namespace);
89
- }
90
-
91
- static VALUE
92
- file_s_extattr_list_link0(VALUE path, int namespace)
93
- {
94
- return extattr_list0(llistxattr, StringValueCStr(path), namespace);
95
- }
96
-
97
-
98
- static VALUE
99
- extattr_size0(ssize_t (*func)(), void *d, int namespace, VALUE name)
100
- {
101
- name = xattr_name(namespace, name);
102
- ssize_t size = func(d, StringValueCStr(name), NULL, 0);
103
- if (size < 0) { rb_sys_fail("getxattr call error"); }
104
- return SSIZET2NUM(size);
105
- }
106
-
107
- static VALUE
108
- file_extattr_size0(VALUE file, int fd, int namespace, VALUE name)
109
- {
110
- return extattr_size0(fgetxattr, (void *)fd, namespace, name);
111
- }
112
-
113
- static VALUE
114
- file_s_extattr_size0(VALUE path, int namespace, VALUE name)
115
- {
116
- return extattr_size0(getxattr, StringValueCStr(path), namespace, name);
117
- }
118
-
119
- static VALUE
120
- file_s_extattr_size_link0(VALUE path, int namespace, VALUE name)
121
- {
122
- return extattr_size0(lgetxattr, StringValueCStr(path), namespace, name);
123
- }
124
-
125
-
126
- static VALUE
127
- extattr_get0(ssize_t (*func)(), void *d, int namespace, VALUE name)
128
- {
129
- name = xattr_name(namespace, name);
130
- ssize_t size = 65536;
131
- VALUE buf = rb_str_buf_new(size);
132
- char *ptr = RSTRING_PTR(buf);
133
- size = func(d, StringValueCStr(name), ptr, size);
134
- if (size < 0) { rb_sys_fail("getxattr call error"); }
135
- rb_str_set_len(buf, size);
136
- return buf;
137
- }
138
-
139
- static VALUE
140
- file_extattr_get0(VALUE file, int fd, int namespace, VALUE name)
141
- {
142
- return extattr_get0(fgetxattr, (void *)fd, namespace, name);
143
- }
144
-
145
- static VALUE
146
- file_s_extattr_get0(VALUE path, int namespace, VALUE name)
147
- {
148
- return extattr_get0(getxattr, StringValueCStr(path), namespace, name);
149
- }
150
-
151
- static VALUE
152
- file_s_extattr_get_link0(VALUE path, int namespace, VALUE name)
153
- {
154
- return extattr_get0(lgetxattr, StringValueCStr(path), namespace, name);
155
- }
156
-
157
-
158
- static VALUE
159
- extattr_set0(int (*func)(), void *d, int namespace, VALUE name, VALUE data)
160
- {
161
- name = xattr_name(namespace, name);
162
- int status = func(d, StringValueCStr(name), RSTRING_PTR(data), RSTRING_LEN(data), 0);
163
- if (status < 0) { rb_sys_fail("getxattr call error"); }
164
- return Qnil;
165
- }
166
-
167
- static VALUE
168
- file_extattr_set0(VALUE file, int fd, int namespace, VALUE name, VALUE data)
169
- {
170
- return extattr_set0(fsetxattr, (void *)fd, namespace, name, data);
171
- }
172
-
173
- static VALUE
174
- file_s_extattr_set0(VALUE path, int namespace, VALUE name, VALUE data)
175
- {
176
- return extattr_set0(setxattr, StringValueCStr(path), namespace, name, data);
177
- }
178
-
179
- static VALUE
180
- file_s_extattr_set_link0(VALUE path, int namespace, VALUE name, VALUE data)
181
- {
182
- return extattr_set0(lsetxattr, StringValueCStr(path), namespace, name, data);
183
- }
184
-
185
-
186
- static VALUE
187
- extattr_delete0(int (*func)(), void *d, int namespace, VALUE name)
188
- {
189
- name = xattr_name(namespace, name);
190
- int status = func(d, StringValueCStr(name));
191
- if (status < 0) { rb_sys_fail("removexattr call error"); }
192
- return Qnil;
193
- }
194
-
195
- static VALUE
196
- file_extattr_delete0(VALUE file, int fd, int namespace, VALUE name)
197
- {
198
- return extattr_delete0(fremovexattr, (void *)fd, namespace, name);
199
- }
200
-
201
- static VALUE
202
- file_s_extattr_delete0(VALUE path, int namespace, VALUE name)
203
- {
204
- return extattr_delete0(removexattr, StringValueCStr(path), namespace, name);
205
- }
206
-
207
- static VALUE
208
- file_s_extattr_delete_link0(VALUE path, int namespace, VALUE name)
209
- {
210
- return extattr_delete0(lremovexattr, StringValueCStr(path), namespace, name);
211
- }
212
-
213
-
214
- static void
215
- setup(void)
216
- {
217
- NAMESPACE_USER_PREFIX = rb_str_new_cstr("user.");
218
- NAMESPACE_SYSTEM_PREFIX = rb_str_new_cstr("system.");
219
-
220
- rb_gc_register_mark_object(NAMESPACE_USER_PREFIX);
221
- rb_gc_register_mark_object(NAMESPACE_SYSTEM_PREFIX);
222
- }