roberts
Group: Members
Posts: 4983
Joined: Oct. 2003 |
|
Posted: Dec. 10 2005,23:53 |
|
First off, I have to smile when I see such a dramatic title. The backup/restore has been in place for a very long time and it used everyday by many. That is not to say it is perfect. But lets proceed with the analysis.
The mount point functions were contributed by a forum member to DSL in 9/12/04 which would make this in place since v0.8.2. These functions replaced inline code that I wrote dating back to dsl v0.5
Again, leading to the fact this is a rather subtle error and not one to be so alarmed about. And in fact is not a bug specific to dsl v2.0.
Multiple mounting. This is possible and in fact allowed with no use of any DSL code. It is perfectly permissible to mount the same device to multiple mount points. This can easily be achieved using the mount command. Why one would do this, especially for the chosen backup device is beyond me, but more on that later. Again this has nothing to do with DSL code or any version of DSL.
But in fact if one does do this very thing, then, yes, the backup will fail with a broken pipe message. Why, because the find_mountpoint() which is called by the get_mountpoint() which is called from filetool.sh will return the multiple mount points caused only if such multiple mounting was done. Normally this would not occur.
Applying the head -n 1 to the find_mount() MOUNTPOINT variable will indeed as WDef suggests will correct this and return only one. Afterall, it is the device that this code is after.
Inlining the code and not calling functions is dangerous in the world of bash code. Global variables which may be set in functions might then not be set from excluding such function calls. I would rather see a more generic description of the problem that a recommendation to bypass existing functions.
I suspect the percipitation of this subtle bug is because of the popularity of the frugal installs. For example a typical frugal install will be at hda2 and /dev/hda2 is mounted on /cdrom. Because it is frugal /cdrom is indeed writeable by user root. But most users would think that it would not be possible to write to /cdrom. Then with that convenient mount.app gui sitting there, allowing easy access to mount hda2 (/dev/hda2 on /mnt/hda2). Thereby we now have the dreaded multiple mount. This multiple mount will show up in both /etc/mtab and /proc/mounts.
Anyway, an interesting post to squash a subtle bug. I have corrected this in the next cut to be available soon.
It is not a crisis, just beware of multiple mounts especially while using a frugal install.
Thanks WDef for bring this to my attention.
|