Close

grep

There are certain things sysadmins rely on a lot. If they break it’s really not good. For me, the grep tool is one of them, so I was surprised to find inconsistent results. Based on otherwise good advice I was trying to use grep -i '[p]rocess' to look for running processes. When it didn’t work correctly I discovered related bugs 28981 (includes a good test case) and 36567 so that for us in our environment grep fails when:

  • trying to match upper case data (lower case matched ok)
  • using dash i for case insensitive
  • using square brackets as above
  • LANG was set with UTF8

Evidently this has been a problem for a while. Though fixed upstream the fix hasn’t made it’s way to all production Linux environments, making the use of this common trick a bit risky in production.

What other problems have you encountered that you choose to code around?

We meet at Bobby G’s Pizzeria on the second and fourth Sundays of each month from Noon to 3PM in Berkeley near the Downtown Berkeley BART station. Bobby G’s is on University Ave near Shattuck Ave. We hope you join us, join the discussion on our email list and/or join us in #berkeleylug on freenode.net by following the tabs at the top.

Leave a Reply