public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* UNIX groups in CYGWIN
@ 2012-06-11 16:16 Lavrentiev, Anton (NIH/NLM/NCBI) [C]
  2012-06-11 16:25 ` Eric Blake
  0 siblings, 1 reply; 5+ messages in thread
From: Lavrentiev, Anton (NIH/NLM/NCBI) [C] @ 2012-06-11 16:16 UTC (permalink / raw)
  To: cygwin

Hi,

I have been porting quite a bit of software from native UNIX environment to CYGWIN,
and despite there is a very elaborate UNIX group handling/mapping in CYGWIN, there
are still a few discrepancies I would like to note:

1. When a user is a member of multiple Windows groups, this fact is not reflected
   in /etc/group, which mkgroup creates upon installation.  This results in the
   user to have more groups in the run-time environment, than those than can be
   found using the getgrpnam() API (which supposedly should consult any of group-
   providing sources, but in reality seems to look up only /etc/group).

   Run-time:

   $ id uid=11606(lavr) gid=10513(Domain Users) groups=10513(Domain Users),555(Remote Desktop Users),545(Users),1009(NCBIusers)

   Yet getgrpnam() can obtain only the primary group (basically, from /etc/passwd):

   10513

   If I go ahead and manually add "lavr" to the respective groups in /etc/group (the required
   groups are there, just their membership lists are all empty) then the API begins to work
   correctly (and returns all groups).  This solution works well only if there are just
   a couple of users on the system, but for a large set it does not look practical.

   Can mkgroup do this for me?

2. Since Windows group names can embed spaces, the output of the "groups" shell command
   is unparsable in CYGWIN (scripting becomes problematic), because the space is used both
   in the group names (as obtained from Windows) and to delimit the group names in the groups'
   output:

$ groups | od -a
0000000   D   o   m   a   i   n  sp   U   s   e   r   s  sp   R   e   m
0000020   o   t   e  sp   D   e   s   k   t   o   p  sp   U   s   e   r
0000040   s  sp   U   s   e   r   s  sp   N   C   B   I   u   s   e   r
0000060   s  nl
0000062

    Perhaps CYGWIN could have used a tab to separate the group names?
    Or list each group on an individual line?

Thanks in advance for considering the above,

Anton Lavrentiev
Contractor NIH/NLM/NCBI


--
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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: UNIX groups in CYGWIN
  2012-06-11 16:16 UNIX groups in CYGWIN Lavrentiev, Anton (NIH/NLM/NCBI) [C]
@ 2012-06-11 16:25 ` Eric Blake
  2012-06-11 17:27   ` Andrew DeFaria
  0 siblings, 1 reply; 5+ messages in thread
From: Eric Blake @ 2012-06-11 16:25 UTC (permalink / raw)
  To: cygwin

[-- Attachment #1: Type: text/plain, Size: 1038 bytes --]

On 06/11/2012 10:13 AM, Lavrentiev, Anton (NIH/NLM/NCBI) [C] wrote:

> 2. Since Windows group names can embed spaces, the output of the "groups" shell command

'groups' is no longer a shell command, but an executable, for several
coreutils releases now.

>    is unparsable in CYGWIN (scripting becomes problematic), because the space is used both
>    in the group names (as obtained from Windows) and to delimit the group names in the groups'
>    output:

Such a proposal should be made to upstream coreutils, as it could
possibly be of benefit to more platforms than just cygwin.

>     Perhaps CYGWIN could have used a tab to separate the group names?

What's to say that 'TAB' won't be valid in a group name?

>     Or list each group on an individual line?

An option to request alternative output format (whether that be
line-separated, or even NUL-byte separated) might indeed be more palatable.

-- 
Eric Blake   eblake@redhat.com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 620 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: UNIX groups in CYGWIN
  2012-06-11 16:25 ` Eric Blake
@ 2012-06-11 17:27   ` Andrew DeFaria
  2012-06-11 19:09     ` David Boyce
  0 siblings, 1 reply; 5+ messages in thread
From: Andrew DeFaria @ 2012-06-11 17:27 UTC (permalink / raw)
  To: cygwin

On 6/11/2012 9:25 AM, Eric Blake wrote:
>>      Perhaps CYGWIN could have used a tab to separate the group names?
> What's to say that 'TAB' won't be valid in a group name?
What's to say that any characters won't be valid in a name? Nothing. You 
gotta pick something and start somewhere..
-- 
Andrew DeFaria <http://defaria.com>
Enter any 11-digit prime number to continue...


--
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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: UNIX groups in CYGWIN
  2012-06-11 17:27   ` Andrew DeFaria
@ 2012-06-11 19:09     ` David Boyce
  2012-06-19 13:28       ` Lavrentiev, Anton (NIH/NLM/NCBI) [C]
  0 siblings, 1 reply; 5+ messages in thread
From: David Boyce @ 2012-06-11 19:09 UTC (permalink / raw)
  To: cygwin

On Mon, Jun 11, 2012 at 1:26 PM, Andrew DeFaria wrote:
> On 6/11/2012 9:25 AM, Eric Blake wrote:
>>>
>>>     Perhaps CYGWIN could have used a tab to separate the group names?
>>
>> What's to say that 'TAB' won't be valid in a group name?
>
> What's to say that any characters won't be valid in a name? Nothing. You
> gotta pick something and start somewhere..

Why not allow (and generate with mkgroup) URL encoding e.g. "Domain%20Users"?

--
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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: UNIX groups in CYGWIN
  2012-06-11 19:09     ` David Boyce
@ 2012-06-19 13:28       ` Lavrentiev, Anton (NIH/NLM/NCBI) [C]
  0 siblings, 0 replies; 5+ messages in thread
From: Lavrentiev, Anton (NIH/NLM/NCBI) [C] @ 2012-06-19 13:28 UTC (permalink / raw)
  To: cygwin

> Why not allow (and generate with mkgroup) URL encoding e.g.
> "Domain%20Users"?

Good idea that'd hopefully work, too!

Anton Lavrentiev
Contractor NIH/NLM/NCBI

--
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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-06-19 13:28 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-11 16:16 UNIX groups in CYGWIN Lavrentiev, Anton (NIH/NLM/NCBI) [C]
2012-06-11 16:25 ` Eric Blake
2012-06-11 17:27   ` Andrew DeFaria
2012-06-11 19:09     ` David Boyce
2012-06-19 13:28       ` Lavrentiev, Anton (NIH/NLM/NCBI) [C]

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).