Commit d35a2fdf authored by Kirill Smelkov's avatar Kirill Smelkov

X neotest/info-local: Fix disk display in presence of bind-mounts

When source device is mounted multiple times, findmnt reports it e.g.
this way:

	|-/mnt/SLAPOS                         /dev/md2     ext4       rw,relatime,stripe=256,data=ordered
	|-/srv/slapgrid                       /dev/md2[/srv/slapgrid]
	                                                   ext4       rw,relatime,stripe=256,data=ordered
	|-/opt/slapgrid                       /dev/md2[/opt/slapgrid]
	                                                   ext4       rw,relatime,stripe=256,data=ordered
	`-/opt/slapos                         /dev/md2[/opt/slapos]
	                                                   ext4       rw,relatime,stripe=256,data=ordered

and then it breaks:

	$ ./neotest info-local
	date:   Mon, 26 Mar 2018 21:52:08 +0200
	xnode:  slapuser5@sd-102959.dedibox.fr (2001:67c:1254:e:49::1 (+ 17·ipv6) 10.0.31.249 (+ 17·ipv4))
	uname:  Linux vifibcloud-onlinenet-hosting-002 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt25-2+deb8u3 (2016-07-02) x86_64 GNU/Linux
	cpu:    Intel(R) Xeon(R) CPU D-1531 @ 2.20GHz
	cpu/[0-11]/freq: intel_pstate/powersave [0.80GHz - 2.70GHz]
	cpu/[0-11]/idle: acpi_idle/menu: POLL·0/0 C1·1/2 C2·41/82 # elat/tres µs
	WARNING: cpu: frequency not fixed - benchmark timings won't be stable
	WARNING: cpu: C-state exit-latency is max 41μs - benchmark timings won't be stable
	WARNING: cpu: (up to that might be adding to networked and IPC request-reply latency)
	realpath: '/dev/md2[/srv/slapgrid]': No such file or directory

Fix it by telling findmnt to not include '[/dir]' (-v option).

While we are here also add -u which means "Do not truncate text in columns"
which is also good to have on a safe side.
parent 463d9f67
......@@ -686,7 +686,7 @@ system_info() {
# disk under .
# TODO show all disks and just mark which is current
mntpt=`stat -c '%m' .` # mountpoint of current filesystem
blkdev=`findmnt -n -o source $mntpt` # mountpoint -> device
blkdev=`findmnt -n -o source -v -u $mntpt` # mountpoint -> device
blkdev=`realpath $blkdev` # /dev/mapper/vg0-root -> /dev/dm-0
blkdev1=`basename $blkdev` # /dev/sda -> sda
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment