You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On the pages for at least df, the standard suggests the use of a BLOCKSIZE environment variable:
The use of 512-byte units is historical practice and maintains compatibility with ls and other utilities in this volume of POSIX.1-2017. This does not mandate that the file system itself be based on 512-byte blocks. The -k option was added as a compromise measure. It was agreed by the standard developers that 512 bytes was the best default unit because of its complete historical consistency on System V (versus the mixed 512/1024-byte usage on BSD systems), and that a -k option to switch to 1024-byte units was a good compromise. Users who prefer the more logical 1024-byte quantity can easily alias df to df -k without breaking many historical scripts relying on the 512-byte units.
It was suggested that df and the various related utilities be modified to access a BLOCKSIZE environment variable to achieve consistency and user acceptance. Since this is not historical practice on any system, it is left as a possible area for system extensions and will be re-evaluated in a future version if it is widely implemented.
I think it's reasonable to only support values of 512 and 1024. To the best of my knowledge, the affected utilities also all have a -k option. Given that information and the way I've implemented Boreutils utililties so far, this seems like a reasonable approach:
// after normal argument parsing is done (to avoid issues if `-k` is passed but $BLOCKSIZE != 1024).
if (!dash_k) { dash_k = strcmp(getenv("BLOCKSIZE"), "1024") == 0; }
The utilities that should have support for this are any which provide information about files and/or has a -k option that switches to 1024 byte blocks. This list should be updated if more are found:
df
ls
The text was updated successfully, but these errors were encountered:
On the pages for at least df, the standard suggests the use of a
BLOCKSIZE
environment variable:I think it's reasonable to only support values of
512
and1024
. To the best of my knowledge, the affected utilities also all have a-k
option. Given that information and the way I've implemented Boreutils utililties so far, this seems like a reasonable approach:The utilities that should have support for this are any which provide information about files and/or has a
-k
option that switches to 1024 byte blocks. This list should be updated if more are found:df
ls
The text was updated successfully, but these errors were encountered: