This is the mail archive of the cygwin-patches@cygwin.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: [PATCH]: Check modification time on /etc/passwd and /etc/group


On Sun, Aug 05, 2001 at 11:12:51AM +0200, Corinna Vinschen wrote:
>On Sat, Aug 04, 2001 at 05:21:01PM -0400, Christopher Faylor wrote:
>> On Sat, Aug 04, 2001 at 09:59:35PM +0200, Corinna Vinschen wrote:
>> >I haven't found such a problem. I had no endless loop. However, I have
>> >a redefined solution which doesn't use stat(). Instead it converts
>> >the /etc/passwd and /etc/group paths to win32 paths and accesses them
>> >directly using FileFirstFind() which should be way faster.
>> 
>> This is probably ok but there is a potential gotcha if the user changes
>> a mount or makes a symbolic link to /etc/passwd or something.
>
>Who would do that on a POSIX system?
>
>IMO, we're just talking about rereading /etc/passwd and /etc/group
>when it has changed it's content w/o restarting a process.
>
>Why should a user expect to be able to change the path to the passwd
>file w/o restarting a process?

That's why I said "This is probably ok".  I do suspect that there could
be problems with things like long-running daemons but given the fact
that it will be unlikely that people will be messing with this, it's
probably no big deal.

I only mentioned it for the record and in case someone had an objection.

>> >If we additionally change the read_etc_passwd() and read_etc_group()
>> >code so that direct win32 calls are used for reading the files, we could
>> >perhaps speed up Cygwin again a few percent.
>> 
>> I think we'd get much more savings by moving /etc/passwd info into either
>> the cygwin heap
>      ^^^^^^^^^^^
>      the best compromise
>
>>                 or shared memory so that /etc/passwd wasn't read by
>                     ^^^^^^^^^^^^^
>		     the best way but difficult
>
>> each exec'ed process.  Then the file would only be read when it was
>> needed.
>
>I will work on moving the stuff into cygheap.
>
>However, I would still prefer to get the /etc/passwd path once,
>translate it into a Win32 path and work with that. If each access
>to passwd and group information requires checking file modification
>time, it's not that clever to have to convert the path all the time,
>IMO.

Now that I think of this, I actually did this a while ago.  IIRC, it
actually slowed things down.  I didn't investigate why and I just reverted
my change.

>> Actually, it's possible that /etc/passwd isn't read by an exec'ed process
>> now unless it needs to look up a uid other than it's own.  I don't know
>> for sure.
>
>It doesn't look so, at least with ntsec on which often needs the
>uid/gid <-> SID mappings.

So, is it worthwhile to make this change?  We might be adding some overhead
for an infrequent case.

cgf


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