fsadm bug
Hi,
I would like to report a bug in the fsadm script.
Trying to resize a filesystem which has a device name that is equal to the beginning of another mounted device (which of course can happen with the devices in /dev/mapper created for lvm) fails for me. The script complains that the filesystem is mounted (even if it is not), then tries to unmount *the other* filesystem (which can fail, of course). E.g. you want to resize a filesystem with the name /dev/mapper/foobar but there another filesystem mounted somewhere from the device /dev/mapper/foo the problem appears.
Reason is that the device path is simply grepped from /proc/mounts without checking that the matched string is the whole device path. I attached a quick fix which solved the problem for me, but imho it does not fix all potential issues here. The device path is used unmodified as a regexp and also it is not checked if the match is in the correct column of the line.
Best,
Oliver
203c203
< MOUNTED=$("$GREP" ^"$VOLUME" "$PROCMOUNTS")
---
Quoted 1 line
MOUNTED=$("$GREP" ^"$VOLUME[ \t]" "$PROCMOUNTS")206c206
< test -z "$MOUNTED" && MOUNTED=$("$GREP" ^"$RVOLUME" "$PROCMOUNTS")
---
Quoted 1 line
test -z "$MOUNTED" && MOUNTED=$("$GREP" ^"$RVOLUME[ \t]" "$PROCMOUNTS")210a211
Quoted 1 line
215,216c216,217
< MOUNTED=$(LANG=C "$MOUNT" | "$GREP" ^"$VOLUME")
< test -z "$MOUNTED" && MOUNTED=$(LANG=C "$MOUNT" | "$GREP" ^"$RVOLUME")
---
Quoted 2 lines
MOUNTED=$(LANG=C "$MOUNT" | "$GREP" ^"$VOLUME[ \t]") test -z "$MOUNTED" && MOUNTED=$(LANG=C "$MOUNT" | "$GREP" ^"$RVOLUME[ \t]")