From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13693 invoked by alias); 14 Mar 2014 12:03:53 -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 13679 invoked by uid 89); 14 Mar 2014 12:03:52 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.6 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx24.belgacom.be Received: from mx24.belgacom.be (HELO mx24.belgacom.be) (213.181.45.234) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 14 Mar 2014 12:03:49 +0000 Received: from a05192.bgc.net ([10.120.129.141]) by mx24.belgacom.be with ESMTP; 14 Mar 2014 13:03:47 +0100 X-TM-IMSS-Message-ID:<6ffb83bc000f4568@belgacom.be> Received: from A04027.BGC.NET ([10.121.135.24]) by belgacom.be ([10.120.129.141]) with ESMTP (TREND IMSS SMTP Service 7.1; TLSv1/SSLv3 AES128-SHA (128/128)) id 6ffb83bc000f4568 ; Fri, 14 Mar 2014 13:03:47 +0100 Received: from A04066.BGC.NET ([10.121.135.37]) by A04027.BGC.NET ([10.121.135.24]) with mapi id 14.03.0169.001; Fri, 14 Mar 2014 13:03:47 +0100 From: "PANEL Vincent (CIS/SIN)" To: "cygwin@cygwin.com" Subject: RE: Getting groups you belong to in perl Date: Fri, 14 Mar 2014 13:05:00 -0000 Message-ID: <09C6BA32B7B1654B8AB0CAF234F2A1C114E65FAE@A04066.BGC.NET> References: <09C6BA32B7B1654B8AB0CAF234F2A1C114E65CBA@A04066.BGC.NET> <1797360578.20140314023749@yandex.ru> Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-IsSubscribed: yes X-SW-Source: 2014-03/txt/msg00245.txt.bz2 From: Andrey Repin[] Sent: Thursday 13 March 2014 23:38 To: PANEL Vincent (CIS/SIN); Subject: Re: Getting groups you belong to in perl >Greetings, PANEL Vincent (CIS/SIN)! >> Don't know if this list is more appropriate than the Perl one but my >> question is actually about porting a Perl script to Cygwin. I need to >> check if the current user running the script belongs to a pre-defined gr= oup. >> Under *nix, I get the list of users belonging to the group and see if >> the current user is in this list. >How exactly you are doing this? (I hope you're not reading it from >/etc/group, because that file may not exist at all, or contain exactly >zero relevant >information.) I'm using standard perl commands (getgrnam, getlogin, etc... : http://perld= oc.perl.org/5.14.2/functions/getgrnam.html) which are probably using standa= rd C libraries in the background (I hope). The doc explicitly says "The $me= mbers value returned by getgr*() is a space-separated list of the login nam= es of the members of the group" but it's always empty under Cygwin. >> Cygwin doesn't allow this way of working. >Oh... ? Yes indeed, the standard perl functions work but they always return an empt= y list of group members, similar to mkgroup. >> I found out by reading the thread "Why mkgroup does not list group membe= rs?" >> on this mailing list (1 message on Mon, 13 May 2013 20:29:52, for instan= ce). >> I would like to use perl commands without launching external >> commands, if possible. The way I've found until now is by using the outp= ut of the "id" >> command but I was wondering if there was another way to do it. How is "i= d" >> command working by the way ? >You can check the sources of it, it's really a very simple tool. >(It's coreutils, by the way. >http://mirrors.kernel.org/sourceware/cygwin/x86/release/coreutils/ ) I will do it. -- WBR, Andrey Repin () 14.03.2014, <02:12> Sorry for my terrible english... ________________________________ ***** Disclaimer ***** http://www.belgacom.be/maildisclaimer -- 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