This is the mail archive of the cygwin@sources.redhat.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Followup on eliminating symlink ReadFile calls -- it's not necessary


On Wed, Feb 14, 2001 at 07:05:56PM -0500, Jonathan Kamens wrote:
>>  Date: Wed, 14 Feb 2001 16:13:06 -0500
>>  From: Christopher Faylor <cgf@redhat.com>
>>  
>>  >I implemented his suggestion, adding a "-l" flag and a corresponding
>>  >MOUNT_NO_SYMLINKS flag, and did some performance testing on the
>>  >result.  I was surprise to discover that mounting with this option
>>  >didn't provide any additional performance improvement over "-x".
>>  
>>  Actually, I suggested this.
>
>No, I'm afraid not.
>
>You suggested using "mount -x":

Your original email said this:

On Wed, Feb 14, 2001 at 12:46:08PM -0500, Jonathan Kamens wrote:
>DJ Delorie suggested using "mount -x" to eliminate the ReadFile for
>determining whether a file is executable, and adding a new mount
>option to indicate that there are no symbolic links under a particular
>mountpoint, to eliminate the other ReadFile.

I was referring to the "mount -x" part of what you said, of course.
But it was a petty observation, anyway, and I really should not
have made it.

>>  Setting execute permissions on everything is not a generically good
>>  solution.  It means that cygwin will try to execute things like "foo.c".
>
>1) This happens to me already in Cygwin, even when I don't use "mount
>-x".  Cygwin's and bash's mechanisms for figuring out whether a file
>can be executed are hardly foolproof.

Thanks for reporting this bug.  Could you provide an example of this
behavior, please?

>2) I do not think that the fact that Cygwin will try to run a
>non-program file if someone makes the mistake of typing its name as a
>command is a particularly big deal.  It's highly unlikely that any harm
>would come of it.  And the performance improvement from "mount -x" is
>really phenomenal; I think it clearly outweighs the risk.

There is a possibility that some harm, or at least some confusion, could
come from it.  Windows could interpret the file as a .com file and try
to execute it as arbitrary code.

You actually see this occasionally when Windows tries to execute a
Cygwin symlink when the system attribute has been removed.

>To see what I mean, try doing "configure; make" on Cygwin with and
>without "mount -x".  On my machine, it takes 16:54 without "-x" and
>13:31 with it, an improvement of 20%!

I am interested in correctness, not speed.  I am not going to turn on
the 'x' bit for every file just so that all 'configure; make's will be
faster.  You're welcome to make this decision for yourself, however,
and you've obviously done so.

>>  I've mentioned that -x is a performance win in the mailing list several
>>  times.
>
>The mailing list is not documentation.  People should be able to
>download and use Cygwin in an effective manner by consulting its
>documentation.  They should not need to subscribe to the mailing list
>and pick up tips over time just to learn how to tweak Cygwin into an
>effective configuration.
>
>If you've had to mention it on the mailing list several times, that's
>all the more indication that it should be documented in the persistent
>documentation.

The option is mentioned in the documentation:

http://sources.redhat.com/cygwin/cygwin-ug-net/using-utils.html#MOUNT

However, we probably could use a tuning cygwin section.  If someone
would like to contribute this, I'm sure that it will be included.

Btw, you can also use this option (and any mount option, actually) on
individual files if you want to get pinpoint control.

I should also point out that the currently undocumented "-X" (uppercase)
flag may be useful for directories which are populated only by cygwin
executables.  This should decrease the overhead in spawn and fork
slightly.

cgf

--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]