X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-1.2 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL,SPF_HELO_PASS,TW_MK,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org X-IronPortListener: Outbound_SMTP X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av0EADkZ1k+cKEcV/2dsb2JhbABFtRiBB4IfEihRARUnAi8TFwEOAQQbEweHaZcuhEWcNpAtYAOMfI4XigaCfA From: "Lavrentiev, Anton (NIH/NLM/NCBI) [C]" To: "cygwin AT cygwin DOT com" Date: Mon, 11 Jun 2012 12:13:55 -0400 Subject: UNIX groups in CYGWIN Message-ID: Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id q5BGl58x002535 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