This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: Testers needed: New passwd/group handling in Cygwin
- From: Warren Young <warren at etr-usa dot com>
- To: cygwin at cygwin dot com
- Date: Sun, 16 Feb 2014 03:30:56 -0700
- Subject: Re: Testers needed: New passwd/group handling in Cygwin
- Authentication-results: sourceware.org; auth=none
- References: <20140213143849 dot GH2246 at calimero dot vinschen dot de> <52FD63BC dot 60800 at etr-usa dot com> <20140214104243 dot GY2246 at calimero dot vinschen dot de> <52FE786F dot 9040203 at etr-usa dot com> <20140215125043 dot GK2246 at calimero dot vinschen dot de>
On Feb 15, 2014, at 5:50 AM, Corinna Vinschen wrote:
> I grabbed all of this including your followup
> change shamelessly and added it to the text.
Happy to provide it.
>> It seems to me that we really only need a single Boolean setting:
>>
>> ignore_db=true
>
> No, that's not right. We have two mechanisms implemented you can
> choose three out of four possible combinations:
>
> files only
> db only
> files, then db
Yes, I realize that.
While composing the previous email, I considered a 2-Boolean design:
ignore_db=false
ignore_files=false
I rejected that design when I realized that ignore_files is redundant with respect to /etc/foo file existence. If the files are present, use them. If not, you have a DB-only configuration.
I consider it an advantage of this design that it is not possible for the files to be present but ignored. It avoids confusion, both human and software.
A person modifying /etc/passwd expects the change to take immediate effect. (Obviously SAM or AD could mask it, but…)
Software that scans /etc/passwd expects that the data found within have relevance to system operation.
The nonsense configuration — ignore files *and* ignore DB — is still possible to achieve with the 1-Boolean design. Set ignore_db=true and remove the /etc files. Cygwin should simply treat this as a “DB-only” configuration, since that’s the only place it *can* get answers.
> It drops any check for existence, too, which
> is one code point less which has to run for each getpwXXX/getgrXXX
> invocation.
Cygwin should check for file existence at the process tree start, where it reads /etc/nsswitch.conf. If the files are missing at that time, set the “ignore_files” flag.
Cygwin should use that flag instead of explicit file existence tests for the same reason it doesn’t keep re-reading nsswitch.conf. If the files are missing at process tree start, then later created, you have to create a new process tree for the new files to be used.
This is no sacrifice. If you use a 2-Boolean design, you only end up in the code fork where file checking is done if ignore_files == false. That means there is no point to checking for file existence explicitly. Just blindly try to read the files; if the file is missing, the open will fail, so your check is implicit in the attempt.
--
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