Skip to content
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

op/pack.t FAIL on 32-bit archs (i386, arm32v5, arm32v7) #22618

Closed
zakame opened this issue Sep 21, 2024 · 3 comments · Fixed by #22619
Closed

op/pack.t FAIL on 32-bit archs (i386, arm32v5, arm32v7) #22618

zakame opened this issue Sep 21, 2024 · 3 comments · Fixed by #22619

Comments

@zakame
Copy link
Member

zakame commented Sep 21, 2024

Module:

Description
Hello from the @Perl/docker-team 👋 First off, thank you for the 5.41.4 release! 🎉

I got feedback from the Docker official-images team (cc @yosifkit) of a build failure on 32-bit archs (i386, arm32v5, and arm32v7) for the recent release of perl-5.41.4. Not sure if this is related to the recent pack() fixes as mentioned in https://metacpan.org/release/CONTRA/perl-5.41.4/view/pod/perldelta.pod#Selected-Bug-Fixes

Could be a failure in the test planning itself at around

XS::APItest::modify_pv($ptr, length $data);
as part of trying to fix #22380 (though some individual tests do pass,) per verbose testing of t/op/pack.t (e.g. make test_harness TEST_ARGS="-v" TEST_FILES="op/pack.t"):

Show output
90.13 TESTFILE=harness LD_LIBRARY_PATH=/usr/src/perl ./runtests choose
90.23 Use of uninitialized value in subroutine entry at op/pack.t line 355.
90.23 # Looks like you planned 14724 tests but ran 247.
90.23 op/pack.t .. 
90.23 1..14724
90.23 # $IsTwosComplement = 1
90.23 ok 1 - [at op/pack.t line 88]
90.23 ok 2 - [at op/pack.t line 95]
90.23 ok 3 - [at op/pack.t line 97]
90.23 ok 4 - [at op/pack.t line 103]
90.23 ok 5 - [at op/pack.t line 105]
90.23 ok 6 - [at op/pack.t line 107]
90.23 ok 7 - [at op/pack.t line 115]
90.23 ok 8 - [at op/pack.t line 125]
90.23 ok 9 - [at op/pack.t line 130]
90.23 # check 'w'
90.23 ok 10 - [at op/pack.t line 141]
90.23 ok 11 - [at op/pack.t line 147]
90.23 ok 12 - [at op/pack.t line 147]
90.23 ok 13 - [at op/pack.t line 147]
90.23 ok 14 - [at op/pack.t line 147]
90.23 ok 15 - [at op/pack.t line 147]
90.23 ok 16 - [at op/pack.t line 147]
90.23 ok 17 - [at op/pack.t line 147]
90.23 ok 18 - [at op/pack.t line 147]
90.23 ok 19 - [at op/pack.t line 147]
90.23 ok 20 - [at op/pack.t line 147]
90.23 ok 21 - [at op/pack.t line 147]
90.23 ok 22 - [at op/pack.t line 152]
90.23 ok 23 - [at op/pack.t line 153]
90.23 ok 24 - pack
90.23 ok 25 - [at op/pack.t line 166]
90.23 ok 26 - [at op/pack.t line 167]
90.23 ok 27 - [at op/pack.t line 168]
90.23 ok 28 - IV/NV arithmetic
90.23 ok 29 - [at op/pack.t line 178]
90.23 ok 30 - [at op/pack.t line 179]
90.23 ok 31 - IV/NV arithmetic
90.23 ok 32 - [at op/pack.t line 195]
90.23 ok 33 - [at op/pack.t line 196]
90.23 # test exceptions
90.23 ok 34 - [at op/pack.t line 205]
90.23 ok 35 - [at op/pack.t line 208]
90.23 ok 36 - [at op/pack.t line 211]
90.23 ok 37 - [at op/pack.t line 214]
90.23 ok 38 - [at op/pack.t line 217]
90.23 ok 39 - pack can h
90.23 ok 40 - pack can't h<
90.23 ok 41 - pack can't h>
90.23 ok 42 - pack can't h!
90.23 ok 43 - pack can't h<!
90.23 ok 44 - pack can't h>!
90.23 ok 45 - pack can't h!<
90.23 ok 46 - pack can't h!>
90.23 ok 47 - pack can H
90.23 ok 48 - pack can't H<
90.23 ok 49 - pack can't H>
90.23 ok 50 - pack can't H!
90.23 ok 51 - pack can't H<!
90.23 ok 52 - pack can't H>!
90.23 ok 53 - pack can't H!<
90.23 ok 54 - pack can't H!>
90.23 ok 55 - pack can s
90.23 ok 56 - pack can s<
90.23 ok 57 - pack can s>
90.23 ok 58 - pack can s!
90.23 ok 59 - pack can s<!
90.23 ok 60 - pack can s>!
90.23 ok 61 - pack can s!<
90.23 ok 62 - pack can s!>
90.23 ok 63 - pack can S
90.23 ok 64 - pack can S<
90.23 ok 65 - pack can S>
90.23 ok 66 - pack can S!
90.23 ok 67 - pack can S<!
90.23 ok 68 - pack can S>!
90.23 ok 69 - pack can S!<
90.23 ok 70 - pack can S!>
90.23 ok 71 - pack can i
90.23 ok 72 - pack can i<
90.23 ok 73 - pack can i>
90.23 ok 74 - pack can i!
90.23 ok 75 - pack can i<!
90.23 ok 76 - pack can i>!
90.23 ok 77 - pack can i!<
90.23 ok 78 - pack can i!>
90.23 ok 79 - pack can I
90.23 ok 80 - pack can I<
90.23 ok 81 - pack can I>
90.23 ok 82 - pack can I!
90.23 ok 83 - pack can I<!
90.23 ok 84 - pack can I>!
90.23 ok 85 - pack can I!<
90.23 ok 86 - pack can I!>
90.23 ok 87 - pack can l
90.23 ok 88 - pack can l<
90.23 ok 89 - pack can l>
90.23 ok 90 - pack can l!
90.23 ok 91 - pack can l<!
90.23 ok 92 - pack can l>!
90.23 ok 93 - pack can l!<
90.23 ok 94 - pack can l!>
90.23 ok 95 - pack can L
90.23 ok 96 - pack can L<
90.23 ok 97 - pack can L>
90.23 ok 98 - pack can L!
90.23 ok 99 - pack can L<!
90.23 ok 100 - pack can L>!
90.23 ok 101 - pack can L!<
90.23 ok 102 - pack can L!>
90.23 ok 103 - pack can q
90.23 ok 104 - pack can q<
90.23 ok 105 - pack can q>
90.23 ok 106 - pack can't q!
90.23 ok 107 - pack can't q<!
90.23 ok 108 - pack can't q>!
90.23 ok 109 - pack can't q!<
90.23 ok 110 - pack can't q!>
90.23 ok 111 - pack can Q
90.23 ok 112 - pack can Q<
90.23 ok 113 - pack can Q>
90.23 ok 114 - pack can't Q!
90.23 ok 115 - pack can't Q<!
90.23 ok 116 - pack can't Q>!
90.23 ok 117 - pack can't Q!<
90.23 ok 118 - pack can't Q!>
90.23 ok 119 - pack can j
90.23 ok 120 - pack can j<
90.23 ok 121 - pack can j>
90.23 ok 122 - pack can't j!
90.23 ok 123 - pack can't j<!
90.23 ok 124 - pack can't j>!
90.23 ok 125 - pack can't j!<
90.23 ok 126 - pack can't j!>
90.23 ok 127 - pack can J
90.23 ok 128 - pack can J<
90.23 ok 129 - pack can J>
90.23 ok 130 - pack can't J!
90.23 ok 131 - pack can't J<!
90.23 ok 132 - pack can't J>!
90.23 ok 133 - pack can't J!<
90.23 ok 134 - pack can't J!>
90.23 ok 135 - pack can f
90.23 ok 136 - pack can f<
90.23 ok 137 - pack can f>
90.23 ok 138 - pack can't f!
90.23 ok 139 - pack can't f<!
90.23 ok 140 - pack can't f>!
90.23 ok 141 - pack can't f!<
90.23 ok 142 - pack can't f!>
90.23 ok 143 - pack can F
90.23 ok 144 - pack can F<
90.23 ok 145 - pack can F>
90.23 ok 146 - pack can't F!
90.23 ok 147 - pack can't F<!
90.23 ok 148 - pack can't F>!
90.23 ok 149 - pack can't F!<
90.23 ok 150 - pack can't F!>
90.23 ok 151 - pack can d
90.23 ok 152 - pack can d<
90.23 ok 153 - pack can d>
90.23 ok 154 - pack can't d!
90.23 ok 155 - pack can't d<!
90.23 ok 156 - pack can't d>!
90.23 ok 157 - pack can't d!<
90.23 ok 158 - pack can't d!>
90.23 ok 159 - pack can D
90.23 ok 160 - pack can D<
90.23 ok 161 - pack can D>
90.23 ok 162 - pack can't D!
90.23 ok 163 - pack can't D<!
90.23 ok 164 - pack can't D>!
90.23 ok 165 - pack can't D!<
90.23 ok 166 - pack can't D!>
90.23 ok 167 - pack can p
90.23 ok 168 - pack can p<
90.23 ok 169 - pack can p>
90.23 ok 170 - pack can't p!
90.23 ok 171 - pack can't p<!
90.23 ok 172 - pack can't p>!
90.23 ok 173 - pack can't p!<
90.23 ok 174 - pack can't p!>
90.23 ok 175 - pack can P
90.23 ok 176 - pack can P<
90.23 ok 177 - pack can P>
90.23 ok 178 - pack can't P!
90.23 ok 179 - pack can't P<!
90.23 ok 180 - pack can't P>!
90.23 ok 181 - pack can't P!<
90.23 ok 182 - pack can't P!>
90.23 ok 183 - pack can n
90.23 ok 184 - pack can't n<
90.23 ok 185 - pack can't n>
90.23 ok 186 - pack can n!
90.23 ok 187 - pack can't n<!
90.23 ok 188 - pack can't n>!
90.23 ok 189 - pack can't n!<
90.23 ok 190 - pack can't n!>
90.23 ok 191 - pack can N
90.23 ok 192 - pack can't N<
90.23 ok 193 - pack can't N>
90.23 ok 194 - pack can N!
90.23 ok 195 - pack can't N<!
90.23 ok 196 - pack can't N>!
90.23 ok 197 - pack can't N!<
90.23 ok 198 - pack can't N!>
90.23 ok 199 - pack can v
90.23 ok 200 - pack can't v<
90.23 ok 201 - pack can't v>
90.23 ok 202 - pack can v!
90.23 ok 203 - pack can't v<!
90.23 ok 204 - pack can't v>!
90.23 ok 205 - pack can't v!<
90.23 ok 206 - pack can't v!>
90.23 ok 207 - pack can V
90.23 ok 208 - pack can't V<
90.23 ok 209 - pack can't V>
90.23 ok 210 - pack can V!
90.23 ok 211 - pack can't V<!
90.23 ok 212 - pack can't V>!
90.23 ok 213 - pack can't V!<
90.23 ok 214 - pack can't V!>
90.23 ok 215 - [at op/pack.t line 258]
90.23 ok 216 - [at op/pack.t line 261]
90.23 ok 217 - [at op/pack.t line 258]
90.23 ok 218 - [at op/pack.t line 261]
90.23 ok 219 - [at op/pack.t line 258]
90.23 ok 220 - [at op/pack.t line 261]
90.23 ok 221 - [at op/pack.t line 266]
90.23 ok 222 - [at op/pack.t line 269]
90.23 ok 223 - [at op/pack.t line 266]
90.23 ok 224 - [at op/pack.t line 269]
90.23 ok 225 - [at op/pack.t line 266]
90.23 ok 226 - [at op/pack.t line 269]
90.23 ok 227 - [at op/pack.t line 266]
90.23 ok 228 - [at op/pack.t line 269]
90.23 ok 229 - [at op/pack.t line 266]
90.23 ok 230 - [at op/pack.t line 269]
90.23 ok 231 - [at op/pack.t line 266]
90.23 ok 232 - [at op/pack.t line 269]
90.23 ok 233 - [at op/pack.t line 266]
90.23 ok 234 - [at op/pack.t line 269]
90.23 ok 235 - [at op/pack.t line 266]
90.23 ok 236 - [at op/pack.t line 269]
90.23 ok 237 - Cannot compress infinity
90.23 ok 238 - Should be able to pack 'w', 8.98846567431158e+307 \# 2**1023
90.23 ok 239 - Should be able to unpack 'w' the result of pack 'w', 8.98846567431158e+307 \# 2**1023
90.23 ok 240 - Round trip pack, unpack 'w' of 8.98846567431158e+307 is within 1% (0%)
90.23 # test the 'p' template
90.23 ok 241 - [at op/pack.t line 323]
90.23 ok 242 - [at op/pack.t line 325]
90.23 ok 243 - [at op/pack.t line 326]
90.23 ok 244 - [at op/pack.t line 329]
90.23 ok 245 - [at op/pack.t line 330]
90.23 ok 246 - [at op/pack.t line 331]
90.23 ok 247 - [at op/pack.t line 343]
90.23 Dubious, test returned 2 (wstat 512, 0x200)
90.23 Failed 14477/14724 subtests 
90.23 
90.23 Test Summary Report
90.23 -------------------
90.23 op/pack.t (Wstat: 512 (exited 2) Tests: 247 Failed: 0)
90.23   Non-zero exit status: 2
90.23   Parse errors: Bad plan.  You planned 14724 tests but ran 247.
90.23 Files=1, Tests=247,  0 wallclock secs ( 0.00 usr  0.00 sys +  0.02 cusr  0.00 csys =  0.02 CPU)
90.23 Result: FAIL
90.23 Finished test run at Sat Sep 21 18:27:57 2024.
90.23 make: *** [makefile:866: test_harness] Error 1
------

Steps to Reproduce
See docker-library/official-images#17600 (comment) for the relevant build logs. For local reproduction, this is possible via any 32-bit Docker builder (including 32-bit emulation under amd64) for example:

git clone https://github.com/Perl/docker-perl.git
cd docker-perl/5.041.004-slim-threaded-bookworm
docker builder build --platform linux/386 -t test-build-i386 .
[...]
179.2 ../lib/perl5db.t ..................................................... ok
180.0 ../lib/Unicode/UCD.t ................................................. ok
188.6 ../lib/Benchmark.t ................................................... ok
188.6 
188.6 Test Summary Report
188.6 -------------------
188.6 op/pack.t                                                          (Wstat: 512 (exited 2) Tests: 247 Failed: 0)
188.6   Non-zero exit status: 2
188.6   Parse errors: Bad plan.  You planned 14724 tests but ran 247.
188.6 Files=2889, Tests=1182964, 99 wallclock secs (55.50 usr 10.40 sys + 493.16 cusr 53.78 csys = 612.84 CPU)
188.6 Result: FAIL
188.7 Finished test run at Sat Sep 21 18:19:33 2024.
188.7 make: *** [makefile:866: test_harness] Error 1
[...]

Outside of Docker, building perl-5.41.4 through the standard sh Configure -des; make; make test_harness on an i386 system would suffice.

Expected behavior
Building perl-5.41.4 on 32-bit archs should succeed.

Perl configuration
N/A as perl did not build successfully 😿 ./myconfig output in lieu:

Show output
89.85 Summary of my perl5 (revision 5 version 41 subversion 4) configuration:
89.85    
89.85   Platform:
89.85     osname=linux
89.85     osvers=6.1.0-25-amd64
89.85     archname=i686-linux-gnu-thread-multi-64int
89.85     uname='linux buildkitsandbox 6.1.0-25-amd64 #1 smp preempt_dynamic debian 6.1.106-3 (2024-08-26) x86_64 gnulinux '
89.85     config_args='-Darchname=i686-linux-gnu -Duse64bitint -Dusethreads -Duseshrplib -Dvendorprefix=/usr/local -Dusedevel -Dversiononly=undef -des'
89.85     hint=recommended
89.85     useposix=true
89.85     d_sigaction=define
89.85     useithreads=define
89.85     usemultiplicity=define
89.85     use64bitint=define
89.85     use64bitall=undef
89.85     uselongdouble=undef
89.85     usemymalloc=n
89.85     default_inc_excludes_dot=define
89.85   Compiler:
89.85     cc='cc'
89.85     ccflags ='-D_REENTRANT -D_GNU_SOURCE -fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2'
89.85     optimize='-O2'
89.85     cppflags='-D_REENTRANT -D_GNU_SOURCE -fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include'
89.85     ccversion=''
89.85     gccversion='12.2.0'
89.85     gccosandvers=''
89.85     intsize=4
89.85     longsize=4
89.85     ptrsize=4
89.85     doublesize=8
89.85     byteorder=12345678
89.85     doublekind=3
89.85     d_longlong=define
89.85     longlongsize=8
89.85     d_longdbl=define
89.85     longdblsize=12
89.85     longdblkind=3
89.85     ivtype='long long'
89.85     ivsize=8
89.85     nvtype='double'
89.85     nvsize=8
89.85     Off_t='off_t'
89.85     lseeksize=8
89.85     alignbytes=4
89.85     prototype=
89.85   Linker and Libraries:
89.85     ld='cc'
89.85     ldflags =' -fstack-protector-strong -L/usr/local/lib'
89.85     libpth=/usr/local/lib /usr/lib/i386-linux-gnu /usr/lib
89.85     libs=-lpthread -ldl -lm -lcrypt -lutil -lc
89.85     perllibs=-lpthread -ldl -lm -lcrypt -lutil -lc
89.85     libc=/lib/i386-linux-gnu/libc.so.6
89.85     so=so
89.85     useshrplib=true
89.85     libperl=libperl.so
89.85     gnulibc_version='2.36'
89.85   Dynamic Linking:
89.85     dlsrc=dl_dlopen.xs
89.85     dlext=so
89.85     d_dlsymun=undef
89.85     ccdlflags='-Wl,-E -Wl,-rpath,/usr/local/lib/perl5/5.41.4/i686-linux-gnu-thread-multi-64int/CORE'
89.85     cccdlflags='-fPIC'
89.85     lddlflags='-shared -O2 -L/usr/local/lib -fstack-protector-strong'
89.85 

Will follow-up with further reproductions when able.

mauke added a commit to mauke/perl5 that referenced this issue Sep 21, 2024
This test tries to get the integer representation of a pointer via
unpack 'j', pack 'P'. But an IV is not necessarily the same size as a
pointer. In particular, on 32-bit platforms with -Duse64bitint we have
sizeof (IV) == 8 and sizeof (void *) == 4, which makes unpack 'j' fail
(the input string is too short) and return undef.

Work around the issue by checking for the most common pointer sizes (4
and 8 bytes) and selecting an appropriate integer unpack format. In all
other cases (exotic platforms?), just skip the test.

Fixes Perl#22618.
@mauke
Copy link
Contributor

mauke commented Sep 21, 2024

I believe this is caused by building with -Duse64bitint on a 32-bit platform, which makes sizeof (IV) != sizeof (void *). I haven't actually verified this hypothesis, but if I'm right, PR #22619 may fix the issue.

@zakame
Copy link
Member Author

zakame commented Sep 21, 2024

Hi @mauke, thanks for the prompt reply! 🙇

I'm also checking if this might be a change due to underlying base Docker image, since https://github.com/Perl/docker-perl/actions/runs/10963019337/job/30443596763#step:4:4036 actually passed this prior to getting rebuilt on Docker's infra. Still, this hypothesis looks promising, will await it 🤞

mauke added a commit to mauke/perl5 that referenced this issue Sep 22, 2024
This test tries to get the integer representation of a pointer via
unpack 'j', pack 'P'. But an IV is not necessarily the same size as a
pointer. In particular, on 32-bit platforms with -Duse64bitint we have
sizeof (IV) == 8 and sizeof (void *) == 4, which makes unpack 'j' fail
(the input string is too short) and return undef.

Work around the issue by checking for the most common pointer sizes (4
and 8 bytes) and selecting an appropriate integer unpack format. In all
other cases (exotic platforms?), just skip the test.

Fixes Perl#22618.
@mauke mauke closed this as completed in 8784b2b Sep 24, 2024
@zakame
Copy link
Member Author

zakame commented Sep 25, 2024

Thanks for the fix @mauke ! 🙇

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

Successfully merging a pull request may close this issue.

2 participants