public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: cygwin@cygwin.com
Subject: Re: [cron-config] Possible issue with administrators group ?
Date: Thu, 31 May 2012 16:18:00 -0000	[thread overview]
Message-ID: <4FC76383.4030607@redhat.com> (raw)
In-Reply-To: <CANs8wdAu05j3ayXE=oNqOb4seRb4ogEyCMq+4eKC+rk5G9g9FA@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1042 bytes --]

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


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 620 bytes --]

  reply	other threads:[~2012-05-31 13:06 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-29 16:17 AZ 9901
2012-05-31 13:45 ` AZ 9901
2012-05-31 16:18   ` Eric Blake [this message]
2012-05-31 17:49     ` AZ 9901
2012-05-31 17:56       ` Dirk Sondermann
2012-05-31 19:23         ` AZ 9901

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4FC76383.4030607@redhat.com \
    --to=eblake@redhat.com \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).