This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [cron-config] Possible issue with administrators group ?


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]