GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||
GeezerVison is showing github.com — Fix hosted gem block mixing CRLF Gemfile endings (#1831) by mikolalysenko · Pull Request #1841 · SocketDev/socket-patch Conversation
|
| Issue facet | Test | Without fix | With fix |
|---|---|---|---|
#1831 single-line decl, decl with options + comment, gem(…), decl inside a user source … do block, unterminated last line, lone trailing CR, transitive append (terminated and not), plus a re-run no-op for each |
core patch::redirect::tests::gemfile_source_block_keeps_crlf_line_endings |
FAIL: mixed line endings: "…\r\nsource \"https://patch.test/…\" do\n gem …\nend\n" |
pass |
| LF Gemfile stays LF; an LF line in a CRLF file keeps its LF | core gemfile_source_block_keeps_lf_line_endings |
pass (guard) | pass |
#1831 real bundler: CRLF Gemfile (both the issue's Driver::ScanVex and Driver::ScanVexSourceBlock shapes) stays CRLF after hosted scan, converging bundle install passes, re-scan is byte-identical, rollback gives back a CRLF Gemfile that declares the gem |
cli e2e_redirect_gem_build::gem_hosted_redirect_keeps_a_crlf_gemfile_crlf (--ignored, bundler 4.0.18 / Ruby 3.3.6 locally; runs in the gem e2e CI legs) |
FAIL: crlf-gemfile: the redirected Gemfile mixes line endings: "source \"http://127.0.0.1:…/upstream\"\r\nsource \"…/patch-registry/gem/…\" do\n gem \"vuln-gem\", \"1.0.0\"\nend\n" |
pass |
One existing test changed its expectation: gemfile_single_line_declaration_lookalikes_still_rewrite has a CRLF declaration in an LF file (gem "vuln-gem", require: false\r). It pinned the old LF block and now expects that line's CRLF. That is the intended rule: the block takes the ending of the line it replaces.
Commands run locally:
cargo fmt --all -- --check: cleancargo clippy --workspace --all-features -- -D warnings: cleancargo test -p socket-patch-core --lib: 6992 passed, 4 failed. All 4 are the known permission-denial tests that can't fail a write as root in this sandbox (copy_tree::relax_loop_must_not_traverse_symlinked_root, vlt_heal::an_unremovable_hidden_lock_keeps_every_store_entry, pypi_poetry::wire_write_failure_…, pypi_requirements::wire_failure_rolls_back_…). None touch gem code.cargo test -p socket-patch-cli --all-features --test e2e_redirect_gem_build --test e2e_vendor_gem_build (--ignored): 38 + 11 passed. Without --ignored: 21 + 35 passed.cargo test --workspace --all-features: the sandbox ran out of disk while linking the CLI test binaries. CI is the full-suite gate.source … do block with LF endings into a CRLF Gemfile, leaving it with mixed line endings #1831 single-line declaration, CRLF Gemfile with LF or CRLF lock: gemfile_source_block_keeps_crlf_line_endings, gem_hosted_redirect_keeps_a_crlf_gemfile_crlf (crlf-gemfile)source … do block with LF endings into a CRLF Gemfile, leaving it with mixed line endings #1831 declaration inside a user source … do block: same unit test, and e2e (crlf-gemfile-source-block)source … do block with LF endings into a CRLF Gemfile, leaving it with mixed line endings #1831 append arm (transitive gem): gemfile_source_block_keeps_crlf_line_endings (puma → rails cases)source … do block with LF endings into a CRLF Gemfile, leaving it with mixed line endings #1831 converging install, re-scan no-op, rollback in CRLF: gem_hosted_redirect_keeps_a_crlf_gemfile_crlfFixed:
FileEdit.new left out the CR that was actually written. It now records the exact spliced text.LineEndings::of instead of a hand-rolled counter.Not changed:
gem_line_re itself instead of stripping it after the match. That is equivalent, and keeping the regex unchanged leaves the swallowed-whitespace behaviour that rollback depends on (Gem hosted rollback / remove turn a redirected transitive gem into a top-level exact pin, because the restore looks for a blank line the rewriter never writes #457) untouched.https://claude.ai/code/session_011f9aeRvMuTRkgqjmDvPu3j
Generated by Claude Code
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Assisted-by: Claude Code:claude-opus-5-5
A hosted scan or get over a CRLF Gemfile (a Windows checkout, or core.autocrlf=true) wrote the Socket `source ... do` block with bare LF endings, so the committed Gemfile ended up with mixed line endings and churned under editors and .gitattributes normalization. The rewritten block now takes the ending of the gem line it replaces (the file's ending for an unterminated last line), and the block appended for a transitive gem takes the file's ending. This matches what vendored mode does since #1822. Fixes #1831 Assisted-by: Claude Code:claude-opus-5-5
Rollback restored a hosted gem declaration with CRLF whenever the Gemfile held any CRLF line. It now takes the ending of the Socket block it replaces, which the redirect writes in the ending of the original line, so a mixed-ending Gemfile round-trips. A gem line that ends in a lone CR at end of file no longer leaves a stray CR, and the recorded edit now shows exactly what was written. Assisted-by: Claude Code:claude-opus-5-5
Assisted-by: Claude Code:claude-opus-5-5
|
BugBot review Generated by Claude Code |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 210c955. Configure here.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Burn-down agent: labeled Ready for review at
Generated by Claude Code |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Final review brief (
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
[agent] Reviewed 210c955b3813d9b5c0d4a3916b0a9c66e3a819ea. Checked CRLF in-place/appended Gemfile blocks and restore line-ending handling. No major correctness issues found. Validation: source and regression-test review plus the available exact-head CI checks; no local test pass is claimed.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
Hosted gem redirect writes the Socketsource … do block with LF endings into a CRLF Gemfile, leaving it with mixed line endings
There was an error while loading. Please reload this page.