From: Paul Eggert Date: Tue, 27 Feb 2007 18:12:08 +0000 (+0100) Subject: Make df -P immune to effects of e.g., the BLOCK_SIZE envvar. X-Git-Tag: COREUTILS-6_9~68 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=817d0261eb5493c626e07f570bd28c155857b584;p=thirdparty%2Fcoreutils.git Make df -P immune to effects of e.g., the BLOCK_SIZE envvar. * NEWS: With -P, the default block size and output format is not affected by DF_BLOCK_SIZE, BLOCK_SIZE, or BLOCKSIZE. * src/df.c (main): Implement this. * doc/coreutils.texi (df invocation): With -P, the default block size and output format is not affected by DF_BLOCK_SIZE, BLOCK_SIZE, or BLOCKSIZE. --- diff --git a/ChangeLog b/ChangeLog index a1746d393f..0175406524 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2007-02-27 Paul Eggert + + Make df -P immune to effects of e.g., the BLOCK_SIZE envvar. + * NEWS: With -P, the default block size and output format is not + affected by DF_BLOCK_SIZE, BLOCK_SIZE, or BLOCKSIZE. + * src/df.c (main): Implement this. + 2007-02-25 Jim Meyering * Makefile.maint (announcement): Adjust so that it works with diff --git a/NEWS b/NEWS index 08724b7192..65a7d529bb 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,11 @@ GNU coreutils NEWS -*- outline -*- * Noteworthy changes in release 6.8+ (????-??-??) [not-unstable] +** Bug fixes + + The default block size and output format for df -P are now unaffected by + the DF_BLOCK_SIZE, BLOCK_SIZE, and BLOCKSIZE environment variables. It + is still affected by POSIXLY_CORRECT, though. * Noteworthy changes in release 6.8 (2007-02-24) [not-unstable] diff --git a/doc/ChangeLog b/doc/ChangeLog index 6835cf7bc6..f296614f06 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,9 @@ +2007-02-27 Paul Eggert + + * coreutils.texi (df invocation): With -P, the default block size + and output format is not affected by DF_BLOCK_SIZE, BLOCK_SIZE, or + BLOCKSIZE. + 2007-01-30 Paul Eggert * coreutils.texi diff --git a/doc/coreutils.texi b/doc/coreutils.texi index 99412e425c..b313afdc7e 100644 --- a/doc/coreutils.texi +++ b/doc/coreutils.texi @@ -9481,6 +9481,13 @@ some network mounts), the columns are misaligned. @item The labels in the header output line are changed to conform to @acronym{POSIX}. + +@item +The default block size and output format are unaffected by the +@env{DF_BLOCK_SIZE}, @env{BLOCK_SIZE} and @env{BLOCKSIZE} environment +variables. However, the default block size is still affected by +@env{POSIXLY_CORRECT}: it is 512 if @env{POSIXLY_CORRECT} is set, 1024 +otherwise. @xref{Block size}. @end enumerate @optSi diff --git a/src/df.c b/src/df.c index 8bc4a84c95..609787eea2 100644 --- a/src/df.c +++ b/src/df.c @@ -796,10 +796,7 @@ main (int argc, char **argv) inode_format = false; show_all_fs = false; show_listed_fs = false; - - human_output_opts = human_options (getenv ("DF_BLOCK_SIZE"), false, - &output_block_size); - + human_output_opts = -1; print_type = false; file_systems_processed = false; posix_format = false; @@ -876,6 +873,18 @@ main (int argc, char **argv) } } + if (human_output_opts == -1) + { + if (posix_format) + { + human_output_opts = 0; + output_block_size = (getenv ("POSIXLY_CORRECT") ? 512 : 1024); + } + else + human_output_opts = human_options (getenv ("DF_BLOCK_SIZE"), false, + &output_block_size); + } + /* Fail if the same file system type was both selected and excluded. */ { bool match = false;