Re: get rid of getpwent?

2014-02-14 Thread Corinna Vinschen
On Feb 13 21:41, Achim Gratz wrote: Corinna Vinschen writes: Oh, hmm. Well, it might be possible, but somehow I'm not excited by the idea. While it looks like getpwent is mostly used for this purpose, you don't really know it. I think I'll try to implement it fully and then let the

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

2014-02-13 Thread Corinna Vinschen
On Feb 12 16:37, Christopher Faylor wrote: On Wed, Feb 12, 2014 at 08:59:31PM +0100, Corinna Vinschen wrote: There's only one tiny problem. Whatever I think about the full enumerate being right or wrong, I have this vague feeling that I'd like to have this implemented fully at one point. My

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

2014-02-13 Thread Andrey Repin
Greetings, Corinna Vinschen! There's only one tiny problem. Whatever I think about the full enumerate being right or wrong, I have this vague feeling that I'd like to have this implemented fully at one point. My cat disapproves, but we can't agree on everything, I guess. Another

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

2014-02-13 Thread Christopher Faylor
On Thu, Feb 13, 2014 at 11:00:25AM +0100, Corinna Vinschen wrote: On Feb 12 16:37, Christopher Faylor wrote: On Wed, Feb 12, 2014 at 08:59:31PM +0100, Corinna Vinschen wrote: There's only one tiny problem. Whatever I think about the full enumerate being right or wrong, I have this vague

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

2014-02-13 Thread Corinna Vinschen
On Feb 13 09:35, Christopher Faylor wrote: On Thu, Feb 13, 2014 at 11:00:25AM +0100, Corinna Vinschen wrote: On Feb 12 16:37, Christopher Faylor wrote: On Wed, Feb 12, 2014 at 08:59:31PM +0100, Corinna Vinschen wrote: There's only one tiny problem. Whatever I think about the full

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

2014-02-13 Thread Christopher Faylor
On Thu, Feb 13, 2014 at 03:44:19PM +0100, Corinna Vinschen wrote: On Feb 13 09:35, Christopher Faylor wrote: On Thu, Feb 13, 2014 at 11:00:25AM +0100, Corinna Vinschen wrote: On Feb 12 16:37, Christopher Faylor wrote: On Wed, Feb 12, 2014 at 08:59:31PM +0100, Corinna Vinschen wrote: There's

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

2014-02-13 Thread Corinna Vinschen
On Feb 13 10:43, Christopher Faylor wrote: On Thu, Feb 13, 2014 at 03:44:19PM +0100, Corinna Vinschen wrote: Yes, I think so too. I have some preliminary code (actually, just empty function shells right now) which are supposed to implement full enumerating. However, system admins might not

Re: get rid of getpwent?

2014-02-13 Thread Achim Gratz
Corinna Vinschen writes: Caching is wonderful for the usual requests for single entries from the DB, and for this we have already two caches, the LSA cache and Cygwin's own cache. But caching doesn't help at all when enumerating. Would it be possible to only look (for user name completion

Re: get rid of getpwent?

2014-02-13 Thread Andrey Repin
Greetings, Achim Gratz! Corinna Vinschen writes: Caching is wonderful for the usual requests for single entries from the DB, and for this we have already two caches, the LSA cache and Cygwin's own cache. But caching doesn't help at all when enumerating. Would it be possible to only look

Re: get rid of getpwent?

2014-02-13 Thread Corinna Vinschen
On Feb 13 18:50, Achim Gratz wrote: Corinna Vinschen writes: Caching is wonderful for the usual requests for single entries from the DB, and for this we have already two caches, the LSA cache and Cygwin's own cache. But caching doesn't help at all when enumerating. Would it be possible

Re: get rid of getpwent?

2014-02-13 Thread Achim Gratz
Corinna Vinschen writes: Oh, hmm. Well, it might be possible, but somehow I'm not excited by the idea. While it looks like getpwent is mostly used for this purpose, you don't really know it. I think I'll try to implement it fully and then let the admin decide what to allow. Configurable

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

2014-02-12 Thread Corinna Vinschen
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

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

2014-02-12 Thread Andrey Repin
Greetings, Corinna Vinschen! 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

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

2014-02-12 Thread Richard
On Wed, 12 Feb 2014, 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

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

2014-02-12 Thread Ken Brown
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

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

2014-02-12 Thread Richard
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

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

2014-02-12 Thread Andrey Repin
Greetings, Ken Brown! 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

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

2014-02-12 Thread Corinna Vinschen
On Feb 12 11:16, 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

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

2014-02-12 Thread Christopher Faylor
On Wed, Feb 12, 2014 at 08:59:31PM +0100, Corinna Vinschen wrote: On Feb 12 11:16, 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

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

2014-02-11 Thread David Stacey
On 11/02/2014 02:25, Andrey Repin wrote: Greetings, David Stacey! Greetings, Andrey Repin! (I've wanted to type that for such a long time...) I don't have my almost everything Cygwin install here to run it against, so unless someone beats me to it, I won't be posting results for many

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

2014-02-11 Thread Warren Young
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

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

2014-02-11 Thread Eric Blake
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

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

2014-02-11 Thread Andrey Repin
Greetings, Warren Young! problem was an assumption made in the 'checkfile' perl script: it was assumed that cygwin1.dll is the first DLL listed by objdump. Details, details. :) That's where is the devil, we know, right? -- WBR, Andrey Repin (anrdae...@yandex.ru) 12.02.2014, 08:23 Sorry

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

2014-02-10 Thread Warren Young
On Feb 9, 2014, at 9:37 AM, David Stacey drsta...@tiscali.co.uk wrote: On 09/02/2014 15:45, Warren Young wrote: Results: /bin/cppcheck.exe As far as I can tell, cppcheck doesn't actually call getpwent() at all; this is a false positive turned up by strings(1). Yeah, there *has* to be a

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

2014-02-10 Thread Peter Rosin
On 2014-02-10 10:02, Warren Young wrote: On Feb 9, 2014, at 9:37 AM, David Stacey drsta...@tiscali.co.uk wrote: On 09/02/2014 15:45, Warren Young wrote: Results: /bin/cppcheck.exe As far as I can tell, cppcheck doesn't actually call getpwent() at all; this is a false positive turned up

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

2014-02-10 Thread Warren Young
On 2/10/2014 04:16, Peter Rosin wrote: On 2014-02-10 10:02, Warren Young wrote: there *has* to be a better way than strings(1) to extract an EXE's list of DLL imports. objdump -x /bin/foo.exe Thank you! -x turns on 6 other flags, the only one of which that really matters here is -p.

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

2014-02-10 Thread David Stacey
On 10/02/2014 19:49, Warren Young wrote: I don't have my almost everything Cygwin install here to run it against, so unless someone beats me to it, I won't be posting results for many hours at least. Delighted to oblige. I ran your perl script on all executables and DLLs in /bin. Results

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

2014-02-10 Thread Andrey Repin
Greetings, David Stacey! I don't have my almost everything Cygwin install here to run it against, so unless someone beats me to it, I won't be posting results for many hours at least. Delighted to oblige. I ran your perl script on all executables and DLLs in /bin. Results attached.

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

2014-02-09 Thread Warren Young
On Feb 7, 2014, at 10:51 AM, Warren Young war...@etr-usa.com wrote: Here's a better check that doesn't give false positives: $ cat END checkfile #!/bin/sh if egrep -q '_getgrent(32|64)' $1 ; then echo $1 ; fi END $ find /bin -name \*.exe -exec ./checkfile {} \; The

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

2014-02-09 Thread Corinna Vinschen
On Feb 9 08:45, Warren Young wrote: On Feb 7, 2014, at 10:51 AM, Warren Young war...@etr-usa.com wrote: Here's a better check that doesn't give false positives: $ cat END checkfile #!/bin/sh if egrep -q '_getgrent(32|64)' $1 ; then echo $1 ; fi END $ find /bin

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

2014-02-09 Thread Corinna Vinschen
On Feb 9 17:10, Corinna Vinschen wrote: On Feb 9 08:45, Warren Young wrote: On Feb 7, 2014, at 10:51 AM, Warren Young war...@etr-usa.com wrote: Here's a better check that doesn't give false positives: $ cat END checkfile #!/bin/sh if egrep -q '_getgrent(32|64)' $1

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

2014-02-09 Thread Ken Brown
On 2/9/2014 11:16 AM, Corinna Vinschen wrote: On Feb 9 17:10, Corinna Vinschen wrote: On Feb 9 08:45, Warren Young wrote: On Feb 7, 2014, at 10:51 AM, Warren Young war...@etr-usa.com wrote: Here's a better check that doesn't give false positives: $ cat END checkfile #!/bin/sh

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

2014-02-09 Thread David Stacey
On 09/02/2014 15:45, Warren Young wrote: Results: /bin/cppcheck.exe This intrigued me. cppcheck is a static analyser, so what's it doing with getpwent()? I had a nosy in the source code, and it appears that cppcheck has a rule checking for POSIX calls that are not re-entrant. If a call to

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

2014-02-08 Thread Corinna Vinschen
On Feb 7 21:49, Lavrentiev, Anton (NIH/NLM/NCBI) [C] wrote: I think SAM/AD will be mostly quicker I do not want to be a party pooper here, but have you checked how the AD approach will work from the unmanaged Windows service accounts? No, and I fail to see how this is related to the

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

2014-02-08 Thread Warren Young
On Feb 7, 2014, at 5:40 PM, Andrey Repin anrdae...@yandex.ru wrote: I thought the point of the programme /was/ to call getpwnam() a million times. Precisely. In either case, repeatedly requesting the same record in a short amount of time will only test the system level cache. If that were

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

2014-02-08 Thread Warren Young
On Feb 8, 2014, at 8:19 AM, Warren Young war...@etr-usa.com wrote: On Feb 7, 2014, at 5:40 PM, Andrey Repin anrdae...@yandex.ru wrote: In either case, repeatedly requesting the same record in a short amount of time will only test the system level cache. If that were true, moving the

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

2014-02-08 Thread Lavrentiev, Anton (NIH/NLM/NCBI) [C]
and I fail to see how this is related to the on-the-fly generation of passwd and group entries Well, if a cygwin app was run under such an account, it might be affected, that's all... Anton Lavrentiev Contractor NIH/NLM/NCBI -- Problem reports: http://cygwin.com/problems.html FAQ:

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

2014-02-07 Thread Corinna Vinschen
On Feb 6 14:43, Warren Young wrote: On 2/6/2014 07:13, Corinna Vinschen wrote: Btw., it would be a good idea to get rid of calls to getpwent/getgrent in future. They *probably* won't do anymore what they were supposed to do if you don't have passwd/group files. There must be a way to

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

2014-02-07 Thread Andrey Repin
Greetings, Corinna Vinschen! In some of these systems, you can edit /etc/foo and run a command to manually sync that content back to the real user info DB. (e.g. the BSDs) In others, direct edits to these files are ignored, but the OS syncs a subset of changes to the user info DB to these

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

2014-02-07 Thread David Stacey
On 07/02/2014 09:49, Corinna Vinschen wrote: On Feb 6 14:43, Warren Young wrote: On 2/6/2014 07:13, Corinna Vinschen wrote: Btw., it would be a good idea to get rid of calls to getpwent/getgrent in future. They*probably* won't do anymore what they were supposed to do if you don't have

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

2014-02-07 Thread Warren Young
On 2/7/2014 05:49, Andrey Repin wrote: LDAP IS simple. Anything tied to a PKI is going to be pretty complex, no matter how simple the underlying tech is. Then there's the fact that LDAP derives from X.500, a prototypically overengineered OSI emission. DC=my,DC=sub,DC=domain,DC=com.

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

2014-02-07 Thread Warren Young
On 2/7/2014 06:53, David Stacey wrote: On 07/02/2014 09:49, Corinna Vinschen wrote: On Feb 6 14:43, Warren Young wrote: I know a guy who currently has all of Cygwin downloaded and ready to re-install, to test this.:) Try this: strings -f/bin/*.exe/bin/*.dll | grep getgrent Let me save you

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

2014-02-07 Thread Corinna Vinschen
On Feb 7 10:51, Warren Young wrote: On 2/7/2014 06:53, David Stacey wrote: On 07/02/2014 09:49, Corinna Vinschen wrote: On Feb 6 14:43, Warren Young wrote: I know a guy who currently has all of Cygwin downloaded and ready to re-install, to test this.:) Try this: strings

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

2014-02-07 Thread Warren Young
On 2/7/2014 02:49, Corinna Vinschen wrote: On Feb 6 14:43, Warren Young wrote: On 2/6/2014 07:13, Corinna Vinschen wrote: it would, of course, be possible to implement Cygwin command line tools along the lines of useradd/usermod/groupdel. For AD, they would just have to use LDAP, If by

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

2014-02-07 Thread Andrey Repin
Greetings, Warren Young! LDAP IS simple. Anything tied to a PKI is going to be pretty complex, no matter how simple the underlying tech is. Then there's the fact that LDAP derives from X.500, a prototypically overengineered OSI emission. DC=my,DC=sub,DC=domain,DC=com. P'tui! Well,

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

2014-02-07 Thread Warren Young
On 2/7/2014 13:09, Warren Young wrote: I want getpwent() and friends to remain available, but to switch to AD/SAM as primary, like OS X does all the time, I just realized that this means getpwent() turns into an AD database linear scan at AD sites. Hmmm... I think I'm still in favor of

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

2014-02-07 Thread Corinna Vinschen
On Feb 7 13:25, Warren Young wrote: On 2/7/2014 13:09, Warren Young wrote: I want getpwent() and friends to remain available, but to switch to AD/SAM as primary, like OS X does all the time, I just realized that this means getpwent() turns into an AD database linear scan at AD sites.

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

2014-02-07 Thread Corinna Vinschen
On Feb 7 13:09, Warren Young wrote: On 2/7/2014 02:49, Corinna Vinschen wrote: On Feb 6 14:43, Warren Young wrote: On 2/6/2014 07:13, Corinna Vinschen wrote: it would, of course, be possible to implement Cygwin command line tools along the lines of useradd/usermod/groupdel. For AD, they

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

2014-02-07 Thread Larry Hall (Cygwin)
On 2/7/2014 3:09 PM, Warren Young wrote: This takes 7.1 seconds on my system, with a 12-line /etc/passwd file: #include pwd.h #include stdio.h #include stdlib.h int main(int argc, const char* argv[]) { int i; const char* user = argv[1];

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

2014-02-07 Thread Lavrentiev, Anton (NIH/NLM/NCBI) [C]
I think SAM/AD will be mostly quicker I do not want to be a party pooper here, but have you checked how the AD approach will work from the unmanaged Windows service accounts? We've been experiencing rather nasty effects of the M$ design that when a host changes its password (it is required to,

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

2014-02-07 Thread David Stacey
On 07/02/14 21:44, Larry Hall (Cygwin) wrote: On 2/7/2014 3:09 PM, Warren Young wrote: This takes 7.1 seconds on my system, with a 12-line /etc/passwd file: #include pwd.h #include stdio.h #include stdlib.h int main(int argc, const char* argv[]) { int

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

2014-02-07 Thread Larry Hall (Cygwin)
On 2/7/2014 5:45 PM, David Stacey wrote: On 07/02/14 21:44, Larry Hall (Cygwin) wrote: On 2/7/2014 3:09 PM, Warren Young wrote: This takes 7.1 seconds on my system, with a 12-line /etc/passwd file: #include pwd.h #include stdio.h #include stdlib.h int main(int argc,

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

2014-02-07 Thread Andrey Repin
Greetings, Larry Hall (Cygwin)! This takes 7.1 seconds on my system, with a 12-line /etc/passwd file: #include pwd.h #include stdio.h #include stdlib.h int main(int argc, const char* argv[]) { int i; const char* user = argv[1];

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

2014-02-06 Thread Warren Young
On 2/6/2014 07:13, Corinna Vinschen wrote: Btw., it would be a good idea to get rid of calls to getpwent/getgrent in future. They *probably* won't do anymore what they were supposed to do if you don't have passwd/group files. There must be a way to list an executable's DLL imports, and