[cron-config] Possible issue with administrators group ?

Eric Blake eblake@redhat.com
Thu May 31 16:18:00 GMT 2012

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}$"

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 620 bytes
Desc: OpenPGP digital signature
URL: <http://cygwin.com/pipermail/cygwin/attachments/20120531/13291a8e/attachment.sig>

More information about the Cygwin mailing list