summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--NEWS5
-rw-r--r--doc/ChangeLog6
-rw-r--r--doc/coreutils.texi7
-rw-r--r--src/df.c17
5 files changed, 38 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index a1746d393..017540652 100644
--- 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 08724b719..65a7d529b 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 6835cf7bc..f296614f0 100644
--- a/doc/ChangeLog
+++ b/doc/ChangeLog
@@ -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
diff --git a/doc/coreutils.texi b/doc/coreutils.texi
index 99412e425..b313afdc7 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 8bc4a84c9..609787eea 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;