s390x: cleanups#1756
Conversation
Write::write() is not guaranteed to write all bytes; use write_all() to avoid silent truncation of the appended initrd.
There was a problem hiding this comment.
Code Review
This pull request introduces several s390x-specific improvements, including fixing a potential silent truncation issue by switching from write() to write_all() in initrd generation, improving UTF-8 validation when handling device paths, and refining the regular expressions used to parse lszdev bus IDs alongside adding corresponding unit tests. The review feedback suggests extracting the duplicated UTF-8 validation of dest_path into a local variable in dasd.rs, and trimming inputs and anchoring the regular expressions in zipl.rs to prevent matching malformed IDs with trailing characters.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
- Use into_iter() instead of iter() when mapping owned Vec<String> to Vec<PathBuf> — moves each String into PathBuf rather than cloning - Replace to_string_lossy().to_string() with to_str().with_context() to avoid double allocation and silent name mangling
- Escape literal dots, tighten devno to 1-4 hex digits, use [[:xdigit:]] consistently, switch captures_iter().next() to captures() - Add tests for parse_lszdev_eckd and parse_lszdev_zfcp
5b0c925 to
9cb4f3c
Compare
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces several improvements and bug fixes for s390x, including switching from write() to write_all() in initrd generation to prevent silent truncation, refining the regex patterns for parsing lszdev bus IDs (specifically escaping dots and anchoring the patterns), and adding comprehensive unit tests for these parsers. Additionally, it refactors some path handling in dasd.rs to use UTF-8 string slices instead of lossy conversions. The review feedback suggests replacing the lazy_static! macro with the standard library's std::sync::LazyLock in the regex definitions to simplify the code and reduce external dependencies.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
See individual commits: