[tlbuild] dvibook failure on Cygwin

Paul Vojta vojta at math.berkeley.edu
Sat Feb 25 20:27:19 CET 2012


On Sat, Feb 25, 2012 at 01:30:47PM -0500, Ken Brown wrote:
> On 2/25/2012 11:45 AM, Ken Brown wrote:
> >On 2/24/2012 6:01 PM, Ken Brown wrote:
> >>On 2/24/2012 5:35 PM, Karl Berry wrote:
> >>>Hi Ken,
> >>>
> >>>Something is seriously wrong with getopt (from kpathsea) on Cygwin.
> >>>
> >>>And always has been, and just never been noticed before?
> >>>Possible, I suppose, but doesn't seem especially likely.
> >>
> >>You're right, of course. I'm not seeing any problem except in dvibook.
> >>But I have no idea what could be preventing getopt from working properly
> >>in dvibook, and I can't make any sense out of what I saw under gdb.
> >>Maybe Peter will think of something.
> >
> >Problem solved: the programs that use getopt need to include more
> >kpathsea headers. I don't know yet exactly which one(s) or why, but I
> >simply added `#include <kpathsea/kpathsea.h>' to dvibook.c (and the
> >other files in the seetexk directory that use getopt), and now all tests
> >pass.
> >
> >I'll look more carefully and figure out which header(s) are actually
> >needed. I'll also check the rest of the texlive tree.
> >
> >Interestingly, adding this #include caused the familiar warning about
> >the redeclaration of optarg, optind, etc., to appear in the compilation
> >of these programs. Previously the warning wasn't there for the programs
> >in seetexk.
> >
> >I'll send a patch once I have a clearer idea of what's going on.
> 
> OK, it turns out that <kpathsea/c-unistd.h> is the header that is
> needed, and it is only needed because it includes the system header
> <unistd.h>.  (The latter includes the system header <getopt.h>; this
> explains the redeclaration warnings.)
> 
> I don't understand why we need unistd.h (and why only on Cygwin) in
> order for kpathsea's getopt to work right.  So I'll hold off on
> sending a patch, in the hope that someone can explain this.
> 
> Ken

One possibility is that the sizes of the argument types in the prototype
for getopt are different when c-unistd.h is included compared with when it
is not.  Have you checked that?

(That sort of thing was what caused the bug with 64-bit versions of xetex
in TL 2009, and also caused a bug in luatex at one point.  I'd be very
interested if anybody knows of a lint-like tool that can systematically
detect such occurrences.)

--Paul Vojta, vojta at math.berkeley.edu


More information about the tlbuild mailing list