fix: armbian-resize-filesystem diskdevname fallback for /dev/sda* devices#9595
Conversation
…ices The sed fallback for extracting disk device names used `sed "s/p.*//"`, which only works for devices with a "p" partition separator (mmcblk0p2, nvme0n1p1). For /dev/sda2, there is no "p" so the regex matches nothing, leaving "sda2" instead of "sda". Replace with `sed -E 's/p?[0-9]+$//'` which handles both conventions: - mmcblk0p2 -> mmcblk0 (strips "p2") - nvme0n1p1 -> nvme0n1 (strips "p1") - sda2 -> sda (strips "2") - vda3 -> vda (strips "3") Fixes armbian#9593 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughA single-line refinement to the partition name extraction fallback logic in the resize-filesystem script. The Changes
Possibly related issues
Poem
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
Hey @mvanhorn! 👋Thanks for submitting your first pull request to the Armbian project — we're excited to have you contributing! 🧡 If you'd like to stay informed about project updates or collaborate more closely with the team, Also, don’t forget to ⭐ star the repo if you haven’t already — and welcome aboard! 🚀 |
iav
left a comment
There was a problem hiding this comment.
LGTM. Regex p?[0-9]+$ correctly covers both naming cases: mmcblk*p*N/nvme*n*p*N (p-separator) and sda*N/vda*N (without separator). I checked edge cases: multi-digit indices (p12), loop/md devices, and the parttype == part check for l.21, which cuts off irrelevant inputs before reaching sed.
|
Thanks @iav - good to have the edge cases ( |
|
✅ This PR has been reviewed and approved — all set for merge! |
|
Thanks for merging, @igorpecovnik! |
Summary
Fixes the sed fallback regex in
armbian-resize-filesystemthat incorrectly handles/dev/sda*style device names.Fixes #9593
Problem
The fallback path on line 28 uses
sed "s/p.*//"to strip the partition suffix from device names. This works for devices using a "p" separator (mmcblk0p2->mmcblk0,nvme0n1p1->nvme0n1) but fails for SCSI/SATA/virtio devices (sda2stayssda2because there is no "p").Fix
Replace with
sed -E 's/p?[0-9]+$//'which strips an optional "p" followed by trailing digits:mmcblk0p2mmcblk0mmcblk0nvme0n1p1nvme0n1nvme0n1sda2sda2(wrong)sdavda3vda3(wrong)vdaThis contribution was developed with AI assistance (Claude Code).
Summary by CodeRabbit