Public bug reported:

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?

** Affects: resolvconf (Ubuntu)
     Importance: Undecided
         Status: New

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

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

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

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to