[Bug 996435] Re: resolvconf uses awk but doesn't Depend on it

Thomas Hood 996435 at bugs.launchpad.net
Tue May 8 11:11:02 UTC 2012


** Summary changed:

- resolvconf uses awk bug doesn't Depend on it
+ resolvconf uses awk but doesn't Depend on it

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to resolvconf in Ubuntu.
https://bugs.launchpad.net/bugs/996435

Title:
  resolvconf uses awk but doesn't Depend on it

Status in “resolvconf” package in Ubuntu:
  New

Bug description:
  After the latest bugfix (in versions 1.63ubuntu13 and 1.65ubuntu2) the
  difference between the Debian and Ubuntu lsattr-checking code in
  resolvconf.postinst is this:

  
  -echo_first_arg() { echo "$1" ; }
   is_immutable_file() {
   	[ "$1" ] || return 2
   	[ -e "$1" ] || return 1
   	[ ! -L "$1" ] || return 1
  -	which lsattr >/dev/null 2>&1 || return 2
  -	echo_first_arg $(lsattr "$1") | grep -sq i
  +
  +	ATTR=$(lsattr "$1" 2>/dev/null)
  +	[ -z "$ATTR" ] && return 1
  +	echo $ATTR | awk '$1 ~ /i/ { exit 0; }; { exit 1; }'
   }
   

  It isn't obvious to me why grep was replaced with awk here.  The
  resulting code is slower and not much more readable, so why change it?

  To suppress lsattr error messages it would have sufficed to do this:

  -	echo_first_arg $(lsattr "$1") | grep -sq i
  +	echo_first_arg $(lsattr "$1" 2>/dev/null) | grep -sq i

  I'll include this change in the next Debian version; but if you can
  explain to me why the awk code is better then I'll adopt that.

  A remaining issue is that the resolvconf package doesn't Depend on awk
  and awk is not Essential (although it is Depended upon by base-files
  which is Essential). Is this a problem?

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/resolvconf/+bug/996435/+subscriptions




More information about the foundations-bugs mailing list