Fix/windows path prefix stripping#2833
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request enhances the application's compatibility with Windows environments by addressing how paths are handled, particularly when interacting with tools like Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughThe changes address Windows path handling by disabling MSYS2's automatic path conversion in the wrapper script and adding comprehensive Windows-specific unit tests for path entry name normalization in the CLI. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
📝 Coding Plan
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Code Review
This pull request addresses an issue with Windows path prefix stripping by setting appropriate MSYS2 environment variables in the wrapper script. It also introduces a comprehensive suite of tests to validate various Windows path formats. My review focuses on improving the maintainability of the new test code and simplifying a formatting change.
There was a problem hiding this comment.
🧹 Nitpick comments (1)
cli/src/command/list.rs (1)
828-832: Prefer a singlewriteln!call for one logical record.At
Line 828andLine 832, this now emits each row via two writes. It works, but onewriteln!is a bit cleaner and reduces partial-write risk between content and newline.Suggested simplification
- write!( - out, - "{perm} {nlink} {uname:<u_width$} {gname}{size_str:>size_width$} {mtime} {name}" - )?; - writeln!(out)?; + writeln!( + out, + "{perm} {nlink} {uname:<u_width$} {gname}{size_str:>size_width$} {mtime} {name}" + )?;🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@cli/src/command/list.rs` around lines 828 - 832, Combine the two separate writes into a single logical write: replace the pair of write!(out, "{perm} {nlink} {uname:<u_width$} {gname}{size_str:>size_width$} {mtime} {name}")?; writeln!(out)?; with one writeln!(...) call that emits the same formatted row and newline in one shot, referencing the same variables (out, perm, nlink, uname, u_width, gname, size_str, size_width, mtime, name) so the output for each record is atomic and avoids partial-write risk.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@cli/src/command/list.rs`:
- Around line 828-832: Combine the two separate writes into a single logical
write: replace the pair of write!(out, "{perm} {nlink} {uname:<u_width$}
{gname}{size_str:>size_width$} {mtime} {name}")?; writeln!(out)?; with one
writeln!(...) call that emits the same formatted row and newline in one shot,
referencing the same variables (out, perm, nlink, uname, u_width, gname,
size_str, size_width, mtime, name) so the output for each record is atomic and
avoids partial-write risk.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 8fcf0b59-334a-46eb-9e15-ff9ba33bac69
📒 Files selected for processing (3)
.github/scripts/pnatar-wrapper.shcli/src/command/core/path.rscli/src/command/list.rs
Disable MSYS2 automatic path conversion in the pnatar wrapper to prevent mangling of Windows absolute paths (\\?\, \\.\, drive letters) passed by bsdtar's test_windows. Add cfg(windows) tests covering all 8 path prefix types from test_windows.c.
af3d1ea to
2d0bed7
Compare
Summary by CodeRabbit
Bug Fixes
Tests