Vendored gems break the usual Dockerfile gem layer (`COPY Gemfile Gemfile.lock ./` then `bundle install`), and neither the scan output nor the Ruby docs say to copy `.socket/vendor/`
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 62/100
- Loại issue
- Tài liệu
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Lĩnh vực
- devtools, documentation
Hướng nghiên cứu
Bắt đầu với các mục Ruby trong docs/ecosystems.md, gồm "Ruby gems: gems vendored mode refuses" và "Ruby gems: native extensions", rồi so sánh với mục Bun đã cảnh báo về việc sao chép .socket/vendor/. Sau đó mở đầu ra "Next steps" của chế độ vendored trong crates/socket-patch-cli/src/commands/vendor.rs, khoảng dòng 4964. Hoàn thành khi tài liệu Ruby có cùng cảnh báo về Dockerfile và đầu ra của chế độ vendored nhắc đến cảnh báo đó, hoặc issue giải thích vì sao không nhắc.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
[agent] Found by the scheduled Bundler (RubyGems) bug-hunt routine (ledger #316).
Summary
After scan --mode vendored (or vendor) patches a gem, the usual Dockerfile gem layer no longer builds. That layer copies only Gemfile and Gemfile.lock and runs bundle install before the rest of the application is copied; it is what the Dockerfile from rails new does, and what most Ruby images use to cache the gem layer. The vendored Gemfile now points at .socket/vendor/gem/<uuid>/<gem>, which is not in the image at that step, so Bundler stops with "The path … does not exist".
Nothing tells the user. The scan's next steps say only to commit .socket/vendor/ and the lockfiles, and the Ruby sections of docs/ecosystems.md don't mention Docker. The Bun section of the same file does document this exact case ("a build that copies only package.json and bun.lock before bun install (a common Dockerfile layer) fails …: copy .socket/vendor/ … in the same step").
Impact
A project that built its image cleanly before vendoring fails docker build afterwards, in CI or at deploy time, although the user followed every printed step. The fix is one line in the Dockerfile, but the user has to work it out from Bundler's error. Hosted and agent mode are not affected.
Repro
$M is the flags that point at a patch service with a patch for rack 2.2.8 (the repo's stand-in, tests/nokogiri/patch_service.rb, was used here). The second half does what the Dockerfile lines below do, without needing Docker.
# from the Dockerfile `rails new` generates
ENV BUNDLE_DEPLOYMENT="1" BUNDLE_PATH="/usr/local/bundle"
COPY Gemfile Gemfile.lock ./
RUN bundle install
COPY . .
mkdir app && cd app
printf 'source "https://rubygems.org"\n\ngem "rack", "2.2.8"\ngem "rake", "13.2.1"\n' > Gemfile
bundle config set --local path vendor/bundle && bundle install
socket-patch scan --mode vendored $M # exit 0, "Vendored 2 packages."
# the gem layer of the image: the two files, nothing else
mkdir ../image && cp Gemfile Gemfile.lock ../image/ && cd ../image
BUNDLE_DEPLOYMENT=1 BUNDLE_PATH=$PWD/bundle bundle install
Actual
The scan prints:
Vendored 2 packages.
Next steps:
1. Commit .socket/vendor/ and the updated lockfiles to make the patches portable.
2. Reinstall from the updated lockfile, then run `socket-patch vex` to verify the installed patches.
and the gem layer fails (exit 13):
The path
`/…/image/.socket/vendor/gem/00000001-1111-4222-8333-000000000001/rack-2.2.8`
does not exist.
Expected
The user should learn about this before the image build fails. Either or both of:
- the Ruby sections of
docs/ecosystems.mdsay, as the Bun section does, that a build which copies onlyGemfileandGemfile.lockbeforebundle installmust copy.socket/vendor/in the same step (COPY Gemfile Gemfile.lock ./plusCOPY .socket/vendor ./.socket/vendor), or use hosted mode, which needs only the two files; - the vendored run says so when the project has a
Dockerfilethat copies the Gemfile pair on its own, or adds a line to its next steps for gems.
With COPY .socket/vendor ./.socket/vendor added before bundle install, the layer builds and loads the patched gems (the deployment-clone cells of the ledger cover that).
Versions
| socket-patch | Bundler | Ruby | Result |
|---|---|---|---|
main cfc870f |
4.1.1 | 3.3.6 | the gem layer fails |
main cfc870f |
2.6.9 | 3.3.6 | the gem layer fails |
Vendored gems have always been path: gems, so this is not a regression. It does not depend on the operating system.
Suspect code
Documentation and messaging rather than logic: the Ruby vendored text in docs/ecosystems.md (the "Ruby gems: gems vendored mode refuses" and "Ruby gems: native extensions" sections are the only places that describe vendored gems), and the vendored "Next steps" lines the scan prints (crates/socket-patch-cli/src/commands/vendor.rs:4964).
Generated by Claude Code
- Ngôn ngữ chính
- Rust
- Star
- 9
- Fork
- 2
- Merge trung bình
- 1 ngày 11 giờ
- Pull request đã merge (30 ngày)
- 282
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của SocketDev/socket-patch
-
The unit test for "every jar copy must be patched" passes when VEX checks only the first copyĐang mởagent:triaged arch-audit priority:p3 refactor
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
SocketDev/socket-patch#2319 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
agent:triaged arch-audit bug priority:p2
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
SocketDev/socket-patch#2306 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
agent:triaged arch-audit bug priority:p3
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
SocketDev/socket-patch#2296 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
agent:needs-human agent:triaged ci-janitor priority:p1
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
SocketDev/socket-patch#2270 · 4 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
agent:triaged arch-audit bug priority:p1
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
SocketDev/socket-patch#2259 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của SocketDev/socket-patch
Issue tương tự
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 68/100
521xueweihan/HelloGitHub#4598 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
compiler-explorer/compiler-explorer#9710 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
obi1kenobi/cargo-semver-checks#1842 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
agentic-workflows
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 86/100