delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin-developers/1999/07/27/23:29:56

Mailing-List: contact cygwin-developers-help AT sourceware DOT cygnus DOT com; run by ezmlm
Sender: cygwin-developers-owner AT sourceware DOT cygnus DOT com
List-Unsubscribe: <mailto:cygwin-developers-unsubscribe-archive-cygwin-developers=delorie DOT com AT sourceware DOT cygnus DOT com>
List-Archive: <http://sourceware.cygnus.com/ml/cygwin-developers/>
List-Help: <mailto:cygwin-developers-help AT sourceware DOT cygnus DOT com>,
<http://sourceware.cygnus.com/ml/#faqs>
Delivered-To: mailing list cygwin-developers AT sourceware DOT cygnus DOT com
From: Chris Faylor <cgf AT cygnus DOT com>
Date: Tue, 27 Jul 1999 23:31:12 -0400
To: Andrew Dalgleish <andrewd AT axonet DOT com DOT au>
Cc: cygwin-developers AT sourceware DOT cygnus DOT com
Subject: Re: patch for bug in mount_info::del_item()
Message-ID: <19990727233112.A20780@cygnus.com>
References: <00F8D6E8AB0DD3118F1A006008186C965368 AT server1 DOT axonet DOT com DOT au>
Mime-Version: 1.0
X-Mailer: Mutt 0.95.6i
In-Reply-To: <00F8D6E8AB0DD3118F1A006008186C965368@server1.axonet.com.au>; from Andrew Dalgleish on Sat, Jul 24, 1999 at 02:09:17AM +1000

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019