This is the mail archive of the cygwin 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]
Other format: [Raw text]

Re: get rid of getpwent? (Was: cygwin-1.7.28 getpwent header declaration changes ?)



On Wed, 12 Feb 2014, Ken Brown wrote:
On 2/12/2014 4:08 AM, Corinna Vinschen wrote:
On Feb 11 19:06, Eric Blake wrote:
On 02/11/2014 05:06 PM, Warren Young wrote:
On 2/11/2014 16:25, David Stacey wrote:
getpwent() is called in three different places.

To those of you who have investigated these code paths: do any of them
look like they couldn't be replaced by getpwnam() or other calls that
would let cygwin1.dll do single-record AD/SAM lookups, rather than
whole-table/tree scans?

That is, do any of these programs really need to visit every record in
/etc/passwd?

libreadline wants to know how to tab-complete ~foo; to do that, it has
to find all usernames beginning with foo.  How would you do that without
visiting every single record?

This seems to be the major usage of getpwent these days.  The question
is, how bad is it if only a handful entries, or even only a single one
(of oneself) show up?

Either way, implementing a full getpwent requires to return the local
users, the users of the primary domain, and the users of all trusted
domains.  I know of domains with 200K users and there are probably
bigger ones.  How long should a search take when a user presses <TAB>
after the ~?  And then, shall the process running the getpwent actually
cache all of them?  This seems really excessive.

What about the following compromise: If /etc/passwd exists, then getpwent behaves as it does currently. Otherwise, it returns a handful of entries, or possibly just the current user. This gives users a choice. If tab-completion in this situation is important to them, they can keep their /etc/passwd file.

Works for me! And I'd vote "just the current user" in lieu of "a handful" because even a handful has a huge overhead associated with it.

Richard

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      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]