From 5d6ccaa3ba35c67a4d78c32a21bbdfa7b55b04b6 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Tue, 14 Apr 2026 22:50:51 +0200 Subject: [PATCH] ls: decouple ACL-marker separator from link-count width (#11790) The `+`/`.` ACL / security-context marker shares a column with the space that separates permissions from the link count. Previously that separator was implemented by inflating `padding.link_count` by one when any listed entry had an alt-access marker, conflating two unrelated columns. Emit the separator space explicitly between the marker character and the link-count field instead. `padding.link_count` now reflects only the width of the link-count digits. No user-visible output change. --- src/uu/ls/src/display.rs | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/uu/ls/src/display.rs b/src/uu/ls/src/display.rs index a0b0b2eeb8f..dbb716dec57 100644 --- a/src/uu/ls/src/display.rs +++ b/src/uu/ls/src/display.rs @@ -907,10 +907,16 @@ fn display_item_long( state.display_buf.push(b' '); } - state.display_buf.extend_pad_left( - &display_symlink_count(md), - padding.link_count + usize::from(padding.has_alt_access), - ); + // When any listed item carries an ACL or security-context marker, + // emit an extra separator space so the link-count column starts at + // a stable position regardless of this row's marker character. + if padding.has_alt_access { + state.display_buf.push(b' '); + } + + state + .display_buf + .extend_pad_left(&display_symlink_count(md), padding.link_count); if config.long.owner { state.display_buf.push(b' '); @@ -1061,10 +1067,10 @@ fn display_item_long( state.display_buf.push(b'.'); } state.display_buf.push(b' '); - state.display_buf.extend_pad_left( - "?", - padding.link_count + usize::from(padding.has_alt_access), - ); + if padding.has_alt_access { + state.display_buf.push(b' '); + } + state.display_buf.extend_pad_left("?", padding.link_count); if config.long.owner { state.display_buf.push(b' ');