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.
This commit is contained in:
inxi-svn 2013-05-03 20:57:40 +00:00
parent 43a2cbc589
commit 4af4fce377
2 changed files with 42 additions and 5 deletions

20
inxi
View file

@ -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
@ -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 {

View file

@ -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