Hi Colin,
  Thanks for the report. I first copied dh-exec-install-rename from dh-exec
0.23.4 and compiled OpenSSL fine. The odd thing is that 0.23.4 was out but
0.24 was on Salsa but never released. 0.25 was just an update of the Salsa
version and 0.26 was the re-introduction of the patches for 0.23.4.
Anyway, 0.26 is on Salsa and is the current version.

A diff between these files showed only a few lines to a) cater for
dh-exec-install-move and fix Bug #831786

I thought it had to do with the move side of things but it turns out it was
the fix that was the issue!
I commented out the following in /usr/share/dh-exec/dh-exec-install-rename

if (defined ($ENV{"DH_INTERNAL_OPTIONS"}) &&
    $ENV{"DH_INTERNAL_OPTIONS"} =~ /-[ai]/) {
    $noop = 0;
}

I'm not really sure why this causes the problem, but it definitely sets
something off.

 - Craig



On Fri, 12 Aug 2022 at 00:56, Colin Watson <cjwat...@debian.org> wrote:

> Control: clone -1 -2
> Control: reassign -2 dh-exec
> Control: retitle -2 dh-exec-install-rename sometimes moves rather than
> copies
>
> On Fri, Jul 29, 2022 at 08:40:48PM +0200, Lucas Nussbaum wrote:
> > During a rebuild of all packages in sid, your package failed to build
> > on amd64.
> >
> >
> > Relevant part (hopefully):
> > > make[1]: Entering directory '/<<PKGBUILDDIR>>'
> > > # Remove version control tags to avoid unnecessary conffile
> > > # resolution steps for administrators.
> > > sed -i '/\$OpenBSD:/d' \
> > >     debian/tmp/etc/ssh/moduli \
> > >     debian/tmp/etc/ssh/ssh_config \
> > >     debian/tmp/etc/ssh/sshd_config
> > > dh_install -Nopenssh-client-udeb -Nopenssh-server-udeb
> > > dh_install -popenssh-client-udeb -popenssh-server-udeb \
> > >     --sourcedir=debian/build-udeb
> > > Failed to copy 'etc/ssh/sshd_config': No such file or directory at
> /usr/share/dh-exec/dh-exec-install-rename line 68, <> line 7.
> > > dh_install: error: debian/openssh-server.install (executable config)
> returned exit code 127
> > > make[1]: *** [debian/rules:163: override_dh_install-arch] Error 25
>
> This seems to be a dh-exec regression, and when I fixed that I ran into
> additional regressions behind it.  I'm a bit confused at this point.
> You should be able to reproduce all these problems by building openssh
> 1:9.0p1-1.  All this used to work with dh-exec 0.23.4 - see e.g.:
>
>
> https://buildd.debian.org/status/fetch.php?pkg=openssh&arch=amd64&ver=1%3A9.0p1-1%2Bb1&stamp=1652555012&raw=0
>
> https://launchpadlibrarian.net/598976391/buildlog_ubuntu-kinetic-amd64.openssh_1%3A9.0p1-1_BUILDING.txt.gz
>
> The first problem here is that dh_install is run multiple times, and the
> first one moves a file out of debian/tmp/ when it's only supposed to
> copy.  This looks like a simple typo in dh-exec-install-rename; it tries
> to copy from a couple of different paths, but for the second one it
> calls "move" rather than "cp", which is surely just a mistake.  Patch
> for that follows:
>
> diff --git a/lib/dh-exec-install-rename b/lib/dh-exec-install-rename
> index 06fe885..2c269e8 100755
> --- a/lib/dh-exec-install-rename
> +++ b/lib/dh-exec-install-rename
> @@ -66,9 +66,9 @@ if (/([^\s]*)\s+=>\s+([^\s]*)/ || /^=>\s+([^\s]*)/) {
>                  die "Failed to move '$src': $!";
>          } else {
>              cp ($src, File::Spec->catfile ($debpath, $dstfile)) or
> -                move (File::Spec->catfile ("debian/tmp", $src),
> -                      File::Spec->catfile ($debpath, $dstfile)) or
> -                      die "Failed to copy '$src': $!";
> +                cp (File::Spec->catfile ("debian/tmp", $src),
> +                    File::Spec->catfile ($debpath, $dstfile)) or
> +                    die "Failed to copy '$src': $!";
>          }
>      }
>
>
> The second dh_install command does the same copies even though it isn't
> supposed to be processing those packages, which is when we hit the
> failure.  Horrible, but maybe that's just how debhelper handles
> executable config files and dh-exec doesn't get much choice?  Not sure.
> (Relatedly, though it doesn't affect openssh, how can
> dh-exec-install-move possibly work properly if every dh_install run will
> end up moving files regardless of whether it's operating on the package
> in question?)
>
> After applying the above fix, the build gets further, and I get to:
>
>    dh_missing
> dh_missing: warning:
> dh-exec.aqR1q_B1/etc/ufw/applications.d/openssh-server exists in debian/tmp
> but is not installed to anywhere (related file:
> "debian/tmp/dh-exec._KAY3sIj/etc/ufw/applications.d/openssh-server")
> dh_missing: warning:
> dh-exec.aqR1q_B1/usr/share/apport/package-hooks/openssh-server.py exists in
> debian/tmp but is not installed to anywhere (related file:
> "debian/tmp/dh-exec._KAY3sIj/usr/share/apport/package-hooks/openssh-server.py")
> dh_missing: warning: dh-exec.aqR1q_B1/usr/share/openssh/sshd_config exists
> in debian/tmp but is not installed to anywhere (related file:
> "debian/tmp/dh-exec._KAY3sIj/usr/share/openssh/sshd_config")
> dh_missing: warning: dh-exec.aqR1q_B1/usr/share/openssh/sshd_config.md5sum
> exists in debian/tmp but is not installed to anywhere (related file:
> "debian/tmp/dh-exec._KAY3sIj/usr/share/openssh/sshd_config.md5sum")
> dh_missing: warning:
> dh-exec.eZqm_1C4/usr/share/apport/package-hooks/openssh-client.py exists in
> debian/tmp but is not installed to anywhere (related file:
> "debian/tmp/dh-exec.eqEKo0TP/usr/share/apport/package-hooks/openssh-client.py")
> dh_missing: warning: dh-exec.slLLJC8v/usr/lib/openssh/gnome-ssh-askpass
> exists in debian/tmp but is not installed to anywhere (related file:
> "debian/tmp/dh-exec.kGOu1t93/usr/lib/openssh/gnome-ssh-askpass")
> dh_missing: warning: etc/ssh/sshd_config exists in debian/tmp but is not
> installed to anywhere (related file:
> "debian/tmp/dh-exec._KAY3sIj/usr/share/openssh/sshd_config")
> dh_missing: error: missing files, aborting
>
>         While detecting missing files, dh_missing noted some files with a
> similar name to those
>         that were missing.  This error /might/ be resolved by replacing
> references to the
>         missing files with the similarly named ones that dh_missing found
> - assuming the content
>         is identical.
>
>         As an example, you might want to replace:
>          *
> debian/tmp/dh-exec._KAY3sIj/etc/ufw/applications.d/openssh-server
>         with:
>          * dh-exec.aqR1q_B1/etc/ufw/applications.d/openssh-server
>         in a file in debian/ or as argument to one of the dh_* tools
> called from debian/rules.
>         (Note it is possible the paths are not used verbatim but instead
> directories
>         containing or globs matching them are used instead)
>
>         Alternatively, add the missing file to debian/not-installed if it
> cannot and should not
>         be used.
>
>         The following debhelper tools have reported what they installed
> (with files per package)
>          * dh_install: openssh-client (27), openssh-client-udeb (3),
> openssh-server (14), openssh-server-udeb (2), openssh-sftp-server (2),
> openssh-tests (10), ssh (0), ssh-askpass-gnome (2)
>          * dh_installdocs: openssh-client (4), openssh-server (0),
> openssh-sftp-server (0), openssh-tests (0), ssh (0), ssh-askpass-gnome (0)
>          * dh_installexamples: openssh-client (0), openssh-server (1),
> openssh-sftp-server (0), openssh-tests (0), ssh (0), ssh-askpass-gnome (1)
>          * dh_installman: openssh-client (2), openssh-server (0),
> openssh-sftp-server (0), openssh-tests (0), ssh (0), ssh-askpass-gnome (1)
>         If the missing files are installed by another tool, please file a
> bug against it.
>         When filing the report, if the tool is not part of debhelper
> itself, please reference the
>         "Logging helpers and dh_missing" section from the "PROGRAMMING"
> guide for debhelper (10.6.3+).
>           (in the debhelper package:
> /usr/share/doc/debhelper/PROGRAMMING.gz)
>         Be sure to test with dpkg-buildpackage -A/-B as the results may
> vary when only a subset is built
>         If the omission is intentional or no other helper can take care of
> this consider adding the
>         paths to debian/not-installed.
>
> All those debian/tmp/dh-exec.* temporary directories are confusing
> dh_missing, it seems.  I'm not quite sure what's going on here since
> this used to work.  What's the intended design for these temporary
> directories?  Presumably they can't be cleaned up by
> dh-exec-install-rename itself because the files still need to be
> processed by dh_install proper.
>
> That leaves the dh_missing warning for etc/ssh/sshd_config.  That is in
> fact installed - it's just that
> debian/.debhelper/generated/openssh-server/installed-by-dh_install lists
> it as ./debian/tmp/dh-exec._KAY3sIj/usr/share/openssh/sshd_config rather
> than as the original file name.  What are we supposed to do here?  This
> seems like it must be a bug somewhere between debhelper and dh-exec, but
> I'm not sure exactly where.
>
> For now I'm going to work around this in openssh as follows:
>
> diff --git a/debian/openssh-server.install b/debian/openssh-server.install
> index 99cfb8d6b..cf86dce41 100755
> --- a/debian/openssh-server.install
> +++ b/debian/openssh-server.install
> @@ -7,7 +7,7 @@ usr/share/man/man5/moduli.5
>  usr/share/man/man5/sshd_config.5
>  usr/share/man/man8/sshd.8
>
> -etc/ssh/sshd_config => usr/share/openssh/sshd_config
> +debian/tmp/etc/ssh/sshd_config => usr/share/openssh/sshd_config
>  debian/openssh-server.ucf-md5sum => usr/share/openssh/sshd_config.md5sum
>
>  debian/openssh-server.ufw.profile => etc/ufw/applications.d/openssh-server
> diff --git a/debian/rules b/debian/rules
> index d5a9ee23d..5a8795478 100755
> --- a/debian/rules
> +++ b/debian/rules
> @@ -203,6 +203,10 @@ override_dh_runit:
>  execute_after_dh_fixperms-arch:
>         chmod u+s debian/openssh-client/usr/lib/openssh/ssh-keysign
>
> +# Work around debhelper/dh-exec bug #XXX.
> +override_dh_missing:
> +       dh_missing --list-missing
> +
>  # Tighten libssl dependencies to match the check in entropy.c.
>  execute_after_dh_shlibdeps:
>         debian/adjust-openssl-dependencies
>
> But this all seems quite weird.  Do you have any clues as to any of
> this?
>
> Thanks,
>
> --
> Colin Watson (he/him)                              [cjwat...@debian.org]
>

Reply via email to