* Croxell, Jeffrey [2015-08-24 22:23 +0000]:
> Package: debianutils
> Version: 4.4+b1
> Severity: important
> Tags: d-i
>
>    * What led up to the situation?
>    Using cdebootstrap-static with a limited local mirror.
>    The local mirror included 'gawk'.
>    It appeared to be a race condition - gawk installed after debianutils.
>    Adding 'mawk' allows debianutils to install successfully
>    * What exactly did you do (or not do) that was effective (or
>      ineffective)?
>     Added mawk to local mirror.
>    * What was the outcome of this action?
>    Mawk by chance gets installed first
>    * What outcome did you expect instead?
>    Since debianutils 'add-shell' uses 'awk' it should have an explicit
>    dependency on awk

awk is used to append missing newlines in the file's last line.

The (pre-)dependencies of the essential packages on each other
and on awk are complicated, but in theory (i.e., if debootstrap and
cdebootstrap would be that smart), adding a dependency on awk would
work for now.  Just for the record, either the policy or the consensus
among Debian developers says that dependencies on awk are not required.

If add-shell would create a missing /etc/shells on its first invocation
(I think it should, because of “… core functionality of essential
packages …” and “… avoiding dependencies between essential packages …”),
then a (pre-)dependency on awk wouldn't help at all since the shells
could drop their dependencies on debianutils.


Instead of adding this dependency, I think add-shell should use an
alternative to “awk '{print}'” instead.

Ways to append missing newlines to a file read from stdin with only
essential packages and their dependencies installed include:

  * awk '{print}'
  * sed "\$a\\" # shellcheck complains if single quotes are used
  * grep '^'
  * a hundred ways to do this in Perl
  * paste
  * a shell loop using read -r and printf (error prone implementation)

Embedded people might remove Perl and paste, doing this in a shell loop
would be ugly and awk is pre-dependency of an essential package, but not
essential itself.  The remaining tools are sed and grep.  I'd tend to
grep since add-shell already uses grep.  I wonder if grep '^' and
sed "\$a\\" are guaranteed to work as I expect or if this behaviour
is either undefined or buggy in some implementations.


Carsten

Reply via email to