delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2012/05/31/09:06:53

X-Recipient: archive-cygwin AT delorie DOT 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 AT redhat DOT 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 AT cygwin DOT com
Subject: Re: [cron-config] Possible issue with administrators group ?
References: <CANs8wdCCMC6R5Pzye67KJ2Oie728J7eq52kXd1Mh56Bn5ivS+Q AT mail DOT gmail DOT com> <CANs8wdAu05j3ayXE=oNqOb4seRb4ogEyCMq+4eKC+rk5G9g9FA AT mail DOT gmail DOT com>
In-Reply-To: <CANs8wdAu05j3ayXE=oNqOb4seRb4ogEyCMq+4eKC+rk5G9g9FA@mail.gmail.com>
OpenPGP: url=http://people.redhat.com/eblake/eblake.gpg
X-IsSubscribed: yes
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

--------------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 AT redhat DOT 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--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019