** Description changed:

  The only feature used by dpkg-awk beyond those required by POSIX is
  'delete array'. This extension is supported by all awk variants
  currently in Debian, i.e. by gawk, mawk, and original-awk. Attached diff
  drops dependency on gawk. The first version of the patch replaced
  dependency on gawk with dependency on virtual package awk provided by
  all of the above awk packages, but packages shouldn't depend on awk
  according to Debian policy: awk is essential albeit virtual, the only
  package that depends on it is base-files.
  
  Note however that unsetting environment variable POSIXLY_CORRECT in
  /usr/bin/dpkg-awk is still needed because otherwise if gawk is
  configured as default awk it treats 'delete array' as an error (see
  debbugs #170375).
  
  Note also that debbugs #64146 and #64358 aroused out of a mistake: the
  previous Debian maintainer of dpkg-awk forgot to replace gawk with awk
  in /usr/bin/dpkg-awk when trying to drop dependency on gawk in dpkg-awk
  1.0.0.
  
  Actually, 'delete array' is supported even by Plan 9 awk that gets
  installed by package 9base as /usr/lib/plan9/bin/awk and doesn't provide
  awk in Debian.
  
  But if POSIX compatibility must be retained by all means, the following
  patch should also be applied. It replaces 'delete array' with
  'split("",array)'. In this case, 'unset POSIXLY_CORRECT' in /usr/bin
  /dpkg-awk obviously isn't needed anymore.
  
+ ----------------------------------------
  diff --git a/dpkg-awk.awk b/dpkg-awk.awk
  index 7669c40..cf00c43 100644
  --- a/dpkg-awk.awk
  +++ b/dpkg-awk.awk
  @@ -86,7 +86,7 @@ BEGIN {
  
    if (options["debug"] >= 1)
     print "ARGV[0]='" ARGV[0] "'\n"
  -     delete ARGV
  +     split("", ARGV)
    if (options["debug"] >= 1)
     for (a in options)
      print "options[" a "]='" options[a] "'\n"
  @@ -99,8 +99,8 @@ function my_split(input, output,
    a, b, fields, save0)
  
   {
  -     delete output
  -     delete fields
  +     split("", output)
  +     split("", fields)
    save0 = $0
    $0 = input
    num_fields = split(input, fields, "\n")
+ ----------------------------------------
+ 
+ However, to make dpkg-awk work with very old gawk (<= 3.0.3) or with
+ some other ancient awk variants like nawk from the Heirloom Toolchest
+ (http://heirloom.sourceforge.net/tools.html) which is derived from
+ original Unix code released by Caldera
+ (http://unixtools.sourceforge.net) this patch still isn't enough. Those
+ awk variants don't like '=' at the start of a regular expression. If
+ there's a need I can add a patch that fixes it.

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

Title:
  Dependency on gawk should be dropped

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/dpkg-awk/+bug/1092539/+subscriptions

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

Reply via email to