From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14739 invoked by alias); 12 Feb 2014 16:24:55 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 14724 invoked by uid 89); 12 Feb 2014 16:24:54 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.7 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.3.2 X-HELO: mail.sciencetools.com Received: from gw5.sciencetools.com (HELO mail.sciencetools.com) (67.101.113.5) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 12 Feb 2014 16:24:53 +0000 Received: by mail.sciencetools.com (Postfix, from userid 1002) id 623A014C; Wed, 12 Feb 2014 08:35:40 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by mail.sciencetools.com (Postfix) with ESMTP id 5CD6514A; Wed, 12 Feb 2014 08:35:40 -0800 (PST) Date: Wed, 12 Feb 2014 17:05:00 -0000 From: Richard To: Ken Brown cc: cygwin@cygwin.com Subject: Re: get rid of getpwent? (Was: cygwin-1.7.28 getpwent header declaration changes ?) In-Reply-To: <52FB9E51.7030607@cornell.edu> Message-ID: References: <31347914-BB4F-4039-984B-731B6C72F903@etr-usa.com> <52F7AEC5.5090205@tiscali.co.uk> <8B7B5FE0-7413-4358-BA8A-E0B6E0B17653@etr-usa.com> <52F8B50E.7040307@lysator.liu.se> <52F92D58.9030408@etr-usa.com> <52F95D1D.4050108@tiscali.co.uk> <4510121021.20140211062515@mtu-net.ru> <52FAB14C.8060800@tiscali.co.uk> <52FABAF5.2060701@etr-usa.com> <52FAD730.9090507@redhat.com> <20140212090804.GM2821@calimero.vinschen.de> <52FB9E51.7030607@cornell.edu> User-Agent: Alpine 2.03 (LFD 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-IsSubscribed: yes X-SW-Source: 2014-02/txt/msg00281.txt.bz2 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 >> 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