On Jul 21, 2008, at 2:19 PM, Russell Jackson wrote:
> Luke Kanies wrote:
>> On Jul 21, 2008, at 2:08 PM, Russell Jackson wrote:
>>
>>> Luke Kanies wrote:
>>>> On Jul 21, 2008, at 1:33 PM, Russell Jackson wrote:
>>>>
>>>>> Luke Kanies wrote:
>>>>>> On Jul 18, 2008, at 4:55 PM, Russell Jackson wrote:
>>>>>>
>>>>>>> I've had a number of instances where simply doing a grep '$
>>>>>>> {service-
>>>>>>> name}' winds up giving
>>>>>>> a false positive. Example:
>>>>>>>
>>>>>>> $ ps auxww | grep -v grep | grep acpid
>>>>>>> root 15 0.0 0.0 0 0 ? S< Jul11 0:00
>>>>>>> [kacpid]
>>>>>>>
>>>>>>> acpid isn't running, but the kacpid kernel thread makes puppet
>>>>>>> think
>>>>>>> it is; so, it keeps
>>>>>>> running service acpid stop on every run. Of course, to top it
>>>>>>> off,
>>>>>>> the centos4 init script
>>>>>>> always returns a zero exit status value.
>>>>>>>
>>>>>>> Suggested fix: use the pattern '\<${service-name}\>' instead.
>>>>>>>
>>>>>>> Can anyone think of a case where this wouldn't work as intended?
>>>>>> What does that regex do? I'm not familiar enough with grep, I
>>>>>> guess.
>>>>>>
>>>>> '\<' and '\>' match the empty string before and after,
>>>>> respectively,
>>>>> a word. For example,
>>>>> '\<foo\>' will match 'foo' but not 'foobar' or 'afoo'
>>>> I dont think we can safely assume that all of the executables
>>>> will be
>>>> running with whitespace; matching on word boundaries would make
>>>> more
>>>> sense so that, for instance, we matched '/usr/bin/puppetd', not
>>>> just
>>>> 'puppetd'.
>>>>
>>> It does match word boundaries rather than white space.
>>>
>>> I was just reading my ruby book. The '\b' anchor in ruby is
>>> equivalent to '\<' or '\>' in
>>> grep, but it doesn't care if it's the beginning or end of a word
>>> like the grep version(s) do.
>>
>> Ah, that sounds great, then. Sounds like a good patch.
>>
>
> Sounds like you're ever so subtly asking me to grind out the
> patch ;-).
Well, anyone in the "not me" category works fine for me. :)
--
Health nuts are going to feel stupid someday, lying in hospitals dying
of nothing. --Redd Foxx
---------------------------------------------------------------------
Luke Kanies | http://reductivelabs.com | http://madstop.com
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Puppet Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/puppet-dev?hl=en
-~----------~----~----~----~------~----~------~--~---