[Pkg-xen-devel] [PATCH 03/12] debian/rules: Fix binary shuffling script for cross-building

Elliott Mitchell ehem+debian at m5p.com
Thu Sep 17 23:24:53 BST 2020


On Thu, Sep 17, 2020 at 04:58:03PM +0100, Ian Jackson wrote:
> Elliott Mitchell writes ("[PATCH 03/12] debian/rules: Fix binary shuffling script for cross-building"):
> > `ldd` doesn't work with cross-builds, so use `file` to detect scripts
> > and `strings | grep` for identifying linked libraries.
> 
> How sad that ldd doesn't work.  I approve of the change to use file,
> although maybe that should have a change to build-depends.  (Right now
> it seems that debhelper depends on file so this is a theoretical bug
> rather than a FTBFS-on-buildd issue.)

I checked this before switching to `file`.

> > Script almost conforms to POSIX shell standard, so adjust to conform and
> > switch to /bin/sh.  Simplify pipe structure, do more work in parent
> > shell.
> 
> I'm sorry to say that I don't agree with this.  What made you think
> there was anything undesirable about using bash in a build system ?

Guess general principle mostly.  `bash` isn't as heavyweight as CC, but
Linux has done a good job demonstrating keeping your eyes on the small
bits does result in significant payoffs.

I've been finding the limitations imposed by the smaller number of
features in Bourne shell often force simplifications which turn out to be
beneficial in the end.

For some larger shell scripts, arrays are an extremely useful feature.
For a small script like this, keeping it simpler is rather more valuable.

> >  set -e
> > -set -o pipefail
> 
> This, in particular, has quite adverse impacts on error handling.
> Also you have reformatted the script.  Reformatting things is usually
> to be discouraged.

/bin/sh lacks `set -o pipefail`.  Often simplifying pipelines increases
their reliability rather more than using pipefail.

Portions were reformatted to match their new positions.  Notably the
previous version had that large inner loop which was greatly shrunk in
this patch.

I will confess I did end up renaming "$binary" to "$exec" and perhaps
that should be undone.


-- 
(\___(\___(\______          --=> 8-) EHM <=--          ______/)___/)___/)
 \BS (    |         ehem+sigmsg at m5p.com  PGP 87145445         |    )   /
  \_CS\   |  _____  -O #include <stddisclaimer.h> O-   _____  |   /  _/
8A19\___\_|_/58D2 7E3D DDF4 7BA6 <-PGP-> 41D1 B375 37D0 8714\_|_/___/5445





More information about the Pkg-xen-devel mailing list