enola 0.5.0 → 0.5.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/CHANGELOG.md +20 -0
- data/lib/enola/probe.rb +8 -2
- data/lib/enola/resolver.rb +19 -2
- data/lib/enola/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 35717854ffb165b2d79fe06be0998d847a25a0ce10a2907ab155a39fd3119a75
|
|
4
|
+
data.tar.gz: 8940517eabb47871b5321fd23ed4f369cc7f31486f2f486096fdf78cd8e6cbcc
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: cd181d1618ba05ebea4a77136ed6fc5d3afd197978c955576e1c8554d374b7558c3b4b0bd12b87e14f4c88642ff55faa6a5e8ef35bf12e33963fe7345418a778
|
|
7
|
+
data.tar.gz: 89206de715d8b08d9b7138cf4400df93b9385cf8b45c94bb08aa7de7b90f01267398e4d5da1f1ed3a4e87cd58ad33cf1e5f7492a6480ccee647a9129806ec142
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,23 @@
|
|
|
1
|
+
## enola 0.5.1 (2026-08-23)
|
|
2
|
+
|
|
3
|
+
The resolver no longer probes its own binstub. It read a candidate's first 512
|
|
4
|
+
bytes looking for the marker RubyGems writes, and a real binstub carries a
|
|
5
|
+
`/bin/sh` + `ruby -x` preamble holding the interpreter's absolute path, which puts
|
|
6
|
+
that marker around byte 580 — outside the window. So the guard missed every
|
|
7
|
+
RubyGems-generated binstub, the wrapper ran itself, and running itself has no
|
|
8
|
+
bottom: `enola --version` on a cold cache spawned Ruby processes until it was
|
|
9
|
+
killed. The whole file is read now, capped at 64 KiB so a released binary is never
|
|
10
|
+
slurped only to be rejected, and `Gem.bin_path` is recognised beside
|
|
11
|
+
`Gem.activate_bin_path`. A probe also marks its child's environment, and a resolver
|
|
12
|
+
that sees the marker declines to look at PATH at all, so the recursion is bounded
|
|
13
|
+
by construction rather than by how well a heuristic reads a file.
|
|
14
|
+
|
|
15
|
+
The marker is written where it is spawned: every probe passes it into the child,
|
|
16
|
+
so a wrapper reached under another name leaves PATH alone instead of probing in
|
|
17
|
+
turn. That bound is what covers the wrappers the content check cannot see, a
|
|
18
|
+
version manager's shim among them, which carries none of the markers a binstub
|
|
19
|
+
does. Reported and fixed by dejo1307 in #1.
|
|
20
|
+
|
|
1
21
|
## munola 0.4.4.2 and munola-rb 0.4.4.2 (2026-08-23)
|
|
2
22
|
|
|
3
23
|
munola follows the channel it drives. Its binary is now cut from the stable
|
data/lib/enola/probe.rb
CHANGED
|
@@ -6,12 +6,18 @@ module Enola
|
|
|
6
6
|
class Probe
|
|
7
7
|
SURFACES = %w[constraints providers check plan hook].freeze
|
|
8
8
|
|
|
9
|
+
# A probed binary may be this wrapper wearing another name. The marker
|
|
10
|
+
# travels into the child, where the resolver reads it and leaves PATH
|
|
11
|
+
# alone, so a probe cannot start another one.
|
|
12
|
+
PROBE_ENV = "ENOLA_RESOLVER_PROBE"
|
|
13
|
+
CHILD_ENV = {PROBE_ENV => "1"}.freeze
|
|
14
|
+
|
|
9
15
|
def initialize(binary)
|
|
10
16
|
@binary = binary
|
|
11
17
|
end
|
|
12
18
|
|
|
13
19
|
def version
|
|
14
|
-
out, status = Open3.capture2e(@binary, "--version")
|
|
20
|
+
out, status = Open3.capture2e(CHILD_ENV, @binary, "--version")
|
|
15
21
|
return nil unless status.success?
|
|
16
22
|
|
|
17
23
|
out[/\d+\.\d+\.\d+(?:[.-][\w.]+)?/]
|
|
@@ -23,7 +29,7 @@ module Enola
|
|
|
23
29
|
# for --help); one it lacks is refused by the top-level dispatch by name.
|
|
24
30
|
def capabilities
|
|
25
31
|
SURFACES.to_h do |surface|
|
|
26
|
-
out, = Open3.capture2e(@binary, surface, "--help")
|
|
32
|
+
out, = Open3.capture2e(CHILD_ENV, @binary, surface, "--help")
|
|
27
33
|
[surface.to_sym, !out.include?("unknown command \"#{surface}\"")]
|
|
28
34
|
rescue SystemCallError
|
|
29
35
|
[surface.to_sym, false]
|
data/lib/enola/resolver.rb
CHANGED
|
@@ -25,9 +25,19 @@ module Enola
|
|
|
25
25
|
|
|
26
26
|
EXECUTABLE = File.expand_path("../../exe/enola", __dir__)
|
|
27
27
|
|
|
28
|
+
# A binstub is a script; the released binary is megabytes. The cap keeps the
|
|
29
|
+
# whole-file read cheap and means a real binary is never slurped to be rejected.
|
|
30
|
+
MAX_SCRIPT_BYTES = 64 * 1024
|
|
31
|
+
|
|
28
32
|
private
|
|
29
33
|
|
|
30
34
|
def matching_path_binary
|
|
35
|
+
# A probe runs the candidate, and the candidate may be this wrapper wearing
|
|
36
|
+
# another name. The marker travels into that child, and a resolver that finds
|
|
37
|
+
# it declines to look at PATH — so the recursion is bounded by construction
|
|
38
|
+
# rather than by how well the check below reads a file.
|
|
39
|
+
return [nil, nil] if ENV[Probe::PROBE_ENV]
|
|
40
|
+
|
|
31
41
|
candidate = @path.split(File::PATH_SEPARATOR).map { |dir| File.join(dir, "enola") }
|
|
32
42
|
.find { |bin| File.executable?(bin) && !wrapper?(bin) }
|
|
33
43
|
return [nil, nil] unless candidate
|
|
@@ -39,11 +49,18 @@ module Enola
|
|
|
39
49
|
# Bundler puts this gem's own exe on PATH, and a rubygems binstub for the
|
|
40
50
|
# gem looks like a binary too; probing either would run the wrapper inside
|
|
41
51
|
# itself without end.
|
|
52
|
+
#
|
|
53
|
+
# The whole file is read, not a fixed head. RubyGems writes a /bin/sh + `ruby -x`
|
|
54
|
+
# polyglot preamble carrying the interpreter's absolute path, so the marker sits
|
|
55
|
+
# ~580 bytes in — past the 512 this used to read, which made the guard miss every
|
|
56
|
+
# real binstub and the wrapper probe itself without end.
|
|
42
57
|
def wrapper?(bin)
|
|
43
58
|
return true if File.realpath(bin) == File.realpath(EXECUTABLE)
|
|
59
|
+
return false if File.size(bin) > MAX_SCRIPT_BYTES
|
|
44
60
|
|
|
45
|
-
|
|
46
|
-
|
|
61
|
+
body = File.binread(bin)
|
|
62
|
+
body.include?("Gem.activate_bin_path") || body.include?("Gem.bin_path") ||
|
|
63
|
+
body.include?('require "enola"')
|
|
47
64
|
rescue SystemCallError
|
|
48
65
|
true
|
|
49
66
|
end
|
data/lib/enola/version.rb
CHANGED