Bug 2401791
| Summary: | SDL3-0:3.2.24-1.fc44 breaks perl-SDL: t/core.t:69: SDL::get_error() stopped reporting errors | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Fedora] Fedora | Reporter: | Petr Pisar <ppisar> | ||||
| Component: | perl-SDL | Assignee: | Petr Pisar <ppisar> | ||||
| Status: | CLOSED RAWHIDE | QA Contact: | Fedora Extras Quality Assurance <extras-qa> | ||||
| Severity: | unspecified | Docs Contact: | |||||
| Priority: | unspecified | ||||||
| Version: | rawhide | CC: | dchen, hans, icculus, ngompa13, perl-devel, ppisar, slouken, spotrh | ||||
| Target Milestone: | --- | Keywords: | Regression | ||||
| Target Release: | --- | ||||||
| Hardware: | Unspecified | ||||||
| OS: | Unspecified | ||||||
| Whiteboard: | |||||||
| Fixed In Version: | perl-SDL-2.548-31.fc44 | Doc Type: | --- | ||||
| Doc Text: | Story Points: | --- | |||||
| Clone Of: | Environment: | ||||||
| Last Closed: | 2025-10-09 13:38:23 UTC | Type: | Bug | ||||
| Regression: | --- | Mount Type: | --- | ||||
| Documentation: | --- | CRM: | |||||
| Verified Versions: | Category: | --- | |||||
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||
| Cloudforms Team: | --- | Target Upstream Version: | |||||
| Embargoed: | |||||||
| Attachments: |
|
||||||
I bisected the regression to this SDL3 commit:
commit 5594d03da086ab255b1d7ace1496f3a0c109a83d (HEAD)
Author: Sam Lantinga <slouken>
Date: Tue Sep 2 20:11:00 2025 -0700
Leave letterbox borders set to the frame clear color
Fixes https://github.com/libsdl-org/sdl2-compat/issues/483
(cherry picked from commit fbbc29159a25f26d789694a74c2d1d3216dfb49d)
The Perl reproducer is:
$ cat t/test.t
#!/usr/bin/perl -w
use SDL;
use SDL::Video;
use Test::More tests => 1;
$ENV{SDL_VIDEODRIVER} = 'dummy';
my $display = SDL::Video::set_video_mode( 640, 480, 232, SDL_ANYFORMAT );
isnt( SDL::get_error(), '', '[get_error] got error ' . SDL::get_error() );
$ LD_LIBRARY_PATH=/tmp/SDL/redhat-linux-build perl -Iblib/{lib,arch} t/test.t
1..1
not ok 1 - [get_error] got error
# Failed test '[get_error] got error '
# at t/test.t line 7.
# got: ''
# expected: anything else
# Looks like you failed 1 test of 1.
It has been a while since I've looked at perl-SDL, but it looks like it it's using the SDL 1.2 compatibility layer and not SDL2 or SDL3, which is fine, but makes this ... trickier for me to reproduce in C code?
I tried this reproducer case:
*****
#include <SDL.h>
int main(int argc, char* argv[]) {
SDL_Surface* screen;
SDL_Init(SDL_INIT_EVERYTHING);
// This should work
screen = SDL_SetVideoMode(640, 480, 32, SDL_SWSURFACE);
// This should fail
// screen = SDL_SetVideoMode(640, 480, 232, SDL_SWSURFACE);
if (!screen) {
printf("the mode could not be set\n");
SDL_Quit();
return 1;
}
// Flip the screen to make the surface visible (essential for SDL 1.2)
SDL_Flip(screen);
// Wait for 2 seconds before quitting
SDL_Delay(2000);
// Clean up SDL resources and exit
SDL_Quit();
return 0;
}
*****
I _think_ that's doing the same thing roughly as the perl-SDL testcode, but it fails when it is supposed to (comment out the first case, uncomment the second). A bit stumped.
And of course, when I type it in, I see my mistake. :P I'm using SDL_SWSURFACE, not SDL_ANYFORMAT. Switching to that and I can reproduce. Okay, now I'm back to being confused (a fairly normal state for me). I downgraded to SDL3 3.2.20 to test things, but I get the same behavior there as I do on 3.2.24: SDL_SetVideoMode(640, 480, 32, SDL_ANYFORMAT); <= works SDL_SetVideoMode(640, 480, 232, SDL_ANYFORMAT); <= works SDL_SetVideoMode(640, 480, 32, SDL_SWSURFACE); <= works SDL_SetVideoMode(640, 480, 232, SDL_SWSURFACE); <= fails Created attachment 2108855 [details]
test code with debugging for all four cases
gcc -I/usr/include/SDL -o SDL-example SDL-example.c -lSDL-1.2
For me SDL_SetVideoMode() passes with both SDL3 versions, but SDL_GetError() stopped reporting the error. My reproducer:
#include <SDL.h>
int main(int argc, char* argv[]) {
SDL_Surface *screen;
char *error;
if (SDL_Init(SDL_INIT_VIDEO)) {
printf("SDL_Init() failed\n");
return 1;
}
screen = SDL_SetVideoMode(640, 480, 232, SDL_ANYFORMAT);
if (!screen) {
printf("SDL_SetVideoMode() failed\n");
SDL_Quit();
return 1;
}
error = SDL_GetError();
if (error)
printf("Last error = %s\n", error);
else
printf("SDL_GetError() did not return any error\n");
SDL_Quit();
return 0;
}
Old behavior:
$ SDL_VIDEODRIVER=dummy ./a.out; echo $?
Last error = rect has a negative size
0
New behavior:
$ SDL_VIDEODRIVER=dummy ./a.out; echo $?
Last error =
0
The new behavior is at least consistent. But I worry that it actually returns a buggy SDL_Surface. Inspecting its details shows, in both versions:
w=640 h=480 bpp=32
I don't know whether SDL_SetVideoMode() always (since SDL 1.2) succeeded and only signalled an error with SDL_GetError().
It's quite possible that the perl-SDL test wanted to test SDL::get_error(), and SDL::Video::set_video_mode(640, 480, 232, SDL_ANYFORMAT) was only a tool for it. Then I could change the test to use call SDL::Video::set_video_mode(-1, ...).
(In reply to Petr Pisar from comment #6) > It's quite possible that the perl-SDL test wanted to test SDL::get_error(), > and SDL::Video::set_video_mode(640, 480, 232, SDL_ANYFORMAT) was only a tool > for it. Then I could change the test to use call > SDL::Video::set_video_mode(-1, ...). I could not find anything helpful in the perl-SDL history. Then judging from the current test, the test is based on wrong assumptions and I will correct it. |
SDL3-0:3.2.24-1.fc44 breaks perl-SDL-2.548-30.fc44 tests: # Failed test '[get_error] got error ' # at t/core.t line 69. # got: '' # expected: anything else # Looks like you failed 1 test of 28. t/core.t ........................ Dubious, test returned 1 (wstat 256, 0x100) Failed 1/28 subtests (3 TODO tests unexpectedly succeeded) [...] E.g. the t/core.t:69 attempts to set an obviously unsupported video mode of 232 bits-per-pixel depth: my $display = SDL::Video::set_video_mode( 640, 480, 232, SDL_ANYFORMAT ); and that checks that an error was reported by SDL: isnt( SDL::get_error(), '', '[get_error] got error ' . SDL::get_error() ); This error test fails with SDL3 3.2.24. It passes with SDL3-0:3.2.20-1.fc43.x86_64.