Bug 2341036 - perl-SDL-2.548-27.fc43 FTBFS: t/sdlx_surface.t crashes with SDL3
Summary: perl-SDL-2.548-27.fc43 FTBFS: t/sdlx_surface.t crashes with SDL3
Keywords:
Status: ASSIGNED
Alias: None
Product: Fedora
Classification: Fedora
Component: perl-SDL
Version: 42
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Petr Pisar
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: F42FTBFS
TreeView+ depends on / blocked
 
Reported: 2025-01-22 21:20 UTC by Fedora Release Engineering
Modified: 2025-02-11 13:06 UTC (History)
3 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed:
Type: ---
Embargoed:


Attachments (Terms of Use)
build.log (32.00 KB, text/plain)
2025-01-22 21:20 UTC, Fedora Release Engineering
no flags Details
root.log (32.00 KB, text/plain)
2025-01-22 21:20 UTC, Fedora Release Engineering
no flags Details
state.log (1.64 KB, text/plain)
2025-01-22 21:20 UTC, Fedora Release Engineering
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Github PerlGameDev SDL issues 294 0 None open bad call to boot_SDL() breaks some platforms 2025-02-11 09:26:50 UTC

Description Fedora Release Engineering 2025-01-22 21:20:03 UTC
perl-SDL failed to build from source in Fedora rawhide/f42

https://koji.fedoraproject.org/koji/taskinfo?taskID=128051243


For details on the mass rebuild see:

https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild
Please fix perl-SDL at your earliest convenience and set the bug's status to
ASSIGNED when you start fixing it. If the bug remains in NEW state for 8 weeks,
perl-SDL will be orphaned. Before branching of Fedora 43,
perl-SDL will be retired, if it still fails to build.

For more details on the FTBFS policy, please visit:
https://docs.fedoraproject.org/en-US/fesco/Fails_to_build_from_source_Fails_to_install/

Comment 1 Fedora Release Engineering 2025-01-22 21:20:07 UTC
Created attachment 2071639 [details]
build.log

file build.log too big, will only attach last 32768 bytes

Comment 2 Fedora Release Engineering 2025-01-22 21:20:09 UTC
Created attachment 2071640 [details]
root.log

file root.log too big, will only attach last 32768 bytes

Comment 3 Fedora Release Engineering 2025-01-22 21:20:10 UTC
Created attachment 2071641 [details]
state.log

Comment 4 Petr Pisar 2025-02-11 09:24:16 UTC
From a build log:

gcc -Isrc -I/usr/lib64/perl5/CORE '-DVERSION="2.548"' '-DXS_VERSION="2.548"' -fPIC -DNOSIGCATCH -O2 -I/usr/include/SDL '-D_GNU_SOURCE=1' -D_REENTRANT -I/usr/include/smpeg -I/usr/include -I/usr/include -I/usr/local/include -DHAVE_SDL -DUSE_THREADS -fPIC -c -D_REENTRANT -D_GNU_SOURCE -O2 '-flto=auto' -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Wno-complain-wrong-lang '-Werror=format-security' '-Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3' -Wp,-D_GLIBCXX_ASSERTIONS '-specs=/usr/lib/rpm/redhat/redhat-hardened-cc1' -fstack-protector-strong '-specs=/usr/lib/rpm/redhat/redhat-annobin-cc1' -m64 '-march=x86-64' '-mtune=generic' -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection '-mtls-dialect=gnu2' -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fwrapv -fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE '-D_FILE_OFFSET_BITS=64' -g -o lib/SDL_perl.o lib/SDL_perl.c
[...]
In file included from lib/SDL_perl.xs:32:
lib/SDL_perl.c:654:13: error: conflicting types for ‘boot_SDL’; have ‘void(PerlInterpreter *, CV *)’ {aka ‘void(struct interpreter *, struct cv *)’}
  654 | XS_EXTERNAL(boot_SDL); /* prototype to pass -Wmissing-prototypes */
      |             ^~~~~~~~
/usr/lib64/perl5/CORE/XSUB.h:149:34: note: in definition of macro ‘XS_EXTERNAL’
  149 | #  define XS_EXTERNAL(name) void name(pTHX_ CV* cv __attribute__unused__)
      |                                  ^~~~
lib/SDL_perl.xs:147:6: note: previous declaration of ‘boot_SDL’ with type ‘void(void)’
  147 | void boot_SDL();
      |      ^~~~~~~~
lib/SDL_perl.c:655:13: error: conflicting types for ‘boot_SDL’; have ‘void(PerlInterpreter *, CV *)’ {aka ‘void(struct interpreter *, struct cv *)’}
  655 | XS_EXTERNAL(boot_SDL)
      |             ^~~~~~~~
/usr/lib64/perl5/CORE/XSUB.h:149:34: note: in definition of macro ‘XS_EXTERNAL’
  149 | #  define XS_EXTERNAL(name) void name(pTHX_ CV* cv __attribute__unused__)
      |                                  ^~~~
lib/SDL_perl.xs:147:6: note: previous declaration of ‘boot_SDL’ with type ‘void(void)’
  147 | void boot_SDL();
      |      ^~~~~~~~

Comment 5 Petr Pisar 2025-02-11 12:08:11 UTC
I pushed a fix dist-git. But a t/sdlx_surface.t test crashes on on a division by zero:

Program received signal SIGFPE, Arithmetic exception.
0x00007ffff6bd6e54 in _calc_offset (surface=surface@entry=0x555556333a60, x=0, y=<optimized out>)
    at lib/SDLx/Surface.xs:22
22          offset  = (surface->pitch * y) / surface->format->BytesPerPixel;

The crash is triggered by replacing SDL2-2.30.11-1.fc42 with sdl2-compat-0:2.32.50-2.fc43.

Comment 6 Petr Pisar 2025-02-11 12:43:24 UTC
Minimized reproducer:

With SDL2:
$ SDL_VIDEODRIVER=dummy perl -Iblib/{lib,arch} -e 'use SDLx::Surface; print SDLx::Surface->new(width=>1, height=>1, greenmask => 0xFF000000)->[0][0]'
0

With SDL3:

$ SDL_VIDEODRIVER=dummy perl -Iblib/{lib,arch} -e 'use SDLx::Surface; print SDLx::Surface->new(width=>1, height=>1, greenmask => 0xFF000000)->[0][0]'
Floating point exception (core dumped)

The important trigger is setting greenmask => 0xFF000000 when creating the SDLx surface.

It seems surface format is not fully initialized:

SLD3:

p *surface->format
$1 = {palette = 0x0, BitsPerPixel = 0 '\000', BytesPerPixel = 0 '\000', Rloss = 8 '\b',
  Gloss = 8 '\b', Bloss = 8 '\b', Aloss = 8 '\b', Rshift = 0 '\000', Gshift = 0 '\000',
  Bshift = 0 '\000', Ashift = 0 '\000', Rmask = 0, Gmask = 0, Bmask = 0, Amask = 0, colorkey = 0,
  alpha = 255 '\377'}

SDL2:

(gdb) p *surface->format
$1 = {palette = 0x0, BitsPerPixel = 0 '\000', BytesPerPixel = 0 '\000', Rloss = 8 '\b',
  Gloss = 8 '\b', Bloss = 8 '\b', Aloss = 8 '\b', Rshift = 0 '\000', Gshift = 0 '\000',
  Bshift = 0 '\000', Ashift = 0 '\000', Rmask = 0, Gmask = 0, Bmask = 0, Amask = 0, colorkey = 0,
  alpha = 255 '\377'}

Comment 7 Petr Pisar 2025-02-11 13:06:01 UTC
And a t/core_surface.t subtest fails with SDL3:

ok 12 - An object of class 'SDL::PixelFormat' isa 'SDL::PixelFormat'
not ok 13 -  BitsPerPixel
#   Failed test ' BitsPerPixel'
#   at t/core_surface.t line 54.
#          got: '4'
#     expected: '8'


Note You need to log in before you can comment on or make changes to this bug.