Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
3aa11a7
experimental build support for trixie
Danil42Russia Aug 13, 2025
837d2ea
disable pdo
Danil42Russia Aug 13, 2025
f12d36d
fix build
Danil42Russia Aug 13, 2025
f20e409
fix calloc() argument order
Danil42Russia Aug 13, 2025
87d74e0
clang support
Danil42Russia Aug 13, 2025
eb975de
hide the macro under defined
Danil42Russia Aug 13, 2025
3159fdd
missing include
Danil42Russia Aug 13, 2025
7298229
GitHub action
Danil42Russia Aug 13, 2025
6b14da6
format
Danil42Russia Aug 13, 2025
eacfd55
maybe fix empty_array
Danil42Russia Aug 13, 2025
4e4d582
add composer
Danil42Russia Aug 13, 2025
3c591af
temporarily disabled the `dangling-pointer`
Danil42Russia Aug 13, 2025
d598e2c
Python version
Danil42Russia Aug 13, 2025
e2b3367
only GCC diagnostic ignore
Danil42Russia Aug 13, 2025
9d71d31
fix GCC segmentation fault
Danil42Russia Aug 13, 2025
7c71387
use gcc 13
Danil42Russia Aug 13, 2025
e4da6bb
GCC diagnostic ignore
Danil42Russia Aug 13, 2025
846e68e
use gcc 12
Danil42Russia Aug 13, 2025
5610e0b
use gcc 12
Danil42Russia Aug 13, 2025
00e67ca
add no-deprecated-declarations for yaml
Danil42Russia Aug 13, 2025
c31db8a
Prepare for experiments with gcc-12
PetrShumilov Apr 24, 2025
30be062
returned the required
Danil42Russia Aug 13, 2025
0b95c48
only gcc-12
Danil42Russia Aug 13, 2025
75ca19e
add database
Danil42Russia Aug 13, 2025
5da4964
disable mysql
Danil42Russia Aug 13, 2025
e7d113d
clang 18
Danil42Russia Aug 13, 2025
7e4e6c0
clang 18
Danil42Russia Aug 13, 2025
be4f236
clang 17
Danil42Russia Aug 13, 2025
5c378fa
clang 16
Danil42Russia Aug 14, 2025
eb6997f
clang 16
Danil42Russia Aug 14, 2025
a2c17c8
clang 16
Danil42Russia Aug 14, 2025
8b25c5e
clang 16
Danil42Russia Aug 14, 2025
640678f
disable clang
Danil42Russia Sep 2, 2025
44e4dd0
remove software-properties-common
Danil42Russia Sep 2, 2025
8865905
mysql and other
Danil42Russia Sep 2, 2025
340e8c1
mysql
Danil42Russia Sep 2, 2025
711cf36
tmp
Danil42Russia Sep 2, 2025
77cd52d
psycopg
Danil42Russia Sep 2, 2025
1e58326
gcc
Danil42Russia Sep 2, 2025
42d61d1
gcc
Danil42Russia Sep 2, 2025
c96cc61
build-essential
Danil42Russia Sep 2, 2025
1b7dc99
pytest-mysql
Danil42Russia Sep 2, 2025
45dc7d5
pytest-mysql
Danil42Russia Sep 2, 2025
ccff271
user kitten
Danil42Russia Sep 2, 2025
57a47ce
user kitten
Danil42Russia Sep 2, 2025
2323ba8
rm -rf /tmp
Danil42Russia Sep 16, 2025
ecd43e6
remove pytest mysql_user
Danil42Russia Oct 22, 2025
ca78e6c
composer
Danil42Russia Oct 22, 2025
152671e
pymysql
Danil42Russia Oct 22, 2025
1f352f4
pymysql
Danil42Russia Oct 22, 2025
1fabf4d
oops
Danil42Russia Oct 22, 2025
adf5bd0
Update Dockerfile.trixie
Danil42Russia Oct 22, 2025
473512f
true mysql
Danil42Russia Oct 22, 2025
20bd14a
:(
Danil42Russia Oct 22, 2025
c1774ff
wtf
Danil42Russia Oct 22, 2025
591e8e3
mysql execute
Danil42Russia Oct 23, 2025
7c302c2
Update pytest.ini
Danil42Russia Oct 23, 2025
fc0a255
skip
Danil42Russia Oct 23, 2025
3996c8d
update pip package
Danil42Russia Oct 23, 2025
b2e95ce
update pip package
Danil42Russia Oct 23, 2025
1b3a101
oops
Danil42Russia Oct 23, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 65 additions & 0 deletions .github/workflows/Dockerfile.trixie
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
FROM debian:trixie
ARG DEBIAN_FRONTEND=noninteractive

# Compilers
ARG GPP_VERSION=12
ARG GCC_VERSION=12

# Languages
ARG PHP_VERSION=7.4
ARG PYTHON_VERSION=3.13

ARG POSTGRESQL_VERSION=14
ARG MYSQL_VERSION=8.4-lts

# Обновляем
RUN apt-get update

# Ставим свякое для работы
RUN apt-get install -y --no-install-recommends \
ca-certificates pkg-config lsb-release build-essential wget gnupg \
git cmake-data cmake make \
gperf netcat-openbsd patch re2c \
libfmt-dev libgtest-dev libgmock-dev zlib1g-dev

# GCC and G++
RUN apt-get install -y --no-install-recommends gcc-${GCC_VERSION} g++-${GPP_VERSION} \
&& update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-${GPP_VERSION} 100 \
&& update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${GCC_VERSION} 100

# Python
RUN apt-get install -y --no-install-recommends \
python${PYTHON_VERSION}-minimal \
python${PYTHON_VERSION}-dev \
python3-pip

# PostgreSQL
RUN wget -O /etc/apt/trusted.gpg.d/pgdg-key.asc https://www.postgresql.org/media/keys/ACCC4CF8.asc \
&& echo "deb https://apt.postgresql.org/pub/repos/apt trixie-pgdg main" > /etc/apt/sources.list.d/pgdg.list \
&& apt-get update && apt-get install -y --no-install-recommends postgresql-${POSTGRESQL_VERSION} libpq-dev

# MySQL
RUN wget -O /etc/apt/trusted.gpg.d/mysql.asc https://repo.mysql.com/RPM-GPG-KEY-mysql-2023 \
&& echo "deb https://repo.mysql.com/apt/debian/ trixie mysql-${MYSQL_VERSION}" > /etc/apt/sources.list.d/mysql.list \
&& apt-get update && apt-get install -y --no-install-recommends mysql-server libmysqlclient-dev

# Python package
COPY tests/python/requirements-trixie.txt /tmp/requirements.txt
RUN python${PYTHON_VERSION} -m pip install --no-cache-dir --break-system-packages -r /tmp/requirements.txt

# PHP
RUN wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg \
&& echo "deb https://packages.sury.org/php trixie main" > /etc/apt/sources.list.d/php.list \
&& apt-get update && apt-get install -y --no-install-recommends php${PHP_VERSION}-dev \
&& update-alternatives --set php /usr/bin/php${PHP_VERSION}

# Composer
RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" \
&& php -r "if (hash_file('sha384', 'composer-setup.php') === 'ed0feb545ba87161262f2d45a633e34f591ebb3381f2e0063c345ebea4d228dd0043083717770234ec00c5a9f9593792') { echo 'Installer verified'.PHP_EOL; } else { echo 'Installer corrupt'.PHP_EOL; unlink('composer-setup.php'); exit(1); }" \
&& php composer-setup.php --install-dir=/usr/bin --version=2.8.12 --filename=composer \
&& php -r "unlink('composer-setup.php');"

RUN rm -rf /var/lib/apt/lists/* \
&& rm -rf /tmp/*

RUN useradd -ms /bin/bash kitten
1 change: 1 addition & 0 deletions .github/workflows/debian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ env:

jobs:
build-linux:
if: ${{ false }}
runs-on: ubuntu-latest
strategy:
matrix:
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,11 @@ env:

jobs:
build-macos:
if: ${{ false }}
runs-on: ${{matrix.os}}-15
strategy:
matrix:
include:
- os: macos
compiler: clang++
cpp: 17
- os: macos
compiler: clang++
cpp: 20
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ env:

jobs:
build-linux:
if: ${{ false }}
runs-on: ubuntu-latest
strategy:
matrix:
Expand Down
115 changes: 115 additions & 0 deletions .github/workflows/unstable.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
name: unstable

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

env:
kphp_root_dir: /home/kitten/kphp
kphp_polyfills_dir: /home/kitten/kphp/kphp-polyfills
kphp_build_dir: /home/kitten/kphp/build

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
build-linux:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- os: trixie
compiler: g++-12
cpp: 20
asan: off
ubsan: off
mysql: on
pgsql: on

name: "${{matrix.os}} / ${{matrix.compiler}} / c++${{matrix.cpp}} / asan=${{matrix.asan}} / ubsan=${{matrix.ubsan}}"

steps:
- uses: actions/checkout@v4

- name: Get polyfills repo
uses: actions/checkout@v4
with:
repository: 'VKCOM/kphp-polyfills'
path: 'kphp-polyfills'

- name: Cache docker image
uses: actions/cache@v4
id: docker-image-cache
with:
path: kphp-build-env-${{matrix.os}}.tar
key: docker-image-cache-${{matrix.os}}-${{ hashFiles('.github/workflows/Dockerfile.*', 'tests/python/requirements*.txt') }}

- name: Build and save docker image
if: steps.docker-image-cache.outputs.cache-hit != 'true'
run: |
docker build -f $GITHUB_WORKSPACE/.github/workflows/Dockerfile.${{matrix.os}} $GITHUB_WORKSPACE \
-t kphp-build-img-${{matrix.os}} \
--cache-from=type=local,src=kphp-build-img-${{matrix.os}}-cache
docker tag kphp-build-img-${{matrix.os}} kphp-build-img-${{matrix.os}}-cache
docker save kphp-build-img-${{matrix.os}}-cache -o kphp-build-env-${{matrix.os}}.tar

- name: Load docker image from cache
if: steps.docker-image-cache.outputs.cache-hit == 'true'
run: docker load --input kphp-build-env-${{matrix.os}}.tar

- name: Start docker container
run: |
docker run -dt --name kphp-build-container-${{matrix.os}} kphp-build-img-${{matrix.os}}-cache
docker cp $GITHUB_WORKSPACE/. kphp-build-container-${{matrix.os}}:${{env.kphp_root_dir}}

- name: Add git safe directory
run: docker exec kphp-build-container-${{matrix.os}} bash -c
"git config --global --add safe.directory '${{env.kphp_root_dir}}'"
# This command is used to address potential issues with Git's safe directory feature.
# By setting '*' as a safe directory, we allow Git operations to proceed without errors
# related to directory safety, ensuring smooth execution of the submodules updating.

- name: Build all
run: docker exec kphp-build-container-${{matrix.os}} bash -c
"cmake -DCMAKE_CXX_COMPILER=${{matrix.compiler}} -DCMAKE_CXX_STANDARD=${{matrix.cpp}} -DADDRESS_SANITIZER=${{matrix.asan}} -DUNDEFINED_SANITIZER=${{matrix.ubsan}} -DPDO_DRIVER_MYSQL=${{matrix.mysql}} -DPDO_DRIVER_PGSQL=${{matrix.pgsql}} -DPDO_LIBS_STATIC_LINKING=OFF -S ${{env.kphp_root_dir}} -B ${{env.kphp_build_dir}} && make -C ${{env.kphp_build_dir}} -j$(nproc) all"

- name: Run unit tests
run: docker exec kphp-build-container-${{matrix.os}} bash -c
"make -C ${{env.kphp_build_dir}} -j$(nproc) test"

- name: Compile dummy PHP script
run: docker exec kphp-build-container-${{matrix.os}} bash -c
"cd ${{env.kphp_build_dir}} && echo 'hello world' > demo.php && ${{env.kphp_root_dir}}/objs/bin/kphp2cpp --cxx ${{matrix.compiler}} demo.php && kphp_out/server -o --user kitten"

- name: Polyfills composer install
run: docker exec kphp-build-container-${{matrix.os}} bash -c
"composer install -d ${{env.kphp_polyfills_dir}}"

- name: Run python tests
id: python_tests
continue-on-error: true
run: docker exec kphp-build-container-${{matrix.os}} bash -c
"chown -R kitten /home && mkdir -p /tmp/pytest-of-kitten && chown -R kitten /tmp/pytest-of-kitten && su kitten -c 'GITHUB_ACTIONS=1 SKIP_MYSQL_TESTS=1 KPHP_TESTS_POLYFILLS_REPO=${{env.kphp_polyfills_dir}} KPHP_CXX=${{matrix.compiler}} python3.13 -m pytest --tb=native -n$(nproc) ${{env.kphp_root_dir}}/tests/python/tests'"

- name: Prepare python tests artifacts
if: steps.python_tests.outcome == 'failure'
run: docker cp kphp-build-container-${{matrix.os}}:${{env.kphp_root_dir}}/tests/python/_tmp/ ${{runner.temp}} &&
rm -rf ${{runner.temp}}/_tmp/*/working_dir

- name: Upload python tests artifacts
uses: actions/upload-artifact@v4
if: steps.python_tests.outcome == 'failure'
with:
name: pytest-result-${{ matrix.os }}-${{matrix.compiler}}
path: ${{runner.temp}}/_tmp/

- name: Fail pipeline if python tests failed
if: steps.python_tests.outcome == 'failure'
run: exit 1

- name: Remove docker container
run: docker rm -f kphp-build-container-${{matrix.os}}
8 changes: 7 additions & 1 deletion cmake/utils.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,13 @@ endfunction()

function(allow_deprecated_declarations)
foreach(src_file ${ARGN})
set_source_files_properties(${src_file} PROPERTIES COMPILE_FLAGS -Wno-deprecated-declarations)
set_property(SOURCE ${src_file} APPEND PROPERTY COMPILE_OPTIONS -Wno-deprecated-declarations)
endforeach()
endfunction()

function(allow_stringop_overflow)
foreach(src_file ${ARGN})
set_property(SOURCE ${src_file} APPEND PROPERTY COMPILE_OPTIONS -Wno-stringop-overflow)
endforeach()
endfunction()

Expand Down
4 changes: 2 additions & 2 deletions common/binlog/binlog-buffer-replay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ static int bb_writer_rotate(bb_writer_t* W, bb_rotation_point_t* p) {

/******************** replay binlog ********************/
void bbr_replay_init(bb_reader_t* R) {
bbr_replay_extra_t* e = static_cast<bbr_replay_extra_t*>(calloc(sizeof(*e), 1));
bbr_replay_extra_t* e = static_cast<bbr_replay_extra_t*>(calloc(1, sizeof(*e)));
assert(e);
e->wait_job_cb = static_cast<bb_wait_job_cb_t*>(calloc(sizeof(*e->wait_job_cb), 1));
e->wait_job_cb = static_cast<bb_wait_job_cb_t*>(calloc(1, sizeof(*e->wait_job_cb)));
R->extra = e;
}

Expand Down
2 changes: 1 addition & 1 deletion common/binlog/binlog-buffer-rotation-points.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ static void bb_buffer_insert_rotation_point(bb_buffer_t* B, bb_rotation_point_t*
}

bb_rotation_point_t* bb_rotation_point_alloc(bb_buffer_t* B, enum bb_rotation_point_type tp, long long log_pos) {
auto* p = static_cast<bb_rotation_point_t*>(calloc(sizeof(bb_rotation_point_t), 1));
auto* p = static_cast<bb_rotation_point_t*>(calloc(1, sizeof(bb_rotation_point_t)));
assert(p);
p->tp = tp;
p->log_pos = log_pos;
Expand Down
2 changes: 1 addition & 1 deletion common/kfs/kfs-replica.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ kfs_replica_handle_t open_replica(const char* replica_name, int flags) {
struct kfs_replica* R = 0;

if (flags & KFS_OPEN_REPLICA_FLAG_FORCE) {
R = static_cast<kfs_replica*>(calloc(sizeof(*R), 1));
R = static_cast<kfs_replica*>(calloc(1, sizeof(*R)));
assert(R);
R->replica_prefix = strdup(replica_name);
assert(R->replica_prefix);
Expand Down
1 change: 1 addition & 0 deletions common/php-functions.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

#include <cctype>
#include <climits>
#include <cstdint>
#include <cstring>
#include <limits>
#include <type_traits>
Expand Down
3 changes: 1 addition & 2 deletions common/sanitizer.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@

#pragma once

#include <sanitizer/asan_interface.h>

#if defined(__SANITIZE_ADDRESS__)
#include <sanitizer/asan_interface.h>
#define ASAN_ENABLED 1
#elif defined(__has_feature)
#if __has_feature(address_sanitizer)
Expand Down
33 changes: 30 additions & 3 deletions compiler/compiler.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -225,9 +225,36 @@ prepend(KPHP_COMPILER_SOURCES ${KPHP_COMPILER_DIR}/
utils/string-utils.cpp)

# Suppress YAML-cpp-related warnings
if(COMPILER_CLANG)
allow_deprecated_declarations(${KPHP_COMPILER_DIR}/data/composer-json-data.cpp)
allow_deprecated_declarations(${KPHP_COMPILER_DIR}/data/modulite-data.cpp)
if(COMPILER_CLANG OR (COMPILER_GCC AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "12.0.0")))
allow_deprecated_declarations(
${KPHP_COMPILER_DIR}/data/composer-json-data.cpp
${KPHP_COMPILER_DIR}/data/modulite-data.cpp
)
endif()

if(COMPILER_GCC AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "12.0.0"))
allow_stringop_overflow(
${KPHP_COMPILER_DIR}/code-gen/vertex-compiler.cpp
${KPHP_COMPILER_DIR}/data/class-data.cpp
${KPHP_COMPILER_DIR}/data/kphp-json-tags.cpp
${KPHP_COMPILER_DIR}/data/generics-mixins.cpp
${KPHP_COMPILER_DIR}/data/kphp-tracing-tags.cpp
${KPHP_COMPILER_DIR}/data/modulite-data.cpp
${KPHP_COMPILER_DIR}/code-gen/files/tracing-autogen.cpp
${KPHP_COMPILER_DIR}/pipes/analyze-performance.cpp
${KPHP_COMPILER_DIR}/pipes/check-access-modifiers.cpp
${KPHP_COMPILER_DIR}/pipes/check-classes.cpp
${KPHP_COMPILER_DIR}/pipes/check-tl-classes.cpp
${KPHP_COMPILER_DIR}/pipes/code-gen.cpp
${KPHP_COMPILER_DIR}/pipes/filter-only-actually-used.cpp
${KPHP_COMPILER_DIR}/pipes/final-check.cpp
${KPHP_COMPILER_DIR}/pipes/parse-and-apply-phpdoc.cpp
${KPHP_COMPILER_DIR}/pipes/sort-and-inherit-classes.cpp
${KPHP_COMPILER_DIR}/pipes/register-kphp-configuration.cpp
${KPHP_COMPILER_DIR}/phpdoc.cpp
${KPHP_COMPILER_DIR}/gentree.cpp
${KPHP_COMPILER_DIR}/make/make.cpp
)
endif()

if(APPLE)
Expand Down
3 changes: 2 additions & 1 deletion compiler/ffi/c_parser/parsing_driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

#include <charconv>
#include <unordered_set>
#include <vector>

using namespace ffi;

Expand Down Expand Up @@ -113,7 +114,7 @@ FFIType *ParsingDriver::function_to_var(FFIType *function) {
function->kind = FFITypeKind::Var;
FFIType *function_ptr_type = alloc.new_type(FFITypeKind::FunctionPointer);
function_ptr_type->members = std::move(function->members);
function->members = {function_ptr_type};
function->members = std::vector<FFIType*>{function_ptr_type};
return function;
}

Expand Down
2 changes: 1 addition & 1 deletion net/net-aes-keys.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ static size_t aes_loaded_keys_size;
aes_key_t *default_aes_key;

aes_key_t *create_aes_key() {
aes_key_t *key = static_cast<aes_key_t*>(calloc(sizeof(*key), 1));
aes_key_t *key = static_cast<aes_key_t*>(calloc(1, sizeof(*key)));
assert(!posix_memalign((void **) &key->key, 4096, AES_KEY_MAX_LEN));

our_madvise(key->key, AES_KEY_MAX_LEN, MADV_DONTDUMP);
Expand Down
26 changes: 18 additions & 8 deletions runtime-common/core/core-types/definition/array.inl
Original file line number Diff line number Diff line change
Expand Up @@ -107,14 +107,24 @@ template<>
inline typename array<Unknown>::array_inner* array<Unknown>::array_inner::empty_array() {
// need this hack because gcc10 and newer complains about
// "array subscript is outside array bounds of array<Unknown>::array_inner"
static array_inner_control empty_array[1]{{
true,
ExtraRefCnt::for_global_const,
-1,
{0, 0},
0,
2,
}};
static array_inner_control empty_array[2]{
{
true,
ExtraRefCnt::for_global_const,
-1,
{0, 0},
0,
2,
},
{
true,
ExtraRefCnt::for_global_const,
-1,
{0, 0},
0,
2,
},
};
return static_cast<array<Unknown>::array_inner*>(&empty_array[0]);
}

Expand Down
2 changes: 1 addition & 1 deletion runtime/runtime.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ set_source_files_properties(
)

# Suppress YAML-cpp-related warnings
if(COMPILER_CLANG)
if(COMPILER_CLANG OR (COMPILER_GCC AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "12.0.0")))
allow_deprecated_declarations(${BASE_DIR}/runtime/interface.cpp)
endif()

Expand Down
Loading