X-Recipient: archive-cygwin@delorie.com
X-SWARE-Spam-Status: No, hits=-10.3 required=5.0	tests=AWL,BAYES_00,KHOP_PGP_SIGNED,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_DNSWL_HI,RCVD_IN_HOSTKARMA_W,SPF_HELO_PASS,T_RP_MATCHES_RCVD
X-Spam-Check-By: sourceware.org
Message-ID: <4FC76383.4030607@redhat.com>
Date: Thu, 31 May 2012 06:26:43 -0600
From: Eric Blake <eblake@redhat.com>
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:12.0) Gecko/20120430 Thunderbird/12.0.1
MIME-Version: 1.0
To: cygwin@cygwin.com
Subject: Re: [cron-config] Possible issue with administrators group ?
References: <CANs8wdCCMC6R5Pzye67KJ2Oie728J7eq52kXd1Mh56Bn5ivS+Q@mail.gmail.com> <CANs8wdAu05j3ayXE=oNqOb4seRb4ogEyCMq+4eKC+rk5G9g9FA@mail.gmail.com>
In-Reply-To: <CANs8wdAu05j3ayXE=oNqOb4seRb4ogEyCMq+4eKC+rk5G9g9FA@mail.gmail.com>
OpenPGP: url=http://people.redhat.com/eblake/eblake.gpg
Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="------------enigE415AF1AF430DF4FECD33B3B"
X-IsSubscribed: yes
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com

--------------enigE415AF1AF430DF4FECD33B3B
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

On 05/31/2012 05:18 AM, AZ 9901 wrote:
> 2012/5/29 AZ 9901 :
>> Hello,
>>
>> I am looking at the /bin/cron-config script.
>>
>> Line 627, we can find :
>> elif net localgroup "${_admingroup}" | grep -Eiq "^${username}.?$"; then
>>
>> Why .? at the end of the regexp ? "^${username}.?$"

Because 'net' outputs in DOS mode, with carriage returns at the end.

>>
>> We could have problems if for example we already have "user1" in
>> administrators group, and cron user is "user2".
>> "user2" would then not be added to the administrators group.

Wouldn't that rather be "we could have problems if we already have
'user1', the output does not have carriage returns, and we are trying to
add 'user12'"?

> Any clue about this regexp ?

Since the trailing '.?' exists to strip carriage returns, would it be
any more robust to write this as:

net localgroup "${_admingroup}" | d2u | grep -Eiq "^${username}$"

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


--------------enigE415AF1AF430DF4FECD33B3B
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
Comment: Public key at http://people.redhat.com/eblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBCAAGBQJPx2ODAAoJEKeha0olJ0NqpA8H/R/hKT9Loq/G+R5FgyZqis+i
N1OLg/YRF3XhkG61IBaG6v7tviDEgFbA1s9eL0PLpFvopjalbXZUun0EHO4G0TJh
Z+FNer6JXNNGS1Tpl8dDxM1IpH0CPYksKT9QmSjbDtld9VZlsuiPYWNFFofhsqTk
FvU55xfK2NhPrQAacAaii0HBR2TOf4guvbjSclrxWmxYW8TgqDYdHYQqRHiz37j4
cw+Cg2BBNtixvrAnE11t6+Ds5kg8J1zksKntJnO36R3hfS+uNR58le8CyV2cqg57
HgIf9jsGZZgpYqZ2wZHjEEOaKmd2g6i+HaYzxLdsUnAgBSSVtNQQJIBwcLbDdl0=
=KR9J
-----END PGP SIGNATURE-----

--------------enigE415AF1AF430DF4FECD33B3B--
