Subject: bug#16722: 24.3.50; `M-x man' does not handle case appropriately

From: Eli Zaretskii <[email-masked]>
Date: Fri, 25 Sep 2020 14:29:51 +0300

> From: Lars Ingebrigtsen <[email-masked]>
> Cc: Wolfgang Jenkner <[email-masked]>,  [email-masked]
> Date: Fri, 25 Sep 2020 12:21:07 +0200
> 
> Eli Zaretskii <[email-masked]> writes:
> 
> >> But `man -k' always works (to the extent we need it to) if the whatis
> >> database is correctly installed.
> >
> > No, it doesn't.  For example, it isn't supported with this clone:
> >
> >   http://sourceforge.net/projects/ezwinports/files/man-1.4-bin.zip/download
> >
> > And, as demonstrated in this bug report, it can backfire when the
> > database is not "correctly installed".
> 
> [email-masked] writes:
> 
> > I can't reproduce the problem here, as my cygwin's man -k prints only to
> > stderr in this case.  Does checking exit status help?
> 
> [...]
> 
> > -         (setq table (Man-parse-man-k)))
> > +           (when (eq 0
> > +                      (ignore-errors
> > +                        (call-process
> > +                         manual-program nil '(t nil) nil
> > +                         "-k" (concat (when (or Man-man-k-use-anchor
> > +                                                (string-equal prefix ""))
> > +                                        "^")
> > +                                      prefix))))
> > +              (setq table (Man-parse-man-k)))))
> 
> There was no followup on this patch, and I don't have a Windows system
> to test with.  Eli, would this patch fix the problem both with the
> uninstalled whereis database and the ezwinports version of man?

I can only test the ezwinports case: the code proposed by Noam will
cause that 'man' to return a non-zero exit status, so it sounds like
an okay solution for ezwinports.

The use case with uninstalled whatis database you could probably test
on your system, by moving the database aside or renaming it?

Thanks.