File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -68,7 +68,7 @@ use uucore::{
6868 line_ending:: LineEnding ,
6969 os_str_as_bytes_lossy,
7070 parser:: parse_glob,
71- parser:: parse_size:: parse_size_u64 ,
71+ parser:: parse_size:: parse_size_non_zero_u64 ,
7272 parser:: shortcut_value_parser:: ShortcutValueParser ,
7373 quoting_style:: { QuotingStyle , locale_aware_escape_dir_name, locale_aware_escape_name} ,
7474 show, show_error, show_warning,
@@ -902,7 +902,7 @@ impl Config {
902902
903903 let ( file_size_block_size, block_size) = if !opt_si && !opt_hr && !raw_block_size. is_empty ( )
904904 {
905- match parse_size_u64 ( & raw_block_size. to_string_lossy ( ) ) {
905+ match parse_size_non_zero_u64 ( & raw_block_size. to_string_lossy ( ) ) {
906906 Ok ( size) => match ( is_env_var_blocksize, opt_kb) {
907907 ( true , true ) => ( DEFAULT_FILE_SIZE_BLOCK_SIZE , DEFAULT_BLOCK_SIZE ) ,
908908 ( true , false ) => ( DEFAULT_FILE_SIZE_BLOCK_SIZE , size) ,
Original file line number Diff line number Diff line change @@ -5355,6 +5355,12 @@ fn test_ls_invalid_block_size() {
53555355 . fails_with_code ( 2 )
53565356 . no_stdout ( )
53575357 . stderr_is ( "ls: invalid --block-size argument 'invalid'\n " ) ;
5358+
5359+ new_ucmd ! ( )
5360+ . arg ( "--block-size=0" )
5361+ . fails_with_code ( 2 )
5362+ . no_stdout ( )
5363+ . stderr_is ( "ls: invalid --block-size argument '0'\n " ) ;
53585364}
53595365
53605366#[ cfg( all( unix, feature = "dd" ) ) ]
@@ -5394,6 +5400,14 @@ fn test_ls_invalid_block_size_in_env_var() {
53945400 . succeeds ( )
53955401 . stdout_contains_line ( "total 4" )
53965402 . stdout_contains ( " 1024 " ) ;
5403+
5404+ scene
5405+ . ucmd ( )
5406+ . arg ( "-og" )
5407+ . env ( "BLOCKSIZE" , "0" )
5408+ . succeeds ( )
5409+ . stdout_contains_line ( "total 4" )
5410+ . stdout_contains ( " 1024 " ) ;
53975411}
53985412
53995413#[ cfg( all( unix, feature = "dd" ) ) ]
You can’t perform that action at this time.
0 commit comments