From 4af4fce3770784bf5d0d55f0f598bd84923746ee Mon Sep 17 00:00:00 2001 From: inxi-svn Date: Fri, 3 May 2013 20:57:40 +0000 Subject: [PATCH] New version, tarball. Fixed a small issue that would create a wrong reporting of disk useage if bind mounts are used, ie, multiple binds to a single mount. Now inxi will check a list of the previously used partitions before adding the size of the used space to the total used, if the partition has already been used it will skip it. This was/is a quick and dirty fix, but it's totally fine I believe and should resolve two separate issues: 1. use of bind mount method, where multiple partition names are bound to the same partition 2. accidental dual mounting to the same partition. partitions section will still show the same data, ie, if bind is used, it will show all the bind mounts even when they are attached/bound to a partition that is already listed. This seems useful information, though maybe we can get the key word 'bind' in there somehow, but for now I won't worry about that issue, that's just a nice to have, not a bug. --- inxi | 22 +++++++++++++++++----- inxi.changelog | 25 +++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 5 deletions(-) diff --git a/inxi b/inxi index 6f419a4..9baa9f6 100755 --- a/inxi +++ b/inxi @@ -1,8 +1,8 @@ #!/usr/bin/env bash ######################################################################## #### Script Name: inxi -#### Version: 1.8.45 -#### Date: March 2 2013 +#### Version: 1.8.46 +#### Date: May 3 2013 #### Patch Number: 00 ######################################################################## #### SPECIAL THANKS @@ -584,7 +584,7 @@ main() local color_scheme='' # this will be used by all functions following local Ps_aux_Data="$( ps aux )" - + # This function just initializes variables initialize_data @@ -4928,6 +4928,12 @@ get_hdd_data_basic() log_function_data 'raw' "hdd_data:\n$hdd_data" hdd_used=$( echo "$hdd_data" | gawk -v bsdType=$BSD_TYPE ' + BEGIN { + # this is used for specific cases where bind, or incorrect multiple mounts to same partitions, + # is present. The value is searched for an earlier appearance of that partition and if it is + # present, the data is not added into the partition used size. + partitionsSet="" + } # using $1, not $2, because older bsd df do not have -T, filesystem type ( bsdType != "" ) && $1 ~ /^(aufs|devfs|devtmpfs|fdescfs|iso9660|linprocfs|procfs|squashfs|sysfs|tmpfs|type|unionfs)$/ { # note use next, not getline or it does not work right @@ -4947,11 +4953,17 @@ get_hdd_data_basic() # this also protects against cases where the mount point has a space in the # file name, thus breaking going down from $NF directly. if ( $5 ~ /.*%/ ) { - used += $3 + if ( partitionsSet !~ /.*~$6.*/ ) { + used += $3 + } + partitionsSet = partitionsSet "~" $6 } # otherwise use standard else if ( $6 ~ /.*%/ ) { - used += $4 + if ( partitionsSet !~ /.*$7.*/ ) { + used += $4 + } + partitionsSet = partitionsSet "~" $7 } # and if this is not detected, give up, we need user data to debug else { diff --git a/inxi.changelog b/inxi.changelog index 22539e4..edbfd0e 100755 --- a/inxi.changelog +++ b/inxi.changelog @@ -1,3 +1,28 @@ +===================================================================================== +Version: 1.8.46 +Patch Version: 00 +Script Date: May 3 2013 +----------------------------------- +Changes: +----------------------------------- +New version, tarball. Fixed a small issue that would create a wrong reporting of disk +useage if bind mounts are used, ie, multiple binds to a single mount. Now inxi will +check a list of the previously used partitions before adding the size of the used space +to the total used, if the partition has already been used it will skip it. This was/is +a quick and dirty fix, but it's totally fine I believe and should resolve two separate +issues: + +1. use of bind mount method, where multiple partition names are bound to the same partition +2. accidental dual mounting to the same partition. + +partitions section will still show the same data, ie, if bind is used, it will show all +the bind mounts even when they are attached/bound to a partition that is already listed. +This seems useful information, though maybe we can get the key word 'bind' in there somehow, +but for now I won't worry about that issue, that's just a nice to have, not a bug. + +----------------------------------- +-- Harald Hope - Fri, 03 May 2013 13:52:44 -0700 + ===================================================================================== Version: 1.8.45 Patch Version: 00