Mail Archives: cygwin-developers/1999/07/27/23:29:56
Thanks for the bug report. I've done this in a slightly different
manner by using memcpy and by removing the, now, unneeded code from
sort_by_*.
This code should be in the next snapshot if you want to try it out.
-chris
On Sat, Jul 24, 1999 at 02:09:17AM +1000, Andrew Dalgleish wrote:
>mount_info::del_item() leaves holes in the mount_info::mount[] table.
>
>This causes "umount --remove-all-mounts" to go into an endless loop.
>
>You can also get other strange symptoms if you call umount followed by
>mount.
>This depends on your mount table, and what directories you umount and
>mount.
>
>To reproduce the bug, create a mount table like this:
>(note that the posix root is not the last line)
>Device Directory Type Flags
>c:\foobar / user textmode
>c:\foo /foo user textmode
>then type "umount --remove-all-mounts".
>
>
>The mount_info::posix_sorted[] and mount_info::native_sorted[] tables
>correctly ignore the holes,
>but there are many accesses to mount_info::mount[] which do not use the
>XXX_sorted[] tables
>and do not check for the holes.
>
>
>This patch is relative to winsup-src-19990718.tar.gz.
>
>Sat Jul 24 01:35:38 1999 Andrew Dalgleish <andrewd AT axonet DOT com DOT au>
> * path.cc (mount_info::del_item): Don't leave holes in the mount
>table.
>
>--- winsup/path.cc.orig Thu Jul 15 12:49:24 1999
>+++ winsup/path.cc Sat Jul 24 01:35:38 1999
>@@ -1673,12 +1674,16 @@
> || strcmp (mount[i].native_path, pathtmp) == 0)) &&
> ((mount[i].flags & MOUNT_SYSTEM) == (flags & MOUNT_SYSTEM)))
> {
>- /* Delete by emptying mount point in question, then sorting
>- the mount table, which will put the empty one to the end.
>- Inefficient but simple. */
>- mount[i].init ("", "", 0);
>- sort ();
>+ /* Move all the remaining mounts down one in the table. */
>+ for (; i < nmounts - 1; i++)
>+ mount[i] = mount[i+1];
>+
>+ /* Remember we have one less entry */
> nmounts--;
>+
>+ /* Sort the remaining entries. */
>+ sort ();
>+
> return 0;
> }
> }
- Raw text -