On Thu, May 15, 2025 at 10:17 AM Jan Fooken <jan@faulty.computer> wrote: > while parsing the output of df I realised that the behaviour is a bit > different compared to the behaviour described by POSIX, especially when > it comes to handling the options -k and -P. > > The current and previous revisions of the POSIX standard POSIX.1-2017 > and POSIX.1-2024 both allow for using 1024 byte based blocks, when the > option -k is passed. This patch implements this functionality even when > POSIXLY_CORRECT is set. Furthermore, it aligns the behaviour of the > with the current df variant from GNU coreutils as of version 9.7.
Good catch. > Regarding the -P behaviour: The POSIX spec states to use 512 byte blocks > when it's passed and the current busybox version uses 1024 byte blocks > except when POSIXLY_CORRECT is set. I think it would be a good idea to > follow POSIX.1 a bit more closely and use 512 byte blocks when -P is > passed and 1024 byte blocks when -Pk is passed regardless of the state > of POSIXLY_CORRECT. What do you think? I think it's best to mimic coreutils df behavior. > + if (opt & OPT_KILO) > + df_disp_hr = 1024; Applied, thank you. _______________________________________________ busybox mailing list busybox@busybox.net https://lists.busybox.net/mailman/listinfo/busybox