www.delorie.com/archives/browse.cgi | search |
X-Recipient: | archive-cygwin AT delorie DOT com |
DomainKey-Signature: | a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id |
:list-unsubscribe:list-subscribe:list-archive:list-post | |
:list-help:sender:from:to:subject:date:message-id:references | |
:content-type:content-transfer-encoding:mime-version; q=dns; s= | |
default; b=iu0OgLmUFGQlC9m75TYvP6b9mbxyQ+AXw12otx0a9Cjkt89wwJYy1 | |
W9K3lYlYyxWOxCgHeRUwuVC9QbFo4fvkowF0U/D6u7NDY6l+vDVpLMVwhQA7uqnP | |
+5k8wypcrUmOBPU3cd8zFU1nDTWgGUrlZg7NTdxswZJNpLZUBl8hxU= | |
DKIM-Signature: | v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id |
:list-unsubscribe:list-subscribe:list-archive:list-post | |
:list-help:sender:from:to:subject:date:message-id:references | |
:content-type:content-transfer-encoding:mime-version; s=default; | |
bh=/LvIZY9v++LPfo7G4OCY+fdRTJY=; b=Ny3MAT7D+TiwNNWmBjgtsxFdUV/l | |
cHkzhDTdv5gkzntdm+gkRCuVNzEoPQwnKNmwjvMlNrX8aaZf+Vt2D9sqZdo7uhpc | |
PO2hy/Vs8JnOtp5TRCFAG3oLcRtpu6aKH69eCOZIaW2Eq5XDubRhCyDFR3zL/uQn | |
K7ERTlcJRCwIpFE= | |
Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
List-Id: | <cygwin.cygwin.com> |
List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
List-Archive: | <http://sourceware.org/ml/cygwin/> |
List-Post: | <mailto:cygwin AT cygwin DOT com> |
List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> |
Sender: | cygwin-owner AT cygwin DOT com |
Mail-Followup-To: | cygwin AT cygwin DOT com |
Delivered-To: | mailing list cygwin AT cygwin DOT com |
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 |
X-TM-IMSS-Message-ID:<6ffb83bc000f4568 AT belgacom DOT be> : | |
From: | "PANEL Vincent (CIS/SIN)" <Vincent DOT Panel AT belgacom DOT be> |
To: | "cygwin AT cygwin DOT com" <cygwin AT cygwin DOT com> |
Subject: | RE: Getting groups you belong to in perl |
Date: | Fri, 14 Mar 2014 12:03:46 +0000 |
Message-ID: | <09C6BA32B7B1654B8AB0CAF234F2A1C114E65FAE@A04066.BGC.NET> |
References: | <09C6BA32B7B1654B8AB0CAF234F2A1C114E65CBA AT A04066 DOT BGC DOT NET> <1797360578 DOT 20140314023749 AT yandex DOT ru> |
MIME-Version: | 1.0 |
X-IsSubscribed: | yes |
X-MIME-Autoconverted: | from quoted-printable to 8bit by delorie.com id s2EC45wW004183 |
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 group. >> 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://perldoc.perl.org/5.14.2/functions/getgrnam.html) which are probably using standard C libraries in the background (I hope). The doc explicitly says "The $members value returned by getgr*() is a space-separated list of the login names 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 empty list of group members, similar to mkgroup. >> I found out by reading the thread "Why mkgroup does not list group members?" >> on this mailing list (1 message on Mon, 13 May 2013 20:29:52, for instance). >> I would like to use perl commands without launching external >> commands, if possible. The way I've found until now is by using the output of the "id" >> command but I was wondering if there was another way to do it. How is "id" >> 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
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |