File tree Expand file tree Collapse file tree 2 files changed +36
-4
lines changed
Expand file tree Collapse file tree 2 files changed +36
-4
lines changed Original file line number Diff line number Diff line change @@ -2968,8 +2968,10 @@ fn display_item_long(
29682968 output_display. extend ( b"." ) ;
29692969 } else if is_acl_set {
29702970 output_display. extend ( b"+" ) ;
2971+ } else {
2972+ output_display. extend ( b" " ) ;
29712973 }
2972- output_display . extend ( b" " ) ;
2974+
29732975 output_display. extend_pad_left ( & display_symlink_count ( md) , padding. link_count ) ;
29742976
29752977 if config. long . owner {
@@ -3626,6 +3628,19 @@ fn calculate_padding_collection(
36263628 if config. context {
36273629 padding_collections. context = context_len. max ( padding_collections. context ) ;
36283630 }
3631+
3632+ // correctly align columns when some files have capabilities/ACLs and others do not
3633+ {
3634+ #[ cfg( any( not( unix) , target_os = "android" , target_os = "macos" ) ) ]
3635+ // TODO: See how Mac should work here
3636+ let is_acl_set = false ;
3637+ #[ cfg( all( unix, not( any( target_os = "android" , target_os = "macos" ) ) ) ) ]
3638+ let is_acl_set = has_acl ( item. display_name ( ) ) ;
3639+ if context_len > 1 || is_acl_set {
3640+ padding_collections. link_count += 1 ;
3641+ }
3642+ }
3643+
36293644 if items. len ( ) == 1usize {
36303645 padding_collections. size = 0usize ;
36313646 padding_collections. major = 0usize ;
Original file line number Diff line number Diff line change @@ -6332,7 +6332,9 @@ fn test_unknown_format_specifier() {
63326332fn test_acl_display_symlink ( ) {
63336333 use std:: process:: Command ;
63346334
6335- let ( at, mut ucmd) = at_and_ucmd ! ( ) ;
6335+ let scene = TestScenario :: new ( util_name ! ( ) ) ;
6336+ let at = & scene. fixtures ;
6337+
63366338 let dir_name = "dir" ;
63376339 let link_name = "link" ;
63386340 at. mkdir ( dir_name) ;
@@ -6357,11 +6359,26 @@ fn test_acl_display_symlink() {
63576359
63586360 at. symlink_dir ( dir_name, link_name) ;
63596361
6360- let re_with_acl = Regex :: new ( r"[a-z-]*\+ .*link" ) . unwrap ( ) ;
6361- ucmd. arg ( "-lLd" )
6362+ let re_with_acl = Regex :: new ( r"[a-z-]*\+\s\d+\s.*link" ) . unwrap ( ) ;
6363+
6364+ scene
6365+ . ucmd ( )
6366+ . arg ( "-lLd" )
63626367 . arg ( link_name)
63636368 . succeeds ( )
63646369 . stdout_matches ( & re_with_acl) ;
6370+
6371+ let test2: uutests:: util:: CmdResult = scene. ucmd ( ) . arg ( "-l" ) . succeeds ( ) ;
6372+
6373+ let mut iter = test2
6374+ . stdout ( )
6375+ . split ( |b| b == & b'\n' )
6376+ . skip ( 1 )
6377+ . filter_map ( |line : & [ u8 ] | line. iter ( ) . position ( |b : & u8 | b. is_ascii_digit ( ) ) ) ;
6378+
6379+ let first = iter. next ( ) . unwrap ( ) ;
6380+
6381+ assert ! ( iter. all( |i| i == first) ) ;
63656382}
63666383
63676384#[ test]
You can’t perform that action at this time.
0 commit comments