Skip to content

cpan/Socket - Update to version 2.039 #23387

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: blead
Choose a base branch
from

Conversation

jkeenan
Copy link
Contributor

@jkeenan jkeenan commented Jun 27, 2025

2.039   2025-06-25
        [BUGFIXES]
         * Make sure to invoke GETMAGIC on arguments to `pack_sockaddr_in` and
           `pack_sockaddr_in6` (RT166524)

    2.039   2025-06-25
            [BUGFIXES]
             * Make sure to invoke GETMAGIC on arguments to `pack_sockaddr_in` and
               `pack_sockaddr_in6` (RT166524)
@jkeenan jkeenan added the defer-next-dev This PR should not be merged yet, but await the next development cycle label Jun 27, 2025
@thibaultduponchelle thibaultduponchelle removed the defer-next-dev This PR should not be merged yet, but await the next development cycle label Jul 4, 2025
@jkeenan
Copy link
Contributor Author

jkeenan commented Jul 4, 2025

This merge request for cpan/Socket has failed one test on our Windows msvc 143 GH CI rig. Since it passed on our other Windows CI rig, I'm willing to merge, but I don't have access to Windows and so can't test this independently myself.

How should we proceed? @tonycoz, any recommendations?

@bulk88
Copy link
Contributor

bulk88 commented Jul 5, 2025

C:\sources\perl5\win32>cd ..\t && perl.exe harness -v  ../cpan/socket/t/sockaddr
.t   & cd ..\win32
../cpan/socket/t/sockaddr.t ..
1..52
ok 1 - inet_aton returns packed bytes
ok 2 - inet_ntoa from v-string
ok 3 - inet_aton->inet_ntoa roundtrip
ok 4 - inet_ntoa warns about wide characters
ok 5 - inet_pton AF_INET returns packed bytes
ok 6 - inet_ntop AF_INET from v-string
ok 7 - inet_pton->inet_ntop AF_INET roundtrip
ok 8 - inet_aton->inet_ntop AF_INET roundtrip
ok 9 - inet_ntop warns about wide characters
ok 10 - inet_pton AF_INET6 returns packed bytes
ok 11 - inet_ntop AF_INET6 from octet string
ok 12 - inet_pton->inet_ntop AF_INET6 roundtrip
ok 13 - sockaddr_family warns about argument length
ok 14 - pack_sockaddr_in defined
ok 15 - sockaddr_family of pack_sockaddr_in
ok 16 - pack_sockaddr_in->unpack_sockaddr_in port
ok 17 - pack_sockaddr_in->unpack_sockaddr_in addr
ok 18 - unpack_sockaddr_in in scalar context yields addr
ok 19 - sockaddr_in in list context unpacks
ok 20 - sockaddr_in in scalar context packs
ok 21 - pack_sockaddr_in undef addr is fatal
ok 22 - unpack_sockaddr_in undef is fatal
ok 23 - pack_sockaddr_in undef port is allowed
ok 24 - undefined values produced no warnings
ok 25 - pack_sockaddr_in oversized port is allowed
ok 26 - pack_sockaddr_in oversized port warning
ok 27 - pack_sockaddr_in invokes GETMAGIC on port argument
ok 28 # skip Cannot pack_sockaddr_in6()
ok 29 # skip Cannot pack_sockaddr_in6()
ok 30 # skip Cannot pack_sockaddr_in6()
ok 31 # skip Cannot pack_sockaddr_in6()
ok 32 # skip Cannot pack_sockaddr_in6()
ok 33 # skip Cannot pack_sockaddr_in6()
ok 34 # skip Cannot pack_sockaddr_in6()
ok 35 # skip Cannot pack_sockaddr_in6()
ok 36 # skip Cannot pack_sockaddr_in6()
ok 37 # skip Cannot pack_sockaddr_in6()
ok 38 # skip Cannot pack_sockaddr_in6()
ok 39 # skip Cannot pack_sockaddr_in6()
ok 40 # skip Cannot pack_sockaddr_in6()
ok 41 # skip Cannot pack_sockaddr_in6()
ok 42 # skip Cannot pack_sockaddr_in6()
ok 43 # skip Abstract AF_UNIX paths unsupported
# Looks like you planned 52 tests but ran 51.
ok 44 # skip Abstract AF_UNIX paths unsupported
ok 45 # skip Abstract AF_UNIX paths unsupported
ok 46 # skip Abstract AF_UNIX paths unsupported
ok 47 # skip Abstract AF_UNIX paths unsupported
ok 48 # skip Abstract AF_UNIX paths unsupported
ok 49 # skip Abstract AF_UNIX paths unsupported
ok 50 - sockaddr_in deprecated form doesn't warn without lexical warnings
ok 51 - sockaddr_in deprecated form warns with lexical warnings
Dubious, test returned 255 (wstat 65280, 0xff00)
Failed 1/52 subtests
        (less 22 skipped subtests: 29 okay)

Test Summary Report
-------------------
../cpan/socket/t/sockaddr.t (Wstat: 65280 (exited 255) Tests: 51 Failed: 0)
  Non-zero exit status: 255
  Parse errors: Bad plan.  You planned 52 tests but ran 51.
Files=1, Tests=51,  0 wallclock secs ( 0.02 usr +  0.00 sys =  0.02 CPU)
Result: FAIL
Finished test run at Fri Jul  4 23:27:56 2025.

C:\sources\perl5\win32>

built against the kid51 commit that failed the GH msvc 14.3 smoke runner

@bulk88
Copy link
Contributor

bulk88 commented Jul 5, 2025

# pack_sockaddr_in6, unpack_sockaddr_in6
# sockaddr_in6
SKIP: {
    skip "No AF_INET6", 16 unless my $AF_INET6 = eval { Socket::AF_INET6() };
    skip "Cannot pack_sockaddr_in6()", 16 unless my $sin6 = eval { Socket::pack_sockaddr_in6(0x1234, "0123456789abcdef", 0, 89) };

    ok(defined $sin6, 'pack_sockaddr_in6 defined');

15 is the value in the kid51 branch, changing 15 to 16 like shown above makes the .t pass for me, user error in the upstream package in writing

 cpan/Socket/t/sockaddr.t | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/cpan/Socket/t/sockaddr.t b/cpan/Socket/t/sockaddr.t
index 9b8318025a..58822d472a 100644
--- a/cpan/Socket/t/sockaddr.t
+++ b/cpan/Socket/t/sockaddr.t
@@ -12,7 +12,7 @@ use Socket qw(
     sockaddr_family
     sockaddr_un
 );
-use Test::More tests => 50;
+use Test::More tests => 52;
 
 # inet_aton, inet_ntoa
 {
@@ -99,6 +99,12 @@ SKIP: {
         'pack_sockaddr_in oversized port is allowed' );
     like( $warnings, qr/^Port number above 0xFFFF, will be truncated to 33229 for Socket::pack_sockaddr_in at /,
         'pack_sockaddr_in oversized port warning' );
+
+    # GETMAGIC is invoked (RT166524)
+    local $1;
+    "2057" =~ m/^(\d+)$/;
+    $sin = pack_sockaddr_in $1, inet_aton("10.20.30.40");
+    is( (unpack_sockaddr_in($sin))[0], 2057, 'pack_sockaddr_in invokes GETMAGIC on port argument' );
 }
 
 # pack_sockaddr_in6, unpack_sockaddr_in6
@@ -140,6 +146,12 @@ SKIP: {
         'pack_sockaddr_in6 oversized port is allowed' );
     like( $warnings, qr/^Port number above 0xFFFF, will be truncated to 33229 for Socket::pack_sockaddr_in6 at /,
         'pack_sockaddr_in6 oversized port warning' );
+
+    # GETMAGIC is invoked (RT166524)
+    local $1;
+    "2057" =~ m/^(\d+)$/;
+    $sin6 = Socket::pack_sockaddr_in6 $1, "0123456789abcdef";
+    is( (Socket::unpack_sockaddr_in6($sin6))[0], 2057, 'pack_sockaddr_in6 invokes GETMAGIC on port argument' );
 }
 
 # sockaddr_un on abstract paths

@jkeenan
Copy link
Contributor Author

jkeenan commented Jul 5, 2025

@bulk88, thanks for those reports. I've reported this problem upstream as https://rt.cpan.org/Ticket/Display.html?id=168005. You may wish to add data there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants