X-Recipient: archive-cygwin@delorie.com
X-SWARE-Spam-Status: No, hits=-3.4 required=5.0	tests=BAYES_00,KHOP_THREADED,RCVD_IN_DNSWL_NONE,RCVD_IN_HOSTKARMA_YE,SPF_HELO_PASS
X-Spam-Check-By: sourceware.org
Message-ID: <4FC7AF0C.2060103@dyximaq.de>
Date: Thu, 31 May 2012 19:49:00 +0200
From: Dirk Sondermann <ds-cygwin@dyximaq.de>
User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:12.0) Gecko/20120428 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>	<4FC76383.4030607@redhat.com> <CANs8wdAxczSi5cp_49u4FPY+UqmssvUXv=+UMTDARi0yRDX8qw@mail.gmail.com>
In-Reply-To: <CANs8wdAxczSi5cp_49u4FPY+UqmssvUXv=+UMTDARi0yRDX8qw@mail.gmail.com>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
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

On 31.05.2012 15:45, AZ 9901 wrote:
> 2012/5/31 Eric Blake <eblake@redhat.com>:
>> 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.
> 
> OK, I was also thinking about this (talking about buggy output) but I
> was not sure.
> Strange that using grep -iq "^${username}$" works fine (well, I just
> tested this on my XP).

This works because the current version of grep (2.6.3-1) doesn't treat
its input as binary by default, but strips the carriage returns from
the output of net localgroup. So grep -iq "^${username}$" matches, but
grep --binary -iq "^${username}$" doesn't.

> Do Windows tools output in DOS mode "when they want" ?

No, od -c shows the \r\n endings in the output of net localgroup.

--Dirk

--
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

