]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
Make df -P immune to effects of e.g., the BLOCK_SIZE envvar.
authorPaul Eggert <eggert@cs.ucla.edu>
Tue, 27 Feb 2007 18:12:08 +0000 (19:12 +0100)
committerJim Meyering <jim@meyering.net>
Tue, 27 Feb 2007 18:33:03 +0000 (19:33 +0100)
* 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.

ChangeLog
NEWS
doc/ChangeLog
doc/coreutils.texi
src/df.c

index a1746d393fc6cf68aa515bfa59bc92abb6a15792..01754065247aea096f94dea98f7dc62ce33e9c7d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2007-02-27  Paul Eggert  <eggert@cs.ucla.edu>
+
+       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  <jim@meyering.net>
 
        * Makefile.maint (announcement): Adjust so that it works with
diff --git a/NEWS b/NEWS
index 08724b7192edce86ec7573d650ea689979e7e5db..65a7d529bbaf348ed238874c80315bb70fa5e2f3 100644 (file)
--- 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]
 
index 6835cf7bc67f4ce0bdde833da5d396d145f3c9dc..f296614f06d9fcf4b57bb1578a9436a14c966a5c 100644 (file)
@@ -1,3 +1,9 @@
+2007-02-27  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * 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  <eggert@cs.ucla.edu>
 
        * coreutils.texi
index 99412e425ccf16fcefe0b68f78c59f256def2eaf..b313afdc7eebbdb298302b08148506ec564c9779 100644 (file)
@@ -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
index 8bc4a84c95c0e10b01f255ca9b5365e56a53de34..609787eea227436a451903a31c3f892a1a96ba40 100644 (file)
--- 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;