This is the mail archive of the cygwin-developers@sourceware.cygnus.com mailing list for the Cygwin project. See the Cygwin home page for more information.
[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index] [Subject Index] [Author Index] [Thread Index]

Re: Mount improvements finished




> I just checked in a change that causes the mounts to be
> internally sorted by decreasing length of the win32 path.
> 
> That seems to solve this particular problem.

Yes, but it causes the other problem - conversion from posix
to win32 will break.  Consider this sample mount table:

d:\cygwin	/
d:\		/dos/d

When converting from win32 paths to posix paths, the mount table must
be sorted by win32 paths, longest first.  However, when converting
from a posix path to a win32 paths, the mount table must be sorted by
posix paths, longest first.  It is impossible for one sorting to cover
both cases.  Consider the following example conversions (using the
table entries in the order given above):

d:\cygwin\bin	/bin			right
		/dos/d/cygwin/bin	wrong (but works)

/dos/d/foo	d:\cygwin\dos\d\foo	wrong
		d:\foo			right

In both cases, the right one is the one that matches the longest (thus
most specific) directory *of that type* (win32 vs posix).  If you used
a single sorting, one of the above cases would always be wrong.

If we are to use the sort shortcut, we must maintain two sortings, one
of which may simply be an array of pointers to the other's records.