develooper Front page | perl.perl5.porters | Postings from May 2018

[perl #133152] Cygwin build failure with v5.27.11-16-g71e845c342

Thread Previous | Thread Next
Tony Cook via RT
May 2, 2018 01:50
[perl #133152] Cygwin build failure with v5.27.11-16-g71e845c342
Message ID:
On Tue, 01 May 2018 11:56:06 -0700, wrote:
> Karl Williamson writes:
> >> You'd have to ask someone who knows the details of how the feature
> >> test
> >> macros work, probably Yaakov Selkowitz.  And no, I don't think you
> >> should redefine any macros that are already existing.
> >
> > So a potential fix for this is to not fortify the source for this
> > platform?
> No, the platform default is FORTIFY_SOURCE=2 adn I'd not veer from it
> for such a key piece of the whole.  I haven't yet had the chance to
> look
> into what exactly happens, but at least until the recently released
> 5.26.2 fortification was possible and produced no such errors; that
> was
> using the same Cygwin and compiler version I think.

There's two issues here:

1) cygwin declares fgetws() when stdlib.h is included, but that name isn't reserved to the implementation unless wchar.h is included (C11 7.1.3)

So a C program that defines a fgetws() function but doesn't include wchar.h would be conforming, but this would break if stdlib.h is included, making cygwin non-conforming.

But I wouldn't be too surprised to find other implementations leak in similar ways.

2) Perl includes wchar.h which uses the FILE type (you're meant to #include stdio.h to use the I/O functions with the C standard[2], but POSIX requires wchar.h to define the FILE type), but nostdio.h defines a macro FILE, using a named reserved to the implementation[1].

I think the real fix is probably to eliminate nostdio.h - its use of reserved names leads to random issues as we update perl and as platforms update their implementations.

The attached patch doesn't remove nostdio.h, it just prevents perlio.h from including it.


[1] we use some other names more indirectly reserved, eg. nostdio.h defines _CANNOT and __STDIO_LOADED

[2] I couldn't find wording for that, but every I/O function
synopsis in C11 that I looked at for wchar.h includes stdio.h then wchar.h

via perlbug:  queue: perl5 status: open

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About