summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorRichard Jones <rjones@redhat.com>2010-06-08 16:44:18 +0100
committerRichard Jones <rjones@redhat.com>2010-06-08 16:50:52 +0100
commitaaf03a51a26ee501f5dbf2720bbb8a5e3b4e1e6b (patch)
tree7f3d2e98f6de11ae69c0bccf61390af9cdaccf48 /tools
parentba39ced8804765705f4c61a92db0fddb8d672c7d (diff)
downloadlibguestfs-aaf03a51a26ee501f5dbf2720bbb8a5e3b4e1e6b.tar.gz
libguestfs-aaf03a51a26ee501f5dbf2720bbb8a5e3b4e1e6b.tar.xz
libguestfs-aaf03a51a26ee501f5dbf2720bbb8a5e3b4e1e6b.zip
virt-df: Disallow -h and --csv options together (RHBZ#600977).
Before this commit, if you used the -h and --csv options together you would get these warnings from virt-df: $ virt-df -h --csv Guest Virtual Machine,Filesystem,Size,Used,Available,Use% Argument "13.5G" isn't numeric in printf at /home/rjones/d/libguestfs/tools/virt-df line 298. Argument "4.7G" isn't numeric in printf at /home/rjones/d/libguestfs/tools/virt-df line 298. Argument "8.1G" isn't numeric in printf at /home/rjones/d/libguestfs/tools/virt-df line 298. "/dev/vg_trick/RHEL55x64","/dev/VolGroup00/LogVol00",13,4,8,34.8% Argument "98.7M" isn't numeric in printf at /home/rjones/d/libguestfs/tools/virt-df line 298. Argument "18.8M" isn't numeric in printf at /home/rjones/d/libguestfs/tools/virt-df line 298. Argument "74.9M" isn't numeric in printf at /home/rjones/d/libguestfs/tools/virt-df line 298. "/dev/vg_trick/RHEL55x64","/dev/vda1",98,18,74,19.0% We could fix this so that the human-readable numbers get written into the CSV file. However would probably be wrong for most uses of the CSV format (databases and spreadsheets) since they would not be able to interpret these human-readable numbers, or worse could misinterpret, eg. thinking that "1M" and "1G" are both 1. Therefore this commit disallows this combination of options.
Diffstat (limited to 'tools')
-rwxr-xr-xtools/virt-df5
1 files changed, 5 insertions, 0 deletions
diff --git a/tools/virt-df b/tools/virt-df
index 4aa1063d..45b78694 100755
--- a/tools/virt-df
+++ b/tools/virt-df
@@ -119,6 +119,8 @@ my $human;
Print sizes in human-readable format.
+You are not allowed to use I<-h> and I<--csv> at the same time.
+
=cut
my $inodes;
@@ -146,6 +148,9 @@ if ($version) {
exit
}
+# RHBZ#600977
+die __"virt-df: cannot use -h and --csv options together\n" if $human && $csv;
+
# Open the guest handle.
if (@ARGV == 0) {