hotcell-core 0.3.0 → 0.3.1
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.
- checksums.yaml +4 -4
- data/lib/hot_cell/core/version.rb +1 -1
- data/lib/hot_cell/descriptors.rb +24 -2
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 214b910102e639e8d5e5d7f5f145046c53d7fe45146a661054097731303d12db
|
|
4
|
+
data.tar.gz: 02db6536062e350ae67eefae22b50d83d8aa629b24487fdb01339e97308c045e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e4be2dd15734d9b3958ee98408866b9302f0a854a6ad16d652954e42f7f986a53286034b2af38eef9f09dc2ba2cc348d20b9707cf07c0e473a74a5742c2f9076
|
|
7
|
+
data.tar.gz: 6251a4224a51c24ce0b8bc245335973e2ccc33670594e41bb374242e8d70a46d0226247225415d61945ec1c2220db0ce6bd837779c9477e22b5529582a43f112
|
data/lib/hot_cell/descriptors.rb
CHANGED
|
@@ -39,8 +39,30 @@ module HotCell
|
|
|
39
39
|
# readable at any size, where staging it would be a write and RLIMIT_FSIZE bounds writes. Reopening
|
|
40
40
|
# `/dev/fd/N` gives a fresh file description at offset zero, so a read here does not disturb the
|
|
41
41
|
# descriptor the supervisor still holds.
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
#
|
|
43
|
+
# Darwin cannot keep that promise, so it keeps the behavior instead. `/dev/fd` has no procfs behind it
|
|
44
|
+
# there, and opening the path is dup(2): one shared offset, so what one reader consumes the next open
|
|
45
|
+
# skips. libvips sniffs a format by opening the path once per candidate loader, so the second loader
|
|
46
|
+
# reads past the magic bytes and a readable file is called unreadable.
|
|
47
|
+
#
|
|
48
|
+
# Darwin answers with the filename behind the descriptor, which a by-name open does start at zero. That
|
|
49
|
+
# hands a tool a path the cold side chose, which the rest of this class exists to prevent — a corner cut
|
|
50
|
+
# on purpose. Darwin is a development platform and nothing else: no container, no isolation, the cell
|
|
51
|
+
# running as the caller on the caller's own filesystem, where hiding a path it could already reach
|
|
52
|
+
# protected nothing. What has to match across platforms is what an operation sees — a path that reads
|
|
53
|
+
# from the first byte however many times it is opened — not how that is arrived at.
|
|
54
|
+
if RUBY_PLATFORM.include?("darwin")
|
|
55
|
+
F_GETPATH = 50 # sys/fcntl.h; Ruby's Fcntl module does not carry it
|
|
56
|
+
|
|
57
|
+
def fd_path
|
|
58
|
+
buffer = "\0" * 1024 # F_GETPATH writes the path into a buffer the caller supplies, MAXPATHLEN wide
|
|
59
|
+
io.fcntl F_GETPATH, buffer
|
|
60
|
+
buffer[/\A[^\0]+/]
|
|
61
|
+
end
|
|
62
|
+
else
|
|
63
|
+
def fd_path
|
|
64
|
+
"/dev/fd/#{io.fileno}"
|
|
65
|
+
end
|
|
44
66
|
end
|
|
45
67
|
|
|
46
68
|
def close
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: hotcell-core
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.3.
|
|
4
|
+
version: 0.3.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Mike Dalessio
|
|
@@ -43,8 +43,8 @@ licenses:
|
|
|
43
43
|
- MIT
|
|
44
44
|
metadata:
|
|
45
45
|
homepage_uri: https://github.com/basecamp/hotcell
|
|
46
|
-
source_code_uri: https://github.com/basecamp/hotcell/tree/v0.3.
|
|
47
|
-
changelog_uri: https://github.com/basecamp/hotcell/blob/v0.3.
|
|
46
|
+
source_code_uri: https://github.com/basecamp/hotcell/tree/v0.3.1/hotcell-core
|
|
47
|
+
changelog_uri: https://github.com/basecamp/hotcell/blob/v0.3.1/CHANGELOG.md
|
|
48
48
|
bug_tracker_uri: https://github.com/basecamp/hotcell/issues
|
|
49
49
|
rubygems_mfa_required: 'true'
|
|
50
50
|
rdoc_options: []
|