extattr 0.1 → 0.4

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/ext/extconf.rb CHANGED
@@ -1,28 +1,32 @@
1
1
  #!ruby
2
- #vim: set fileencoding:utf-8
3
-
4
- raise "require ruby-1.9.3+" unless RUBY_VERSION >= "1.9.3"
5
2
 
6
3
  require "mkmf"
7
4
 
8
- #$CFLAGS << " -std=c99"
5
+ have_func("rb_ext_ractor_safe", "ruby.h")
9
6
 
10
7
  case
11
8
  when have_header("sys/extattr.h")
9
+
12
10
  when have_header("attr/xattr.h")
11
+ $CPPFLAGS << " -DLINUX_XATTR_H=\\<attr/xattr.h\\>"
12
+
13
+ when have_header("sys/xattr.h")
14
+ $CPPFLAGS << " -DLINUX_XATTR_H=\\<sys/xattr.h\\>"
15
+
13
16
  when have_header("winnt.h") && have_header("ntdef.h") && have_header("psapi.h") &&
14
17
  have_header("ddk/ntifs.h") && have_header("ddk/winddk.h") &&
15
18
  have_library("ntoskrnl") && have_library("ntdll") && have_library("psapi")
19
+ if RbConfig::CONFIG["arch"] =~ /mingw/
20
+ $LDFLAGS << " -static-libgcc -static-libstdc++"
21
+ end
22
+
16
23
  else
17
- $stderr.puts <<-EOS
24
+ $stderr.puts <<EOM
18
25
  #$0: not supported target.
19
26
  \tmust be available either ddk/ntifs.h, sys/extattr.h or attr/xattr.h on your system.
20
- EOS
21
- exit 1
27
+ EOM
28
+ exit 1
22
29
  end
23
30
 
24
- create_makefile "extattr" or exit 2
25
-
26
-
27
- #$CPPFLAGS << " -Wall -DFUSE_USE_VERSION=26"
28
-
31
+ ver = RUBY_VERSION.slice(/\d+\.\d+/)
32
+ create_makefile File.join(ver, "extattr")
data/gemstub.rb ADDED
@@ -0,0 +1,22 @@
1
+ unless version = File.read("README.md").scan(/^\s*[\*\-]\s*version:{1,2}\s*(.+)/i).flatten[-1]
2
+ raise "バージョン情報が README.md に見つかりません"
3
+ end
4
+
5
+ DOC << "QUICKREF.ja.md"
6
+
7
+ GEMSTUB = Gem::Specification.new do |s|
8
+ s.name = "extattr"
9
+ s.version = version
10
+ s.summary = "extended file attribute manipurator"
11
+ s.description = <<-EOS
12
+ "extattr" is extended file attribute manipurator for Ruby.
13
+ Supported for FreeBSD (extattr), GNU/Linux (xattr) and Microsoft Windows (NTFS Alternative Data Stream (ADS) + NTFS Extended Attributes (EA)).
14
+ EOS
15
+ s.homepage = "https://github.com/dearblue/ruby-extattr"
16
+ s.license = "BSD-2-Clause"
17
+ s.author = "dearblue"
18
+ s.email = "dearblue@users.osdn.me"
19
+
20
+ s.add_development_dependency "rake", "~> 0"
21
+ s.add_development_dependency "test-unit", "~> 0"
22
+ end
data/lib/extattr.rb ADDED
@@ -0,0 +1,274 @@
1
+ #!ruby
2
+
3
+ ver = RUBY_VERSION.slice(/\d+\.\d+/)
4
+ soname = File.basename(__FILE__, ".rb") << ".so"
5
+ lib = File.join(ver, soname)
6
+ begin
7
+ require_relative lib
8
+ rescue LoadError
9
+ require lib
10
+ end
11
+
12
+ #
13
+ # Add operation methods of filesystem extended attributes to File.
14
+ #
15
+ # === 名前空間の指定について
16
+ #
17
+ # 拡張属性の名前空間を指定する場合、以下の値が利用できます:
18
+ #
19
+ # * ExtAttr::USER, ExtAttr::SYSTEM
20
+ # * 文字列又はシンボルで +user+、+system+ (大文字小文字を区別しません)
21
+ #
22
+ # これらの値は内部で変換、または処理が分岐されます。
23
+ #
24
+ # extattr::
25
+ # 整数値に変換されて処理されます。
26
+ #
27
+ # xattr::
28
+ # 拡張属性名に "user." または "system." を追加して処理されます。
29
+ #
30
+ # Windows::
31
+ # ExtAttr::USER の場合は NTFS Alternative Data Stream (ADS) として処理されます。
32
+ #
33
+ # ExtAttr::SYSTEM の場合は NTFS Extended Attribute (EA) として処理されます。
34
+ #
35
+ module ExtAttr
36
+ ExtAttr = self
37
+
38
+ def self.open(path)
39
+ if path.kind_of?(File)
40
+ ea = ExtAttr::Accessor[path, path.to_path]
41
+ block_given? ? yield(ea) : ea
42
+ else
43
+ if block_given?
44
+ ::File.open(path) do |file|
45
+ return yield(ExtAttr::Accessor[file, path])
46
+ end
47
+ else
48
+ ExtAttr::Accessor[::File.open(path), path]
49
+ end
50
+ end
51
+ end
52
+
53
+ #
54
+ # call-seq:
55
+ # each(path, namespace = ExtAttr::USER) -> Enumerator
56
+ # each(path, namespace = ExtAttr::USER) { |name| ... } -> path
57
+ #
58
+ def self.each(path, namespace = ExtAttr::USER, &block)
59
+ return to_enum(:each, path, namespace) unless block
60
+
61
+ list(path, namespace, &block)
62
+
63
+ self
64
+ end
65
+
66
+ #
67
+ # call-seq:
68
+ # each!(path, namespace = ExtAttr::USER) -> Enumerator
69
+ # each!(path, namespace = ExtAttr::USER) { |name| ... } -> path
70
+ #
71
+ def self.each!(path, namespace = ExtAttr::USER, &block)
72
+ return to_enum(:each!, path, namespace) unless block
73
+
74
+ list!(path, namespace, &block)
75
+
76
+ self
77
+ end
78
+
79
+ #
80
+ # call-seq:
81
+ # each_pair(path, namespace = ExtAttr::USER) -> Enumerator
82
+ # each_pair(path, namespace = ExtAttr::USER) { |name, data| ... } -> path
83
+ #
84
+ def self.each_pair(path, namespace = ExtAttr::USER, &block)
85
+ return to_enum(:each_pair, path, namespace) unless block
86
+
87
+ list(path, namespace) { |name| yield(name, get(path, namespace, name)) }
88
+
89
+ self
90
+ end
91
+
92
+ #
93
+ # call-seq:
94
+ # each_pair!(path, namespace = ExtAttr::USER) -> Enumerator
95
+ # each_pair!(path, namespace = ExtAttr::USER) { |name, data| ... } -> path
96
+ #
97
+ def self.each_pair!(path, namespace = ExtAttr::USER, &block)
98
+ return to_enum(:each_pair!, path, namespace) unless block
99
+
100
+ list!(path, namespace) { |name| yield(name, get!(path, namespace, name)) }
101
+
102
+ self
103
+ end
104
+
105
+ class Accessor < Struct.new(:obj, :path)
106
+ BasicStruct = superclass
107
+ VIRT_ENOATTR = (ExtAttr::IMPLEMENT == "windows" ? Errno::ENOENT : Errno::ENOATTR)
108
+
109
+ def [](name, namespace = ExtAttr::USER)
110
+ begin
111
+ ExtAttr.get(obj, namespace, name)
112
+ rescue VIRT_ENOATTR
113
+ nil
114
+ end
115
+ end
116
+
117
+ def []=(name, namespace = ExtAttr::USER, data)
118
+ if data.nil?
119
+ ExtAttr.delete(obj, namespace, name)
120
+ else
121
+ ExtAttr.set(obj, namespace, name, data)
122
+ end
123
+ end
124
+
125
+ def each(namespace: ExtAttr::USER, &block)
126
+ ExtAttr.each(obj, namespace, &block)
127
+ end
128
+
129
+ def each_pair(namespace: ExtAttr::USER, &block)
130
+ ExtAttr.each_pair(obj, namespace, &block)
131
+ end
132
+
133
+ def list(namespace: ExtAttr::USER, &block)
134
+ ExtAttr.list(obj, namespace, &block)
135
+ end
136
+
137
+ def size(name, namespace: ExtAttr::USER)
138
+ ExtAttr.size(obj, namespace, name)
139
+ end
140
+
141
+ def get(name, namespace: ExtAttr::USER)
142
+ ExtAttr.get(obj, namespace, name)
143
+ end
144
+
145
+ def set(name, data, namespace: ExtAttr::USER)
146
+ ExtAttr.set(obj, namespace, name, data)
147
+ end
148
+
149
+ def delete(name, namespace: ExtAttr::USER)
150
+ ExtAttr.delete(obj, namespace, name)
151
+ end
152
+ end
153
+
154
+ refine File do
155
+ def extattr
156
+ ExtAttr::Accessor[self, to_path]
157
+ end
158
+
159
+ #
160
+ # Enumeration file extattr.
161
+ #
162
+ def extattr_each(namespace: ExtAttr::USER, &block)
163
+ ExtAttr.each(self, namespace, &block)
164
+ end
165
+
166
+ #
167
+ # Enumeration file extattr.
168
+ #
169
+ def extattr_each_pair(namespace: ExtAttr::USER, &block)
170
+ ExtAttr.each_pair(self, namespace, &block)
171
+ end
172
+
173
+ #
174
+ # call-seq:
175
+ # extattr_list(namespace: ExtAttr::USER) -> array of strings
176
+ # extattr_list(namespace: ExtAttr::USER) { |name| ... } -> enumerator
177
+ #
178
+ # Get file extattr list.
179
+ #
180
+ def extattr_list(namespace: ExtAttr::USER, &block)
181
+ ExtAttr.list(self, namespace, &block)
182
+ end
183
+
184
+ #
185
+ # Get file extattr data size.
186
+ #
187
+ def extattr_size(name, namespace: ExtAttr::USER)
188
+ ExtAttr.size(self, namespace, name)
189
+ end
190
+
191
+ #
192
+ # Get file extattr data.
193
+ #
194
+ def extattr_get(name, namespace: ExtAttr::USER)
195
+ ExtAttr.get(self, namespace, name)
196
+ end
197
+
198
+ #
199
+ # Set file extattr data.
200
+ #
201
+ def extattr_set(name, value, namespace: ExtAttr::USER)
202
+ ExtAttr.set(self, namespace, name, value)
203
+ end
204
+
205
+ #
206
+ # Delete file extattr.
207
+ #
208
+ def extattr_delete(name, namespace: ExtAttr::USER)
209
+ ExtAttr.delete(self, namespace, name)
210
+ end
211
+ end
212
+
213
+ refine File.singleton_class do
214
+ def extattr(path)
215
+ ExtAttr.open(path)
216
+ end
217
+
218
+ def extattr_each(path, namespace: ExtAttr::USER, &block)
219
+ ExtAttr.each(path, namespace, &block)
220
+ end
221
+
222
+ def extattr_each!(path, namespace: ExtAttr::USER, &block)
223
+ ExtAttr.each!(path, namespace, &block)
224
+ end
225
+
226
+ def extattr_each_pair(path, namespace: ExtAttr::USER, &block)
227
+ ExtAttr.each_pair(path, namespace, &block)
228
+ end
229
+
230
+ def extattr_each_pair!(path, namespace: ExtAttr::USER, &block)
231
+ ExtAttr.each_pair!(path, namespace, &block)
232
+ end
233
+
234
+ def extattr_list(path, namespace: ExtAttr::USER, &block)
235
+ ExtAttr.list(path, namespace, &block)
236
+ end
237
+
238
+ def extattr_list!(path, namespace: ExtAttr::USER, &block)
239
+ ExtAttr.list!(path, namespace, &block)
240
+ end
241
+
242
+ def extattr_get(path, name, namespace: ExtAttr::USER)
243
+ ExtAttr.get(path, namespace, name)
244
+ end
245
+
246
+ def extattr_get!(path, name, namespace: ExtAttr::USER)
247
+ ExtAttr.get(path, namespace, name)
248
+ end
249
+
250
+ def extattr_size(path, name, namespace: ExtAttr::USER)
251
+ ExtAttr.size(path, namespace, name)
252
+ end
253
+
254
+ def extattr_size!(path, name, namespace: ExtAttr::USER)
255
+ ExtAttr.size(path, namespace, name)
256
+ end
257
+
258
+ def extattr_set(path, name, value, namespace: ExtAttr::USER)
259
+ ExtAttr.set(path, namespace, name, value)
260
+ end
261
+
262
+ def extattr_set!(path, name, value, namespace: ExtAttr::USER)
263
+ ExtAttr.set(path, namespace, name, value)
264
+ end
265
+
266
+ def extattr_delete(path, name, namespace: ExtAttr::USER)
267
+ ExtAttr.delete(path, namespace, name)
268
+ end
269
+
270
+ def extattr_delete!(path, name, namespace: ExtAttr::USER)
271
+ ExtAttr.delete(path, namespace, name)
272
+ end
273
+ end
274
+ end
@@ -0,0 +1,75 @@
1
+ #!ruby
2
+
3
+ require "test/unit"
4
+ require "fileutils"
5
+ require "tmpdir"
6
+
7
+ include FileUtils
8
+
9
+ require "extattr"
10
+
11
+ using ExtAttr
12
+
13
+ class ExtAttr::Test < Test::Unit::TestCase
14
+ WORKDIR = Dir.mktmpdir(["", ".ruby-extattr.test-work"])
15
+ FILEPATH1 = File.join(WORKDIR, "file1")
16
+ FILEPATH2 = File.join(WORKDIR, "file2")
17
+
18
+ def self.startup
19
+ @@file = File.open(FILEPATH1, "a")
20
+ end
21
+
22
+ def self.shutdown
23
+ @@file.close
24
+ @@file = nil
25
+ Dir.chdir "/" rescue nil
26
+ rmtree WORKDIR, secure: true, verbose: true #, noop: true
27
+ end
28
+
29
+ def test_fd_extattr
30
+ extdata = "abcdefg"
31
+
32
+ assert_equal([], @@file.extattr_list)
33
+ assert_nil(@@file.extattr_set("ext1", extdata))
34
+ assert_equal(["ext1"], @@file.extattr_list())
35
+ assert_equal("ext1", `lsextattr -qq user #{@@file.to_path}`.chomp) if RUBY_PLATFORM =~ /freebsd/
36
+ assert_equal(extdata, @@file.extattr_get("ext1"))
37
+ assert_equal(extdata, `getextattr -qq user ext1 #{@@file.to_path}`) if RUBY_PLATFORM =~ /freebsd/
38
+ assert_nil(@@file.extattr_delete("ext1"))
39
+ assert_equal([], @@file.extattr_list())
40
+ end
41
+
42
+ def test_extattr
43
+ extdata = "abcdefg"
44
+ File.open(FILEPATH2, "ab") {}
45
+
46
+ assert_equal([], File.extattr_list(FILEPATH2))
47
+ assert_nil(File.extattr_set(FILEPATH2, "ext1", extdata))
48
+ assert_equal(["ext1"], File.extattr_list(FILEPATH2))
49
+ assert_equal(extdata, File.extattr_get(FILEPATH2, "ext1"))
50
+ assert_nil(File.extattr_delete(FILEPATH2, "ext1"))
51
+ assert_equal([], File.extattr_list(FILEPATH2))
52
+ end
53
+
54
+ def test_ractor_extattr
55
+ # Skip this test on Ruby < 3.0
56
+ return true unless defined?(Ractor)
57
+
58
+ # Ractor is still experimental in Ruby 3.0.x — suppress warning for this test.
59
+ old_warning_status = Warning[:experimental]
60
+ Warning[:experimental] = false
61
+
62
+ extdata = "abcdefg"
63
+ File.open(FILEPATH2, "ab") {}
64
+
65
+ assert_equal([], File.extattr_list(FILEPATH2))
66
+ assert_nil(File.extattr_set(FILEPATH2, "ext1", extdata))
67
+
68
+ assert_equal(["ext1"], Ractor.new(FILEPATH2) { |path| File.extattr_list(path) }.take)
69
+ assert_equal(extdata, Ractor.new(FILEPATH2) { |path| File.extattr_get(path, "ext1") }.take)
70
+
71
+ assert_nil(File.extattr_delete(FILEPATH2, "ext1"))
72
+ assert_equal([], File.extattr_list(FILEPATH2))
73
+ Warning[:experimental] = old_warning_status
74
+ end
75
+ end
metadata CHANGED
@@ -1,66 +1,99 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: extattr
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.1'
5
- prerelease:
4
+ version: '0.4'
6
5
  platform: ruby
7
6
  authors:
8
7
  - dearblue
9
- autorequire:
8
+ autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2012-10-02 00:00:00.000000000 Z
13
- dependencies: []
14
- description: ! 'extattr is extended attribute operation library for ruby.
15
-
16
- Supported for Microsoft Windows and FreeBSD.
17
-
18
- '
19
- email: dearblue@users.sourceforge.jp
11
+ date: 2021-09-21 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rake
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: test-unit
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ description: |
42
+ "extattr" is extended file attribute manipurator for Ruby.
43
+ Supported for FreeBSD (extattr), GNU/Linux (xattr) and Microsoft Windows (NTFS Alternative Data Stream (ADS) + NTFS Extended Attributes (EA)).
44
+ email: dearblue@users.osdn.me
20
45
  executables: []
21
46
  extensions:
22
47
  - ext/extconf.rb
23
48
  extra_rdoc_files:
24
- - README.txt
25
- - LICENSE.txt
49
+ - HISTORY.ja.md
50
+ - LICENSE.md
51
+ - QUICKREF.ja.md
52
+ - README.md
53
+ - ext/extattr-extattr.h
54
+ - ext/extattr-windows.h
55
+ - ext/extattr-xattr.h
26
56
  - ext/extattr.c
57
+ - lib/extattr.rb
27
58
  files:
28
- - README.txt
29
- - LICENSE.txt
30
- - ext/extconf.rb
59
+ - HISTORY.ja.md
60
+ - LICENSE.md
61
+ - QUICKREF.ja.md
62
+ - README.md
63
+ - Rakefile
64
+ - ext/extattr-extattr.h
65
+ - ext/extattr-windows.h
66
+ - ext/extattr-xattr.h
31
67
  - ext/extattr.c
32
- - ext/extattr.bsd
33
- - ext/extattr.linux
34
- - ext/extattr.windows
35
- - rspecs/extattr.rb
36
- homepage: http://sourceforge.jp/projects/rutsubo/
68
+ - ext/extconf.rb
69
+ - gemstub.rb
70
+ - lib/extattr.rb
71
+ - test/test_extattr.rb
72
+ homepage: https://github.com/dearblue/ruby-extattr
37
73
  licenses:
38
- - 2-clause BSD License
39
- post_install_message:
74
+ - BSD-2-Clause
75
+ metadata: {}
76
+ post_install_message:
40
77
  rdoc_options:
41
- - -e
78
+ - "--charset"
42
79
  - UTF-8
43
- - -m
44
- - README.txt
80
+ - "-m"
81
+ - README.md
45
82
  require_paths:
46
83
  - lib
47
84
  required_ruby_version: !ruby/object:Gem::Requirement
48
- none: false
49
85
  requirements:
50
- - - ! '>='
86
+ - - ">="
51
87
  - !ruby/object:Gem::Version
52
- version: 1.9.3
88
+ version: '0'
53
89
  required_rubygems_version: !ruby/object:Gem::Requirement
54
- none: false
55
90
  requirements:
56
- - - ! '>='
91
+ - - ">="
57
92
  - !ruby/object:Gem::Version
58
93
  version: '0'
59
94
  requirements: []
60
- rubyforge_project:
61
- rubygems_version: 1.8.24
62
- signing_key:
63
- specification_version: 3
64
- summary: extended attribute operation library for ruby
95
+ rubygems_version: 3.2.14
96
+ signing_key:
97
+ specification_version: 4
98
+ summary: extended file attribute manipurator
65
99
  test_files: []
66
- has_rdoc: false
data/README.txt DELETED
@@ -1,53 +0,0 @@
1
- = extattr
2
-
3
- extattr is extended attribute operation library for Windows and FreeBSD.
4
-
5
- ----
6
-
7
- extattr は拡張属性を操作するライブラリで、Windows、FreeBSD に対応しています (GNU/Linux はコードを書いてみただけで、試験がまったくされていません)。
8
-
9
- サポートされる環境で、統一的なメソッドを提供します。
10
-
11
- クラスメソッドに『!』がついているものはシンボリックリンクに対する操作となります。
12
-
13
- キーワード引数の <code>namespace</code> を与えると、拡張属性の名前空間を指定できます。規定値は <code>EXTATTR_NAMESPACE_USER</code> で、ほかの値は <code>EXTATTR_NAMESPACE_SYSTEM</code> のみが指定できます (Windows 版では <code>EXTATTR_NAMESPACE_USER</code> のみが指定可能です)。
14
-
15
-
16
- == 拡張属性の属性名を取得:
17
-
18
- - File#extattr_list(namespace: File::EXTATTR_NAMESPACE_USER) -> array
19
- - File.extattr_list(path, namespace: File::EXTATTR_NAMESPACE_USER) -> array
20
- - File.extattr_list!(path, namespace: File::EXTATTR_NAMESPACE_USER) -> array
21
-
22
- == 拡張属性の要素の大きさを取得:
23
-
24
- - File#extattr_size(name, namespace: File::EXTATTR_NAMESPACE_USER) -> size
25
- - File.extattr_size(path, name, namespace: File::EXTATTR_NAMESPACE_USER) -> size
26
- - File.extattr_size!(path, name, namespace: File::EXTATTR_NAMESPACE_USER) -> size
27
-
28
- == 拡張属性の要素を取得:
29
-
30
- - File#extattr_get(name, namespace: File::EXTATTR_NAMESPACE_USER) -> data (String)
31
- - File.extattr_get(path, name, namespace: File::EXTATTR_NAMESPACE_USER) -> data (String)
32
- - File.extattr_get!(path, name, namespace: File::EXTATTR_NAMESPACE_USER) -> data (String)
33
-
34
- == 拡張属性の要素を設定:
35
-
36
- - File#extattr_set(name, data, namespace: File::EXTATTR_NAMESPACE_USER) -> nil
37
- - File.extattr_set(path, name, data, namespace: File::EXTATTR_NAMESPACE_USER) -> nil
38
- - File.extattr_set!(path, name, data, namespace: File::EXTATTR_NAMESPACE_USER) -> nil
39
-
40
- == 拡張属性の要素を削除:
41
-
42
- - File#extattr_delete(name, namespace: File::EXTATTR_NAMESPACE_USER) -> nil
43
- - File.extattr_delete(path, name, namespace: File::EXTATTR_NAMESPACE_USER) -> nil
44
- - File.extattr_delete!(path, name, namespace: File::EXTATTR_NAMESPACE_USER) -> nil
45
-
46
-
47
- == Microsoft Windows における諸注意
48
-
49
- Windows 2000 以降でのみ動作します。Windows 9X シリーズでは <code>require "extattr"</code> の段階で例外が発生するでしょう。
50
-
51
- リパースポイント (ジャンクションやシンボリックリンク) に対する ADS は要素の取得や設定、削除は出来ません。必ずリンク先に対する操作となります。
52
-
53
- 128 KiB を超える ADS は取得も設定も出来ません。これは『拡張属性』と捉えた場合、巨大なデータを扱えるべきではないという考えによるためです (本当のところは FreeBSD の拡張属性が最大 64KiB 弱であることが由来です)。巨大な ADS を扱いたい場合は、File.open で自由に読み書きできます (これは ruby に限ったことではなく、Windows による仕様です)。この場合の与えるファイル名は、path + ":" + name という形になります。