Skip Menu |

This queue is for tickets about the Socket CPAN distribution.

Report information
The Basics
Id: 124044
Status: resolved
Priority: 0/
Queue: Socket

People
Owner: Nobody in particular
Requestors: ppisar [...] redhat.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 2.025
Fixed in: 2.026



Subject: Compiler warnings
gcc-7.2.1 reports these two warnings when building with perl-5.26.1: gcc -c -D_REENTRANT -D_GNU_SOURCE -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORT IFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc- switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat- annobin-cc1 -m64 -mtune=generic -fwrapv -fno-strict-aliasing -I/usr/local/include -D_LARGE FILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -DVERSION=\"2.025\" -DXS_VERSION=\"2.025\" -fPIC "-I/usr/lib64/perl5/CORE" -DHAS_GAI_STRERROR -DI_NETINET_IP Socket.c In file included from /usr/lib64/perl5/CORE/perl.h:28:0, from Socket.xs:3: /usr/lib64/perl5/CORE/config.h:2884:0: warning: "HAS_GAI_STRERROR" redefined #define HAS_GAI_STRERROR /**/ <command-line>:0:0: note: this is the location of the previous definition Socket.xs: In function 'XS_Socket_pack_sockaddr_un': Socket.xs:829:11: warning: format '%d' expects argument of type 'int', but argument 2 has type 'STRLEN {aka long unsigned int}' [-Wformat=] warn("Path length (%d) is longer than maximum supported length" ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Socket.xs:829:11: warning: format '%d' expects argument of type 'int', but argument 3 has type 'long unsigned int' [-Wformat=] The HAS_GAI_STRERROR redefinition could be solved by not supplying it explicitly. It looks like Perl already knows if it's available. The format warnings could be fixed by changing "%d" formatter into "%lld". Recent C standard recognizes "%zu" for size_t type, but I think that Perl sticks to older C standard.
On Wed Jan 10 03:50:44 2018, ppisar wrote: Show quoted text
> The HAS_GAI_STRERROR redefinition could be solved by not supplying it > explicitly. It looks like Perl already knows if it's available.
Yup, it was just missing the corresponding %Config key name in the Makefile.PL Show quoted text
> The format warnings could be fixed by changing "%d" formatter into > "%lld". Recent C standard recognizes "%zu" for size_t type, but I > think that Perl sticks to older C standard.
UVuf and (UV)-casting. Both fixed in attached patch. -- Paul Evans
Subject: rt124044.patch
=== modified file 'Makefile.PL' --- Makefile.PL 2018-01-08 20:07:01 +0000 +++ Makefile.PL 2018-01-11 22:47:53 +0000 @@ -80,7 +80,7 @@ # -Dfoo func() $Config{key} HAS_GETADDRINFO => [ "getaddrinfo", "d_getaddrinfo" ], HAS_GETNAMEINFO => [ "getnameinfo", "d_getnameinfo" ], - HAS_GAI_STRERROR => [ "gai_strerror" ], + HAS_GAI_STRERROR => [ "gai_strerror", "d_gai_strerror" ], HAS_INET_ATON => [ "inet_aton", "d_inetaton" ], HAS_INETNTOP => [ "inet_ntop", "d_inetntop" ], HAS_INETPTON => [ "inet_pton", "d_inetpton" ], === modified file 'Socket.xs' --- Socket.xs 2018-01-08 22:43:12 +0000 +++ Socket.xs 2018-01-11 22:39:17 +0000 @@ -826,8 +826,9 @@ sun_ad.sun_family = AF_UNIX; pathname_pv = SvPV(pathname,len); if (len > sizeof(sun_ad.sun_path)) { - warn("Path length (%d) is longer than maximum supported length" - " (%d) and will be truncated", len, sizeof(sun_ad.sun_path)); + warn("Path length (%" UVuf ") is longer than maximum supported length" + " (%" UVuf ") and will be truncated", + (UV)len, (UV)sizeof(sun_ad.sun_path)); len = sizeof(sun_ad.sun_path); } # ifdef OS2 /* Name should start with \socket\ and contain backslashes! */
Subject: Re: [rt.cpan.org #124044] Compiler warnings
Date: Fri, 12 Jan 2018 07:27:53 +0100
To: Paul Evans via RT <bug-Socket [...] rt.cpan.org>
From: Petr Pisar <ppisar [...] redhat.com>
On Thu, Jan 11, 2018 at 05:51:31PM -0500, Paul Evans via RT wrote: Show quoted text
> On Wed Jan 10 03:50:44 2018, ppisar wrote:
> > The HAS_GAI_STRERROR redefinition could be solved by not supplying it > > explicitly. It looks like Perl already knows if it's available.
> > Yup, it was just missing the corresponding %Config key name in the Makefile.PL >
> > The format warnings could be fixed by changing "%d" formatter into > > "%lld". Recent C standard recognizes "%zu" for size_t type, but I > > think that Perl sticks to older C standard.
> > UVuf and (UV)-casting. > > Both fixed in attached patch. >
Thanks. It fixes both issues for me. -- Petr
Download signature.asc
application/pgp-signature 228b

Message body not shown because it is not plain text.

Released -- Paul Evans