Skip to content

Fix mmap error when reading empty file during resume check on Linux #3283

Fix mmap error when reading empty file during resume check on Linux

Fix mmap error when reading empty file during resume check on Linux #3283

Workflow file for this run

name: Linux
on:
push:
branches: [ RC_1_2 RC_2_0 master ]
pull_request:
concurrency:
group: ${{ github.ref }}-${{ github.workflow }}-${{ github.event_name }}
cancel-in-progress: true
jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 1
filter: tree:0
- uses: actions/setup-python@v5
with:
python-version: "3.10"
- uses: pre-commit/[email protected]
build:
name: build
runs-on: ubuntu-22.04
continue-on-error: true
strategy:
matrix:
include:
- config: asio-debugging=on picker-debugging=on
- config: extensions=off logging=off streaming=off super-seeding=off share-mode=off predictive-pieces=off dht=off alert-msg=off encryption=off mutable-torrents=off deprecated-functions=off
- config: crypto=gcrypt
- config: mmap-disk-io=off
steps:
- name: checkout
uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 1
filter: tree:0
- name: update package lists
continue-on-error: true
run: |
sudo apt update
- uses: Chocobo1/setup-ccache-action@v1
with:
update_packager_index: false
override_cache_key: ccache-linux-build-${{ github.base_ref }}-${{ matrix.config }}
ccache_options: |
max_size=5G
- name: install boost
run: |
sudo apt install libboost-python-dev libboost-tools-dev libboost-dev libboost-system-dev python3
echo "using gcc ;" >>~/user-config.jam
- name: install gcrypt
if: ${{ contains(matrix.config, 'crypto=gcrypt') }}
run: sudo apt install libgcrypt20-dev
- name: build library
run: |
b2 ${{ matrix.config }} cxxstd=14,17,20 warnings-as-errors=on
- name: build examples
run: |
cd examples
b2 ${{ matrix.config }} cxxstd=14,17,20 warnings-as-errors=on
- name: build tools
run: |
cd tools
b2 ${{ matrix.config }} cxxstd=14,17,20 warnings-as-errors=on
- name: build python bindings
run: |
cd bindings/python
echo "using python ;" >>~/user-config.jam
BOOST_ROOT="" b2 ${{ matrix.config }} cxxstd=14,17,20 warnings-as-errors=on
fuzzers:
name: Fuzzers
runs-on: ubuntu-20.04
continue-on-error: true
steps:
- name: checkout
uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 1
filter: tree:0
- name: update package lists
continue-on-error: true
run: |
sudo apt update
- uses: Chocobo1/setup-ccache-action@v1
with:
update_packager_index: false
override_cache_key: ccache-linux-fuzzers-${{ github.base_ref }}
ccache_options: |
max_size=500M
- name: install clang-9
continue-on-error: true
run: |
sudo apt install clang-9
- name: install boost
run: |
sudo apt install libboost-tools-dev libboost-dev libboost-system-dev
echo "using clang : 9 : clang++-9 ;" >>~/user-config.jam
- name: build fuzzers
run: |
cd fuzzers
b2 clang cxxstd=14 warnings-as-errors=on
check_headers:
name: check headers
runs-on: ubuntu-20.04
steps:
- name: checkout
uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 1
filter: tree:0
- name: update package lists
continue-on-error: true
run: |
sudo apt update
- uses: Chocobo1/setup-ccache-action@v1
with:
update_packager_index: false
override_cache_key: ccache-linux-check-headers-${{ github.base_ref }}
ccache_options: |
max_size=500M
- name: install boost
run: |
sudo apt install libboost-tools-dev libboost-dev libboost-system-dev
echo "using gcc ;" >>~/user-config.jam
- name: compile header files individually
run: |
b2 check-headers cxxstd=14 warnings-as-errors=on
clang_tidy:
name: clang-tidy
runs-on: ubuntu-20.04
steps:
- name: checkout
uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 1
filter: tree:0
- name: update package lists
continue-on-error: true
run: |
sudo apt update
- uses: Chocobo1/setup-ccache-action@v1
with:
update_packager_index: false
override_cache_key: ccache-linux-clang-tidy-${{ github.base_ref }}
ccache_options: |
max_size=500M
- name: install clang-tidy
run: sudo apt install clang-tidy libc++-dev
- name: install boost
run: |
sudo apt install libboost-tools-dev libboost-dev
echo "using clang_tidy : : clang-tidy \"-checks=-clang-analyzer-core.*,-clang-analyzer-unix.*\" : <cxxflags>-std=c++14 <cxxflags>-I/usr/local/clang-7.0.0/include/c++/v1 <cxxflags>-stdlib=libc++ <cxxflags>-Wno-unknown-warning-option <linkflags>-stdlib=libc++ ;" >> ~/user-config.jam;
- name: analyze
run: |
b2 -a clang_tidy
test:
name: Tests
runs-on: ubuntu-22.04
continue-on-error: true
strategy:
matrix:
include:
- config: address-sanitizer=norecover undefined-sanitizer=norecover crypto=openssl
- config: toolset=clang logging=off address-sanitizer=norecover undefined-sanitizer=norecover
- config: thread-sanitizer=norecover crypto=openssl release debug-symbols=on cxxflags=-Wno-tsan
- config: crypto=gnutls
- config: deprecated-functions=off
steps:
- name: checkout
uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 1
filter: tree:0
- name: update package lists
continue-on-error: true
run: |
sudo apt update
- uses: Chocobo1/setup-ccache-action@v1
with:
update_packager_index: false
override_cache_key: ccache-linux-tests-${{ matrix.config }}-${{ github.base_ref }}
ccache_options: |
max_size=5G
- name: install gnutls
if: ${{ contains(matrix.config, 'crypto=gnutls') }}
run: |
sudo apt install libgnutls28-dev
- name: install clang-12
continue-on-error: true
run: |
sudo apt install clang-12
- name: install GCC-12
continue-on-error: true
run: |
sudo apt install gcc-12
- name: install boost
run: |
sudo apt install libboost-tools-dev libboost-dev libboost-system-dev
echo "using gcc : 12 : g++-12 ;" >>~/user-config.jam
echo "using clang : 12 : clang++-12 ;" >>~/user-config.jam
- name: build and run tests
run: |
cd test
b2 ${{ matrix.config }} -l500 warnings-as-errors=on debug-iterators=on invariant-checks=full asserts=on deterministic-tests
- name: run tests (flaky)
uses: nick-fields/retry@v3
with:
timeout_minutes: 30
retry_wait_seconds: 4
max_attempts: 3
command: (cd test; b2 ${{ matrix.config }} -l500 warnings-as-errors=on debug-iterators=on invariant-checks=full asserts=on)
sim:
name: Simulations
runs-on: ubuntu-20.04
steps:
- name: checkout
uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 1
filter: tree:0
- name: update package lists
continue-on-error: true
run: |
sudo apt update
- uses: Chocobo1/setup-ccache-action@v1
with:
update_packager_index: false
override_cache_key: ccache-linux-simulations-${{ github.base_ref }}
ccache_options: |
max_size=5G
- name: install boost
run: |
sudo apt install libboost-tools-dev libboost-dev libboost-system-dev
echo "using gcc ;" >>~/user-config.jam
- name: build and run simulations
run: |
cd simulation
b2 debug-iterators=on invariant-checks=full asserts=on picker-debugging=on
- name: build simulations no deprecated
run: |
cd simulation
b2 testing.execute=off deprecated-functions=off
dist:
name: build dist
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04, ubuntu-22.04]
steps:
- name: checkout
uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 1
filter: tree:0
- name: update package lists
continue-on-error: true
run: |
sudo apt update
- uses: Chocobo1/setup-ccache-action@v1
with:
update_packager_index: false
override_cache_key: ccache-linux-dist-${{ matrix.os }}-${{ github.base_ref }}
ccache_options: |
max_size=15G
- name: install dependencies
run: |
sudo apt install libboost-tools-dev libboost-python-dev libboost-dev libboost-system-dev
sudo apt install python3-docutils python3-pygments python3-pil gsfonts inkscape icoutils graphviz hunspell imagemagick python3-setuptools
python3 -m pip install aafigure
echo "using gcc ;" >>~/user-config.jam
- name: build tarball
run: AAFIGURE=~/.local/bin/aafigure RST2HTML=rst2html make dist
- uses: actions/upload-artifact@v4
with:
name: tarball-${{ matrix.os }}
path: libtorrent-rasterbar-*.tar.gz
- name: test-tarball (b2 install)
run: |
tar xvzf libtorrent-rasterbar-*.tar.gz
cd libtorrent-rasterbar-*/
b2 install cxxstd=14 --prefix=test-install-root
cat test-install-root/lib/pkgconfig/libtorrent-rasterbar.pc
- name: test-tarball (b2 tests)
run: |
cd libtorrent-rasterbar-*/test
b2 testing.execute=off
b2 test_torrent_info
- name: test-tarball (python bindings)
run: |
cd libtorrent-rasterbar-*/
python3 bindings/python/setup.py build