motd/20-ip-info: align (LAN)/(WAN) labels across IPv4 + IPv6 rows#9728
motd/20-ip-info: align (LAN)/(WAN) labels across IPv4 + IPv6 rows#9728igorpecovnik merged 1 commit intomainfrom
Conversation
|
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)
📝 WalkthroughWalkthroughUpdates only the Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~18 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 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 |
The IPv4 row used a 14-char prefix (` IPv4:` + 8 trailing spaces);
the IPv6 row used 15 (` IPv6:` + 9 trailing spaces). The extra
space on v6 was an attempt to make the v6 address column line up
with the v4 address column when v4 had a `(LAN)` label and v6
didn't (v6's LAN appendix had no label at all, just the bare
address). Worked when v4 had `(LAN)` and v6 had something — broke
the moment LAN got dropped against WAN by the dedup at lines
76-81 and only the `(WAN)` half remained.
Net visible bug (addresses are RFC 5737 / RFC 3849 examples):
IPv4: (WAN) 192.0.2.42
IPv6: (WAN) 2001:db8::42
^ shifted by one column
Fix:
- Use the same 13-char prefix for both rows (IPv4: / IPv6: + 7
padding, no trailing space).
- Both `(LAN)` and `(WAN)` appendices start with a single
leading space — the label always sits at the same column
regardless of which (or both) are present.
- Add a `(LAN)` label to v6 too; the asymmetry was the original
reason the spacing was offset, and removing it lets v4 and v6
structurally mirror each other.
- Drop the trailing space the appendices used to carry — pure
EOL whitespace, never visible.
Verified across all four cases (LAN+WAN / LAN only / WAN only /
nothing): `(LAN)` and `(WAN)` always align column-for-column on
both rows.
5a19109 to
fbf0d4b
Compare
Summary
WAN-only motd rows (the common case on a server with only a public address, where the LAN entry gets deduplicated against WAN by lines 76-81) misalign the
(WAN)label across the IPv4 and IPv6 rows by one column (addresses below are RFC 5737 / RFC 3849 documentation examples):Two underlying causes:
(LAN)label at all — just the bare address — so the extra space was an attempt to align v6's address column with v4's address-with-(LAN)-label column. Worked when both rows had a LAN portion; broke as soon as LAN got dropped.Change
(LAN)and(WAN)appendices start with a single leading space — the label sits at the same column regardless of which (or both) are present.(LAN)label to the IPv6 row too; the asymmetry was what forced the per-row spacing offset, and mirroring the v4 structure removes the underlying cause.Test plan
Verified across all four cases by stubbing the helpers and exercising
print_ip_linesdirectly:(LAN)and(WAN)align column-for-column on both rows in every case.Summary by CodeRabbit
Bug Fixes
Style