From 8d1462c7484dd3fe55500d84268b0ad1048b9a7c Mon Sep 17 00:00:00 2001 From: Thaddeus Crews Date: Wed, 6 Nov 2024 09:42:02 -0600 Subject: [PATCH] CI: Update Linux runners to Ubuntu 24.04 --- .github/workflows/android_builds.yml | 2 +- .github/workflows/godot_cpp_test.yml | 2 +- .github/workflows/linux_builds.yml | 7 +++++-- .github/workflows/static_checks.yml | 2 +- .github/workflows/web_builds.yml | 2 +- core/io/http_client_tcp.cpp | 7 ++++--- core/io/packet_peer_udp.cpp | 18 ++++++++++++++++++ core/io/stream_peer.cpp | 4 ++-- scene/2d/tile_map.cpp | 3 ++- 9 files changed, 35 insertions(+), 12 deletions(-) diff --git a/.github/workflows/android_builds.yml b/.github/workflows/android_builds.yml index d516c37d165..950e1e51cc4 100644 --- a/.github/workflows/android_builds.yml +++ b/.github/workflows/android_builds.yml @@ -14,7 +14,7 @@ concurrency: jobs: build-android: - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 name: ${{ matrix.name }} strategy: fail-fast: false diff --git a/.github/workflows/godot_cpp_test.yml b/.github/workflows/godot_cpp_test.yml index e26c109d75c..dc82a7cb3c4 100644 --- a/.github/workflows/godot_cpp_test.yml +++ b/.github/workflows/godot_cpp_test.yml @@ -15,7 +15,7 @@ concurrency: jobs: godot-cpp-tests: - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 name: Build and test Godot CPP steps: - name: Checkout diff --git a/.github/workflows/linux_builds.yml b/.github/workflows/linux_builds.yml index dc3d9f37862..cf653caa3de 100644 --- a/.github/workflows/linux_builds.yml +++ b/.github/workflows/linux_builds.yml @@ -17,7 +17,8 @@ concurrency: jobs: build-linux: - runs-on: ubuntu-20.04 + # If unspecified, stay one LTS before latest to increase portability of Linux artifacts. + runs-on: ${{ matrix.os || 'ubuntu-22.04' }} name: ${{ matrix.name }} strategy: fail-fast: false @@ -60,6 +61,8 @@ jobs: artifact: false # Test our oldest supported SCons/Python versions on one arbitrary editor build. legacy-scons: true + # Python 3.6 unavailable on 22.04. + os: ubuntu-20.04 - name: Editor with ThreadSanitizer (target=editor, tests=yes, dev_build=yes, use_tsan=yes, use_llvm=yes, linker=lld) cache-name: linux-editor-thread-sanitizer @@ -100,7 +103,7 @@ jobs: run: | sudo rm -f /etc/apt/sources.list.d/microsoft-prod.list sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys EB8B81E14DA65431D7504EA8F63F0F2B90935439 - sudo add-apt-repository "deb https://ppa.launchpadcontent.net/kisak/turtle/ubuntu focal main" + sudo add-apt-repository "deb https://ppa.launchpadcontent.net/kisak/turtle/ubuntu ${{ matrix.os == 'ubuntu-20.04' && 'focal' || 'jammy' }} main" sudo apt-get install -qq mesa-vulkan-drivers # TODO: Figure out somehow how to embed this one. diff --git a/.github/workflows/static_checks.yml b/.github/workflows/static_checks.yml index ff102a06cc5..9b326cb43e9 100644 --- a/.github/workflows/static_checks.yml +++ b/.github/workflows/static_checks.yml @@ -9,7 +9,7 @@ concurrency: jobs: static-checks: name: Code style, file formatting, and docs - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - name: Checkout uses: actions/checkout@v4 diff --git a/.github/workflows/web_builds.yml b/.github/workflows/web_builds.yml index ec57fa2f0d7..9ed84757690 100644 --- a/.github/workflows/web_builds.yml +++ b/.github/workflows/web_builds.yml @@ -15,7 +15,7 @@ concurrency: jobs: web-template: - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 name: ${{ matrix.name }} strategy: fail-fast: false diff --git a/core/io/http_client_tcp.cpp b/core/io/http_client_tcp.cpp index 70fcad543a1..237ba30a806 100644 --- a/core/io/http_client_tcp.cpp +++ b/core/io/http_client_tcp.cpp @@ -662,15 +662,16 @@ PackedByteArray HTTPClientTCP::read_response_body_chunk() { chunk_left -= rec; if (chunk_left == 0) { - if (chunk[chunk.size() - 2] != '\r' || chunk[chunk.size() - 1] != '\n') { + const int chunk_size = chunk.size(); + if (chunk[chunk_size - 2] != '\r' || chunk[chunk_size - 1] != '\n') { ERR_PRINT("HTTP Invalid chunk terminator (not \\r\\n)"); status = STATUS_CONNECTION_ERROR; break; } - ret.resize(chunk.size() - 2); + ret.resize(chunk_size - 2); uint8_t *w = ret.ptrw(); - memcpy(w, chunk.ptr(), chunk.size() - 2); + memcpy(w, chunk.ptr(), chunk_size - 2); chunk.clear(); } diff --git a/core/io/packet_peer_udp.cpp b/core/io/packet_peer_udp.cpp index fae3de2a982..08e5353174e 100644 --- a/core/io/packet_peer_udp.cpp +++ b/core/io/packet_peer_udp.cpp @@ -105,6 +105,19 @@ Error PacketPeerUDP::get_packet(const uint8_t **r_buffer, int &r_buffer_size) { return ERR_UNAVAILABLE; } +/* Bogus GCC warning here: + * In member function 'int RingBuffer::read(T*, int, bool) [with T = unsigned char]', + * inlined from 'virtual Error PacketPeerUDP::get_packet(const uint8_t**, int&)' at core/io/packet_peer_udp.cpp:112:9, + * inlined from 'virtual Error PacketPeerUDP::get_packet(const uint8_t**, int&)' at core/io/packet_peer_udp.cpp:99:7: + * Error: ./core/ring_buffer.h:68:46: error: writing 1 byte into a region of size 0 [-Werror=stringop-overflow=] + * 68 | p_buf[dst++] = read[pos + i]; + * | ~~~~~~~~~~~~~^~~~~~~ + */ +#if defined(__GNUC__) && !defined(__clang__) +#pragma GCC diagnostic push +#pragma GCC diagnostic warning "-Wstringop-overflow=0" +#endif + uint32_t size = 0; uint8_t ipv6[16] = {}; rb.read(ipv6, 16, true); @@ -115,6 +128,11 @@ Error PacketPeerUDP::get_packet(const uint8_t **r_buffer, int &r_buffer_size) { --queue_count; *r_buffer = packet_buffer; r_buffer_size = size; + +#if defined(__GNUC__) && !defined(__clang__) +#pragma GCC diagnostic pop +#endif + return OK; } diff --git a/core/io/stream_peer.cpp b/core/io/stream_peer.cpp index c49e15a3a0e..3f1c468fb31 100644 --- a/core/io/stream_peer.cpp +++ b/core/io/stream_peer.cpp @@ -223,13 +223,13 @@ void StreamPeer::put_var(const Variant &p_variant, bool p_full_objects) { } uint8_t StreamPeer::get_u8() { - uint8_t buf[1]; + uint8_t buf[1] = {}; get_data(buf, 1); return buf[0]; } int8_t StreamPeer::get_8() { - uint8_t buf[1]; + uint8_t buf[1] = {}; get_data(buf, 1); return buf[0]; } diff --git a/scene/2d/tile_map.cpp b/scene/2d/tile_map.cpp index ddb0635f6b2..20cbbc091a4 100644 --- a/scene/2d/tile_map.cpp +++ b/scene/2d/tile_map.cpp @@ -75,7 +75,8 @@ void TileMap::_set_tile_map_data_using_compatibility_format(int p_layer, TileMap for (int i = 0; i < c; i += offset) { const uint8_t *ptr = (const uint8_t *)&r[i]; uint8_t local[12]; - for (int j = 0; j < ((p_format >= TileMapDataFormat::TILE_MAP_DATA_FORMAT_2) ? 12 : 8); j++) { + const int buffer_size = (format == TILE_MAP_DATA_FORMAT_2) ? 12 : 8; + for (int j = 0; j < buffer_size; j++) { local[j] = ptr[j]; }