[Pkg-sysvinit-devel] Bug#631077: typo in /etc/network/if-up.d/mountnfs

Chris Dunlop chris at onthe.net.au
Thu Nov 24 05:24:21 UTC 2011


On Mon, Jun 20, 2011 at 10:55:17AM +0200, Milan Kocian wrote:
> hello,
> 
> may be I am wrong and it's problem with grep. I see this problem only with
> newest grep package:
> 
> root at ntm:~# grep --version
> grep (GNU grep) 2.8
> Copyright (C) 2011 Free Software Foundation, Inc.
> License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
> This is free software: you are free to change and redistribute it.
> There is NO WARRANTY, to the extent permitted by law.
> 
> Written by Mike Haertel and others, see <http://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>.
> 
> 
> root at ntm:/etc/apt# grep "^[:space:]*auto" /etc/network/interfaces
> grep: character class syntax is [[:space:]], not [:space:]
> 
> 
> Older versions of grep  seems ok.

It's definately a bug in the script, not grep: the newer grep is simply
reporting what must be a common problem. The script is trying to allow
for possible spaces at the beginning of the line, but failing.... with
the incorrect regular expression:

  echo "auto" | grep "^[:space:]*auto"       # works
  auto

  echo " auto" | grep "^[:space:]*auto"      # doesn't work

And with the proper regular expression:

  echo " auto" | grep "^[[:space:]]*auto"    # works
   auto

  echo "auto" | grep "^[[:space:]]*auto"     # works
  auto

Of course it's only going to bite people that have an 'auto' line that
starts with spaces but if they do then this problem is will cause them a
problem that's very hard to track down!

Cheers,

Chris





More information about the Pkg-sysvinit-devel mailing list