On Wed, Oct 23, 2019 at 08:35:04PM -0700, Russ Allbery wrote:
> gnubg 1.06.002-2 no longer builds with the latest debhelper, producing the
> following error message:
> 
>    dh_installman
> dh_installman: mv debian/gnubg/usr/share/man/man6/makeweights.6.gz.dh-new 
> debian/gnubg/usr/share/man/man6/makeweights.6: No such file or directory
> dh_installman: mv debian/gnubg/usr/share/man/man6/bearoffdump.6.gz.dh-new 
> debian/gnubg/usr/share/man/man6/bearoffdump.6: No such file or directory
> dh_installman: mv debian/gnubg/usr/share/man/man6/makebearoff.6.gz.dh-new 
> debian/gnubg/usr/share/man/man6/makebearoff.6: No such file or directory
> dh_installman: mv debian/gnubg/usr/share/man/man6/gnubg.6.gz.dh-new 
> debian/gnubg/usr/share/man/man6/gnubg.6: No such file or directory
> dh_installman: mv debian/gnubg/usr/share/man/man6/makehyper.6.gz.dh-new 
> debian/gnubg/usr/share/man/man6/makehyper.6: No such file or directory
> dh_installman: Aborting due to earlier error
> 
> I strongly suspect that this is a bug introduced in 12.7 with the change
> to use man-recode.  The slightly unusual thing about this package is that
> the upstream make install logic installs the man pages compressed, so
> they're already compressed when dh_installman finds them and it just tries
> to convert the character set.  My guess is that the previous man command
> used for this handles compressed man pages transparently, but man-recode
> does not.

Almost.  The handling of compressed pages as far as man --recode vs.
man-recode is much the same: both of them optionally accept compressed
input and always emit uncompressed output.  However, with man --recode,
dh_installman effectively did the following (I've removed the directory
parts of paths to make it easier to read):

  man -l --recode UTF-8 makeweights.6.gz >makeweights.6.gz.dh-new
  # makeweights.6.gz.dh-new is in fact uncompressed, despite the .gz
  rm -f makeweights.6.gz
  mv makeweights.6.gz.dh-new makeweights.6

... but with man-recode, it tries to do:

  man-recode --to-code UTF-8 --suffix .dh-new makeweights.6.gz
  # writes uncompressed page to makeweights.6.dh-new
  rm -f makeweights.6.gz
  mv makeweights.6.gz.dh-new makeweights.6

I'd suggest something like the following *untested* patch, which both
makes $manpage_tmp make more sense in man --recode mode and should make
it work properly in man-recode mode by bringing it into sync with the
actual output file names.

diff --git a/dh_installman b/dh_installman
index 0ec9996e..3a5b5c68 100755
--- a/dh_installman
+++ b/dh_installman
@@ -368,6 +368,7 @@ sub reencode_manpages {
        }
        for my $manpage (@manpages) {
                my $manpage_tmp = "${manpage}.dh-new";
+               $manpage_tmp =~ s/\.(gz|Z)\.dh-new$/.dh-new/;
                if (not $has_man_recode) {
                        my $manpage_cmd = ($manpage =~ m{^/}) ? $manpage : 
"./${manpage}";
                        doit({ stdout => $manpage_tmp }, 'man', '-l', 
'--recode', 'UTF-8', $manpage_cmd);

-- 
Colin Watson                                       [cjwat...@debian.org]

Reply via email to