1
0
Fork 0
mirror of https://github.com/containers/youki synced 2024-06-09 00:06:18 +02:00

Merge branch 'main' into sat_sub

This commit is contained in:
Yashodhan Joshi 2023-02-20 16:04:33 +05:30
commit 5809c6128a
89 changed files with 710 additions and 729 deletions

4
.github/scripts/dependency.sh vendored Executable file
View File

@ -0,0 +1,4 @@
#!/bin/bash
sudo apt-get -y update
sudo apt-get install -y pkg-config libsystemd-dev libdbus-glib-1-dev libelf-dev libseccomp-dev

View File

@ -14,17 +14,11 @@ jobs:
- name: Checkout to PR branch
uses: actions/checkout@v3
- name: Setup Linux env
run: |
sudo apt -y update
sudo apt install libsystemd-dev librust-libdbus-sys-dev libseccomp-dev
- name: Install requirements
run: ./.github/scripts/dependency.sh
- name: Setting rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
profile: minimal
- name: Setup Rust toolchain and cache
uses: actions-rust-lang/setup-rust-toolchain@v1.3.7
- name: Building PR branch
run: make youki-release
@ -46,17 +40,11 @@ jobs:
with:
ref: main
- name: Setup Linux env
run: |
sudo apt -y update
sudo apt install libsystemd-dev librust-libdbus-sys-dev libseccomp-dev
- name: Install requirements
run: ./.github/scripts/dependency.sh
- name: Setting rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
profile: minimal
- name: Setup Rust toolchain and cache
uses: actions-rust-lang/setup-rust-toolchain@v1.3.7
- name: Building main branch
run: make youki-release

View File

@ -12,14 +12,10 @@ jobs:
timeout-minutes: 15
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
toolchain: '1.67.0'
override: true
- name: Cache youki
uses: Swatinem/rust-cache@v1
- run: sudo apt-get -y update
- run: sudo apt-get install -y pkg-config libsystemd-dev libdbus-glib-1-dev libelf-dev libseccomp-dev
- name: Setup Rust toolchain and cache
uses: actions-rust-lang/setup-rust-toolchain@v1.3.7
- name: Install requirements
run: ./.github/scripts/dependency.sh
- name: Build youki
run: make youki-release
- name: Upload youki binary
@ -40,6 +36,7 @@ jobs:
- uses: actions/setup-go@v3
with:
go-version: '1.18.3'
cache: true
- run: sudo apt-get -y update
- run: sudo apt-get install -y pkg-config libsystemd-dev libdbus-glib-1-dev libelf-dev libseccomp-dev btrfs-progs libbtrfs-dev
- name: Build containerd

View File

@ -24,19 +24,12 @@ jobs:
if: ${{ !contains(needs.changes.outputs.dirs, '[]') }}
runs-on: ubuntu-20.04
timeout-minutes: 15
strategy:
matrix:
rust: [1.66.0, 1.67.0]
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
override: true
- name: Cache youki
uses: Swatinem/rust-cache@v1
- run: sudo apt-get -y update
- run: sudo apt-get install -y pkg-config libsystemd-dev libdbus-glib-1-dev libelf-dev libseccomp-dev
- name: Setup Rust toolchain and cache
uses: actions-rust-lang/setup-rust-toolchain@v1.3.7
- name: Install requirements
run: ./.github/scripts/dependency.sh
- name: Install runc 1.1.0
run: |
wget -q https://github.com/opencontainers/runc/releases/download/v1.1.0/runc.amd64

View File

@ -24,6 +24,7 @@ jobs:
tests/rust-integration-tests/runtimetest: ./tests/rust-integration-tests/runtimetest
tests/rust-integration-tests/integration_test: ./tests/rust-integration-tests/integration_test
tests/rust-integration-tests/test_framework: ./tests/rust-integration-tests/test_framework
check:
needs: [changes]
if: ${{ !contains(needs.changes.outputs.dirs, '[]') }}
@ -31,18 +32,14 @@ jobs:
timeout-minutes: 15
strategy:
matrix:
rust: [1.66.0, 1.67.0]
dirs: ${{ fromJSON(needs.changes.outputs.dirs) }}
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
override: true
- name: Cache youki
uses: Swatinem/rust-cache@v1
- name: Setup Rust toolchain and cache
uses: actions-rust-lang/setup-rust-toolchain@v1.3.7
- run: rustup component add rustfmt clippy
- run: sudo apt-get -y update
- name: Install requirements
run: ./.github/scripts/dependency.sh
- run: sudo apt-get install -y pkg-config libsystemd-dev libdbus-glib-1-dev libelf-dev libseccomp-dev
- name: Check formatting
run: cargo fmt --all -- --check
@ -50,49 +47,37 @@ jobs:
- name: Check clippy lints
working-directory: ${{matrix.dirs}}
run: cargo clippy --all-targets --all-features -- -D warnings
tests:
runs-on: ubuntu-20.04
timeout-minutes: 15
strategy:
matrix:
rust: [1.66.0, 1.67.0]
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
override: true
- name: Cache youki
uses: Swatinem/rust-cache@v1
- name: Install rus
run: rustup show
- run: sudo apt-get -y update
- run: sudo apt-get install -y pkg-config libsystemd-dev libdbus-glib-1-dev libelf-dev libseccomp-dev
- name: Run tests
run: |
export LD_LIBRARY_PATH=$HOME/.wasmedge/lib
cd ./crates && cargo test --all --all-features --no-fail-fast
coverage:
runs-on: ubuntu-20.04
timeout-minutes: 15
name: Run test coverage
steps:
- uses: actions/checkout@v3
- name: Toolchain setup
uses: actions-rs/toolchain@v1
with:
toolchain: 1.67.0
override: true
profile: minimal
components: llvm-tools-preview
- name: Cache youki
uses: Swatinem/rust-cache@v1
- name: Setup Rust toolchain and cache
uses: actions-rust-lang/setup-rust-toolchain@v1.3.7
- name: Install llvm-tools-preview
run: rustup component add llvm-tools-preview
- name: install cargo-llvm-cov
uses: taiki-e/install-action@v1
with:
tool: cargo-llvm-cov@0.4.0
- name: Update System Libraries
run: sudo apt-get -y update
- name: Install System Libraries
run: sudo apt-get install -y pkg-config libsystemd-dev libdbus-glib-1-dev libelf-dev libseccomp-dev
- name: Install requirements
run: ./.github/scripts/dependency.sh
- name: Run Test Coverage for youki
run: |
cargo llvm-cov clean --workspace
@ -102,27 +87,23 @@ jobs:
uses: codecov/codecov-action@v2
with:
file: ./coverage.lcov
integration_tests:
runs-on: ubuntu-20.04
timeout-minutes: 15
strategy:
matrix:
rust: [1.66.0, 1.67.0]
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
override: true
- name: Cache youki
uses: Swatinem/rust-cache@v1
- run: sudo apt-get -y update
- run: sudo apt-get install -y pkg-config libsystemd-dev libdbus-glib-1-dev libelf-dev libseccomp-dev
- uses: actions/setup-go@v2
- name: Setup Rust toolchain and cache
uses: actions-rust-lang/setup-rust-toolchain@v1.3.7
- name: Install requirements
run: ./.github/scripts/dependency.sh
- uses: actions/setup-go@v3
with:
go-version: "1.17.6"
cache: true
cache-dependency-path: tests/oci-runtime-tests/src/github.com/opencontainers/runtime-tools/go.sum
- name: Build
run: make youki-release
- name: Run integration tests

View File

@ -7,8 +7,8 @@ jobs:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- run: sudo apt-get -y update
- run: sudo apt-get install -y pkg-config libsystemd-dev libdbus-glib-1-dev libelf-dev libseccomp-dev libgpgme-dev bats
- name: Install requirements
run: ./.github/scripts/dependency.sh
- run: make youki-dev
- run: sudo cp youki /usr/local/bin
- name: Clone podman repository

View File

@ -12,13 +12,11 @@ jobs:
- uses: actions/checkout@v3
with:
submodules: recursive
- run: sudo apt-get -y update
- run: sudo apt-get install -y pkg-config libsystemd-dev libdbus-glib-1-dev libelf-dev libseccomp-dev libclang-dev
- name: Install requirements
run: ./.github/scripts/dependency.sh
- name: Set up cargo
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Setup Rust toolchain and cache
uses: actions-rust-lang/setup-rust-toolchain@v1.3.7
- name: Build
run: make youki-release
- name: test
@ -30,13 +28,11 @@ jobs:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- run: sudo apt-get -y update
- run: sudo apt-get install -y pkg-config libsystemd-dev libdbus-glib-1-dev libelf-dev libseccomp-dev
- name: Install requirements
run: ./.github/scripts/dependency.sh
- name: Set up cargo
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Setup Rust toolchain and cache
uses: actions-rust-lang/setup-rust-toolchain@v1.3.7
- name: Release build
run: make youki-release
- name: Create output directory
@ -104,11 +100,8 @@ jobs:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
steps:
- uses: actions/checkout@v3
- name: Set up cargo
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Setup Rust toolchain and cache
uses: actions-rust-lang/setup-rust-toolchain@v1.3.7
- name: Publish libcgroups
run: cargo publish -p libcgroups --no-verify
- name: Publish libcontainer

635
Cargo.lock generated
View File

@ -17,7 +17,7 @@ version = "0.19.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a76fd60b23679b7d19bd066031410fb7e458ccc5e958eb5c325888ce4baedc97"
dependencies = [
"gimli 0.27.0",
"gimli 0.27.1",
]
[[package]]
@ -63,9 +63,9 @@ dependencies = [
[[package]]
name = "anyhow"
version = "1.0.68"
version = "1.0.69"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2cb2f989d18dd141ab8ae82f64d1a8cdd37e0840f73a406896cf5e99502fab61"
checksum = "224afbd727c3d6e4b90103ece64b8d1b67fbb1973b1046c2281eed3f3803f800"
[[package]]
name = "arrayvec"
@ -107,7 +107,7 @@ dependencies = [
"cfg-if 1.0.0",
"libc",
"miniz_oxide",
"object 0.30.0",
"object 0.30.3",
"rustc-demangle",
]
@ -202,21 +202,21 @@ checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610"
[[package]]
name = "cap-fs-ext"
version = "1.0.3"
version = "1.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0f8079425cfd20227020f2bff1320710ca68d6eddb4f64aba8e2741b2b4d8133"
checksum = "ff40fd8a96d57a204080e5debd621342612f6d6b60901201a51f518baf72691d"
dependencies = [
"cap-primitives",
"cap-std",
"io-lifetimes",
"windows-sys 0.42.0",
"windows-sys 0.45.0",
]
[[package]]
name = "cap-primitives"
version = "1.0.3"
version = "1.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "84bf8faa0b6397a4e26082818be03641a40e3aba1afc4ec44cbd6228c73c3a61"
checksum = "9554a7698c8db4b7777f01b2237de111c5ecea169efb1190004d9069ceb289aa"
dependencies = [
"ambient-authority",
"fs-set-times",
@ -225,15 +225,15 @@ dependencies = [
"ipnet",
"maybe-owned",
"rustix",
"windows-sys 0.42.0",
"windows-sys 0.45.0",
"winx",
]
[[package]]
name = "cap-rand"
version = "1.0.4"
version = "1.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2a986c3b8fb6e25bbef961b237756ff7a771aa71c9ffdeb01c29f3f208577bf9"
checksum = "103e94d97d73504c5fa6ffb47135d5627ce5ff84a4ad37e8219103ddc291de24"
dependencies = [
"ambient-authority",
"rand",
@ -241,9 +241,9 @@ dependencies = [
[[package]]
name = "cap-std"
version = "1.0.3"
version = "1.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e4ad2b9e262a5c3b67ee92e4b9607ace704384c50c32aa6017a9282ddf15df20"
checksum = "a7b68a8ac703cc7bed0a46666a04b386cca214844897a69f599dcd82ea59422c"
dependencies = [
"cap-primitives",
"io-extras",
@ -254,9 +254,9 @@ dependencies = [
[[package]]
name = "cap-time-ext"
version = "1.0.3"
version = "1.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6dcbdbcced5c88b20f27c637faaed5dd283898cbefea48d2d8f3dcfaf048e5cc"
checksum = "472931750f90fbf0731c886c2937521e25772942577a182e7ace5bc561d10e3b"
dependencies = [
"cap-primitives",
"once_cell",
@ -333,9 +333,9 @@ dependencies = [
[[package]]
name = "clap"
version = "4.0.32"
version = "4.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a7db700bc935f9e43e88d00b0850dae18a63773cfbec6d8e070fccf7fef89a39"
checksum = "f13b9c79b5d1dd500d20ef541215a6423c75829ef43117e1b4d17fd8af0b5d76"
dependencies = [
"bitflags",
"clap_derive",
@ -348,18 +348,18 @@ dependencies = [
[[package]]
name = "clap_complete"
version = "4.0.7"
version = "4.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "10861370d2ba66b0f5989f83ebf35db6421713fd92351790e7fdd6c36774c56b"
checksum = "3d6540eedc41f8a5a76cf3d8d458057dcdf817be4158a55b5f861f7a5483de75"
dependencies = [
"clap",
]
[[package]]
name = "clap_derive"
version = "4.0.21"
version = "4.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0177313f9f02afc995627906bbd8967e2be069f5261954222dac78290c2b9014"
checksum = "684a277d672e91966334af371f1a7b5833f9aa00b07c84e92fbce95e00208ce8"
dependencies = [
"heck",
"proc-macro-error",
@ -460,11 +460,11 @@ dependencies = [
[[package]]
name = "cranelift-bforest"
version = "0.91.0"
version = "0.92.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fc952b310b24444fc14ab8b9cbe3fafd7e7329e3eec84c3a9b11d2b5cf6f3be1"
checksum = "2f3d54eab028f5805ae3b26fd60eca3f3a9cfb76b989d9bab173be3f61356cc3"
dependencies = [
"cranelift-entity 0.91.0",
"cranelift-entity 0.92.0",
]
[[package]]
@ -486,19 +486,19 @@ dependencies = [
[[package]]
name = "cranelift-codegen"
version = "0.91.0"
version = "0.92.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e73470419b33011e50dbf0f6439cbccbaabe9381de172da4e1b6efcda4bb8fa7"
checksum = "2be1d5f2c3cca1efb691844bc1988b89c77291f13f778499a3f3c0cf49c0ed61"
dependencies = [
"arrayvec",
"bumpalo",
"cranelift-bforest 0.91.0",
"cranelift-codegen-meta 0.91.0",
"cranelift-codegen-shared 0.91.0",
"cranelift-egraph",
"cranelift-entity 0.91.0",
"cranelift-bforest 0.92.0",
"cranelift-codegen-meta 0.92.0",
"cranelift-codegen-shared 0.92.0",
"cranelift-entity 0.92.0",
"cranelift-isle",
"gimli 0.26.2",
"hashbrown 0.12.3",
"log",
"regalloc2",
"smallvec",
@ -516,11 +516,11 @@ dependencies = [
[[package]]
name = "cranelift-codegen-meta"
version = "0.91.0"
version = "0.92.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "911a1872464108a11ac9965c2b079e61bbdf1bc2e0b9001264264add2e12a38f"
checksum = "3f9b1b1089750ce4005893af7ee00bb08a2cf1c9779999c0f7164cbc8ad2e0d2"
dependencies = [
"cranelift-codegen-shared 0.91.0",
"cranelift-codegen-shared 0.92.0",
]
[[package]]
@ -531,23 +531,9 @@ checksum = "01fd0d9f288cc1b42d9333b7a776b17e278fc888c28e6a0f09b5573d45a150bc"
[[package]]
name = "cranelift-codegen-shared"
version = "0.91.0"
version = "0.92.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e036f3f07adb24a86fb46e977e8fe03b18bb16b1eada949cf2c48283e5f8a862"
[[package]]
name = "cranelift-egraph"
version = "0.91.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2d6c623f4b5d2a6bad32c403f03765d4484a827eb93ee78f8cb6219ef118fd59"
dependencies = [
"cranelift-entity 0.91.0",
"fxhash",
"hashbrown 0.12.3",
"indexmap",
"log",
"smallvec",
]
checksum = "cc5fbaec51de47297fd7304986fd53c8c0030abbe69728a60d72e1c63559318d"
[[package]]
name = "cranelift-entity"
@ -557,9 +543,9 @@ checksum = "9e3bfe172b83167604601faf9dc60453e0d0a93415b57a9c4d1a7ae6849185cf"
[[package]]
name = "cranelift-entity"
version = "0.91.0"
version = "0.92.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "74385eb5e405b3562f0caa7bcc4ab9a93c7958dd5bcd0e910bffb7765eacd6fc"
checksum = "dab984c94593f876090fae92e984bdcc74d9b1acf740ab5f79036001c65cba13"
dependencies = [
"serde",
]
@ -578,11 +564,11 @@ dependencies = [
[[package]]
name = "cranelift-frontend"
version = "0.91.0"
version = "0.92.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8a4ac920422ee36bff2c66257fec861765e3d95a125cdf58d8c0f3bba7e40e61"
checksum = "6e0cb3102d21a2fe5f3210af608748ddd0cd09825ac12d42dc56ed5ed8725fe0"
dependencies = [
"cranelift-codegen 0.91.0",
"cranelift-codegen 0.92.0",
"log",
"smallvec",
"target-lexicon",
@ -590,34 +576,34 @@ dependencies = [
[[package]]
name = "cranelift-isle"
version = "0.91.0"
version = "0.92.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c541263fb37ad2baa53ec8c37218ee5d02fa0984670d9419dedd8002ea68ff08"
checksum = "72101dd1f441d629735143c41e00b3428f9267738176983ef588ff43382af0a0"
[[package]]
name = "cranelift-native"
version = "0.91.0"
version = "0.92.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1de5d7a063e8563d670aaca38de16591a9b70dc66cbad4d49a7b4ae8395fd1ce"
checksum = "c22b0d9fcbe3fc5a1af9e7021b44ce42b930bcefac446ce22e02e8f9a0d67120"
dependencies = [
"cranelift-codegen 0.91.0",
"cranelift-codegen 0.92.0",
"libc",
"target-lexicon",
]
[[package]]
name = "cranelift-wasm"
version = "0.91.0"
version = "0.92.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dfbc4dd03b713b5d71b582915b8c272f4813cdd8c99a3e03d9ba70c44468a6e0"
checksum = "bddebe32fb14fbfd9efa5f130ffb8f4665795de019928dcd7247b136c46f9249"
dependencies = [
"cranelift-codegen 0.91.0",
"cranelift-entity 0.91.0",
"cranelift-frontend 0.91.0",
"cranelift-codegen 0.92.0",
"cranelift-entity 0.92.0",
"cranelift-frontend 0.92.0",
"itertools",
"log",
"smallvec",
"wasmparser 0.95.0",
"wasmparser 0.96.0",
"wasmtime-types",
]
@ -709,9 +695,9 @@ dependencies = [
[[package]]
name = "cxx"
version = "1.0.89"
version = "1.0.91"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bc831ee6a32dd495436e317595e639a587aa9907bef96fe6e6abc290ab6204e9"
checksum = "86d3488e7665a7a483b57e25bdd90d0aeb2bc7608c8d0346acf2ad3f1caf1d62"
dependencies = [
"cc",
"cxxbridge-flags",
@ -721,9 +707,9 @@ dependencies = [
[[package]]
name = "cxx-build"
version = "1.0.89"
version = "1.0.91"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "94331d54f1b1a8895cd81049f7eaaaef9d05a7dcb4d1fd08bf3ff0806246789d"
checksum = "48fcaf066a053a41a81dfb14d57d99738b767febb8b735c3016e469fac5da690"
dependencies = [
"cc",
"codespan-reporting",
@ -736,15 +722,15 @@ dependencies = [
[[package]]
name = "cxxbridge-flags"
version = "1.0.89"
version = "1.0.91"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "48dcd35ba14ca9b40d6e4b4b39961f23d835dbb8eed74565ded361d93e1feb8a"
checksum = "a2ef98b8b717a829ca5603af80e1f9e2e48013ab227b68ef37872ef84ee479bf"
[[package]]
name = "cxxbridge-macro"
version = "1.0.89"
version = "1.0.91"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "81bbeb29798b407ccd82a3324ade1a7286e0d29851475990b612670f6f5124d2"
checksum = "086c685979a698443656e5cf7856c95c642295a38599f12fb1ff76fb28d19892"
dependencies = [
"proc-macro2",
"quote",
@ -753,9 +739,9 @@ dependencies = [
[[package]]
name = "darling"
version = "0.14.2"
version = "0.14.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b0dd3cd20dc6b5a876612a6e5accfe7f3dd883db6d07acfbf14c128f61550dfa"
checksum = "c0808e1bd8671fb44a113a14e13497557533369847788fa2ae912b6ebfce9fa8"
dependencies = [
"darling_core",
"darling_macro",
@ -763,9 +749,9 @@ dependencies = [
[[package]]
name = "darling_core"
version = "0.14.2"
version = "0.14.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a784d2ccaf7c98501746bf0be29b2022ba41fd62a2e622af997a03e9f972859f"
checksum = "001d80444f28e193f30c2f293455da62dcf9a6b29918a4253152ae2b1de592cb"
dependencies = [
"fnv",
"ident_case",
@ -777,9 +763,9 @@ dependencies = [
[[package]]
name = "darling_macro"
version = "0.14.2"
version = "0.14.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7618812407e9402654622dd402b0a89dff9ba93badd6540781526117b92aab7e"
checksum = "b36230598a2d5de7ec1c6f51f72d8a99a9208daff41de2084d06e3fd3ea56685"
dependencies = [
"darling_core",
"quote",
@ -958,9 +944,9 @@ dependencies = [
[[package]]
name = "enum-iterator"
version = "1.2.0"
version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "91a4ec26efacf4aeff80887a175a419493cb6f8b5480d26387eb0bd038976187"
checksum = "9ea166b3f7dc1032f7866d13f8d8e02c8d87507b61750176b86554964dc6a7bf"
dependencies = [
"enum-iterator-derive 1.1.0",
]
@ -1042,6 +1028,17 @@ dependencies = [
"winapi",
]
[[package]]
name = "errno"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "50d6a0976c999d473fe89ad888d5a284e55366d9dc9038b1ba2aa15128c4afa0"
dependencies = [
"errno-dragonfly",
"libc",
"windows-sys 0.45.0",
]
[[package]]
name = "errno-dragonfly"
version = "0.1.2"
@ -1060,22 +1057,22 @@ checksum = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7"
[[package]]
name = "fastrand"
version = "1.8.0"
version = "1.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a7a407cfaa3385c4ae6b23e84623d48c2798d06e3e6a1878f7f59f17b3f86499"
checksum = "e51093e27b0797c359783294ca4f0a911c270184cb10f85783b118614a1501be"
dependencies = [
"instant",
]
[[package]]
name = "fd-lock"
version = "3.0.9"
version = "3.0.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "28c0190ff0bd3b28bfdd4d0cf9f92faa12880fb0b8ae2054723dd6c76a4efd42"
checksum = "8ef1a30ae415c3a691a4f41afddc2dbcd6d70baf338368d85ebc1e8ed92cedb9"
dependencies = [
"cfg-if 1.0.0",
"rustix",
"windows-sys 0.42.0",
"windows-sys 0.45.0",
]
[[package]]
@ -1090,14 +1087,14 @@ dependencies = [
[[package]]
name = "filetime"
version = "0.2.19"
version = "0.2.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4e884668cd0c7480504233e951174ddc3b382f7c2666e3b7310b5c4e7b0c37f9"
checksum = "8a3de6e8d11b22ff9edc6d916f890800597d60f8b2da1caf2955c274638d6412"
dependencies = [
"cfg-if 1.0.0",
"libc",
"redox_syscall",
"windows-sys 0.42.0",
"windows-sys 0.45.0",
]
[[package]]
@ -1148,13 +1145,13 @@ checksum = "6c2141d6d6c8512188a7891b4b01590a45f6dac67afb4f255c4124dbb86d4eaa"
[[package]]
name = "fs-set-times"
version = "0.18.0"
version = "0.18.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e25ca26b0001154679ce0901527330e6153b670d17ccd1f86bab4e45dfba1a74"
checksum = "857cf27edcb26c2a36d84b2954019573d335bb289876113aceacacdca47a4fd4"
dependencies = [
"io-lifetimes",
"rustix",
"windows-sys 0.42.0",
"windows-sys 0.45.0",
]
[[package]]
@ -1311,15 +1308,15 @@ dependencies = [
[[package]]
name = "gimli"
version = "0.27.0"
version = "0.27.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dec7af912d60cdbd3677c1af9352ebae6fb8394d165568a2234df0fa00f87793"
checksum = "221996f774192f0f718773def8201c4ae31f02616a54ccfc2d358bb0e5cefdec"
[[package]]
name = "git2"
version = "0.15.0"
version = "0.16.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2994bee4a3a6a51eb90c218523be382fd7ea09b16380b9312e9dbe955ff7c7d1"
checksum = "ccf7f68c2995f392c49fffb4f95ae2c873297830eb25c6bc4c114ce8f4562acc"
dependencies = [
"bitflags",
"libc",
@ -1367,6 +1364,12 @@ dependencies = [
"libc",
]
[[package]]
name = "hermit-abi"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286"
[[package]]
name = "hex"
version = "0.4.3"
@ -1403,6 +1406,12 @@ dependencies = [
"cxx-build",
]
[[package]]
name = "id-arena"
version = "2.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "25a2bc672d1148e28034f176e01fffebb08b35768468cc954630da77a1449005"
[[package]]
name = "ident_case"
version = "1.0.1"
@ -1468,22 +1477,22 @@ dependencies = [
[[package]]
name = "io-extras"
version = "0.17.1"
version = "0.17.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b87bc110777311d7832025f38c4ab0f089f764644009edef3b5cbadfedee8c40"
checksum = "d79107d6e60d78351e11f0a2dc9d0eaf304a7efb592e92603783afb8479c7d97"
dependencies = [
"io-lifetimes",
"windows-sys 0.42.0",
"windows-sys 0.45.0",
]
[[package]]
name = "io-lifetimes"
version = "1.0.4"
version = "1.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e7d6c6f8c91b4b9ed43484ad1a938e393caf35960fce7f82a040497207bd8e9e"
checksum = "1abeb7a0dd0f8181267ff8adc397075586500b81b28a73e8a0208b00fc170fb3"
dependencies = [
"libc",
"windows-sys 0.42.0",
"windows-sys 0.45.0",
]
[[package]]
@ -1494,23 +1503,23 @@ checksum = "30e22bd8629359895450b59ea7a776c850561b96a3b1d31321c1949d9e6c9146"
[[package]]
name = "ipnetwork"
version = "0.19.0"
version = "0.20.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1f84f1612606f3753f205a4e9a2efd6fe5b4c573a6269b2cc6c3003d44a0d127"
checksum = "bf466541e9d546596ee94f9f69590f89473455f88372423e0008fc1a7daf100e"
dependencies = [
"serde",
]
[[package]]
name = "is-terminal"
version = "0.4.2"
version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "28dfb6c8100ccc63462345b67d1bbc3679177c75ee4bf59bf29c8b1d110b8189"
checksum = "22e18b0a45d56fe973d6db23972bf5bc46f988a4a2385deac9cc29572f09daef"
dependencies = [
"hermit-abi",
"hermit-abi 0.3.1",
"io-lifetimes",
"rustix",
"windows-sys 0.42.0",
"windows-sys 0.45.0",
]
[[package]]
@ -1608,7 +1617,7 @@ dependencies = [
"clap",
"dbus",
"env_logger 0.10.0",
"errno",
"errno 0.3.0",
"fixedbitset",
"libbpf-sys",
"libc",
@ -1661,9 +1670,9 @@ dependencies = [
[[package]]
name = "libdbus-sys"
version = "0.2.3"
version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2264f9d90a9b4e60a2dc722ad899ea0374f03c2e96e755fe22a8f551d4d5fb3c"
checksum = "9f8d7ae751e1cb825c840ae5e682f59b098cdfd213c350ac268b61449a5f58a0"
dependencies = [
"pkg-config",
]
@ -1814,9 +1823,9 @@ dependencies = [
[[package]]
name = "memmap2"
version = "0.5.8"
version = "0.5.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4b182332558b18d807c4ce1ca8ca983b34c3ee32765e47b3f0f69b90355cc1dc"
checksum = "2af2c65375e552a67fe3829ca63e8a7c27a378a62824594f43b2851d682b5ec2"
dependencies = [
"libc",
]
@ -1847,23 +1856,23 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
[[package]]
name = "miniz_oxide"
version = "0.6.4"
version = "0.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f2e212582ede878b109755efd0773a4f0f4ec851584cf0aefbeb4d9ecc114822"
checksum = "b275950c28b37e794e8c55d88aeb5e139d0ce23fdbbeda68f8d7174abdf9e8fa"
dependencies = [
"adler",
]
[[package]]
name = "mio"
version = "0.8.5"
version = "0.8.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e5d732bc30207a6423068df043e3d02e0735b155ad7ce1a6f76fe2baa5b158de"
checksum = "5b9d9a46eff5b4ff64b45a9e316a6d1e0bc719ef429cbec4dc630684212bfdf9"
dependencies = [
"libc",
"log",
"wasi 0.11.0+wasi-snapshot-preview1",
"windows-sys 0.42.0",
"windows-sys 0.45.0",
]
[[package]]
@ -1901,16 +1910,16 @@ checksum = "7843ec2de400bcbc6a6328c958dc38e5359da6e93e72e37bc5246bf1ae776389"
[[package]]
name = "nix"
version = "0.25.0"
version = "0.26.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e322c04a9e3440c327fca7b6c8a63e6890a32fa2ad689db972425f07e0d22abb"
checksum = "bfdda3d196821d6af13126e40375cdf7da646a96114af134d5f417a9a1dc8e1a"
dependencies = [
"autocfg",
"bitflags",
"cfg-if 1.0.0",
"libc",
"memoffset 0.6.5",
"memoffset 0.7.1",
"pin-utils",
"static_assertions",
]
[[package]]
@ -1980,16 +1989,7 @@ version = "1.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0fac9e2da13b5eb447a6ce3d392f23a29d8694bff781bf03a16cd9ac8697593b"
dependencies = [
"hermit-abi",
"libc",
]
[[package]]
name = "num_threads"
version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2819ce041d2ee131036f4fc9d6ae7ae125a3a40e97ba64d04fe799ad9dabbb44"
dependencies = [
"hermit-abi 0.2.6",
"libc",
]
@ -2019,9 +2019,9 @@ dependencies = [
[[package]]
name = "object"
version = "0.30.0"
version = "0.30.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "239da7f290cfa979f43f85a8efeee9a8a76d0827c356d37f9d3d7254d6b537fb"
checksum = "ea86265d3d3dcb6a27fc51bd29a4bf387fae9d2986b823079d4986af253eb439"
dependencies = [
"memchr",
]
@ -2055,9 +2055,9 @@ dependencies = [
[[package]]
name = "once_cell"
version = "1.17.0"
version = "1.17.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6f61fba1741ea2b3d6a1e3178721804bb716a68a6aeba1149b5d52e3d464ea66"
checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3"
[[package]]
name = "os_str_bytes"
@ -2077,15 +2077,15 @@ dependencies = [
[[package]]
name = "parking_lot_core"
version = "0.9.6"
version = "0.9.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ba1ef8814b5c993410bb3adfad7a5ed269563e4a2f90c41f5d85be7fb47133bf"
checksum = "9069cbb9f99e3a5083476ccb29ceb1de18b9118cafa53e90c9551235de2b9521"
dependencies = [
"cfg-if 1.0.0",
"libc",
"redox_syscall",
"smallvec",
"windows-sys 0.42.0",
"windows-sys 0.45.0",
]
[[package]]
@ -2142,18 +2142,18 @@ checksum = "6ac9a59f73473f1b8d852421e59e64809f025994837ef743615c6d0c5b305160"
[[package]]
name = "pnet_base"
version = "0.31.0"
version = "0.33.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f9d3a993d49e5fd5d4d854d6999d4addca1f72d86c65adf224a36757161c02b6"
checksum = "872e46346144ebf35219ccaa64b1dffacd9c6f188cd7d012bd6977a2a838f42e"
dependencies = [
"no-std-net",
]
[[package]]
name = "pnet_datalink"
version = "0.31.0"
version = "0.33.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e466faf03a98ad27f6e15cd27a2b7cc89e73e640a43527742977bc503c37f8aa"
checksum = "c302da22118d2793c312a35fb3da6846cb0fab6c3ad53fd67e37809b06cdafce"
dependencies = [
"ipnetwork",
"libc",
@ -2164,9 +2164,9 @@ dependencies = [
[[package]]
name = "pnet_sys"
version = "0.31.0"
version = "0.33.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "328e231f0add6d247d82421bf3790b4b33b39c8930637f428eef24c4c6a90805"
checksum = "faf7a58b2803d818a374be9278a1fe8f88fce14b936afbe225000cfcd9c73f16"
dependencies = [
"libc",
"winapi",
@ -2250,18 +2250,18 @@ checksum = "dc375e1527247fe1a97d8b7156678dfe7c1af2fc075c9a4db3690ecd2a148068"
[[package]]
name = "proc-macro2"
version = "1.0.50"
version = "1.0.51"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6ef7d57beacfaf2d8aee5937dab7b7f28de3cb8b1828479bb5de2a7106f2bae2"
checksum = "5d727cae5b39d21da60fa540906919ad737832fe0b1c165da3a34d6548c849d6"
dependencies = [
"unicode-ident",
]
[[package]]
name = "procfs"
version = "0.14.2"
version = "0.15.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b1de8dacb0873f77e6aefc6d71e044761fcc68060290f5b1089fcdf84626bb69"
checksum = "943ca7f9f29bab5844ecd8fdb3992c5969b6622bb9609b9502fef9b4310e3f1f"
dependencies = [
"bitflags",
"byteorder",
@ -2352,6 +2352,17 @@ dependencies = [
"syn",
]
[[package]]
name = "pulldown-cmark"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ffade02495f22453cd593159ea2f59827aae7f53fa8323f756799b670881dcf8"
dependencies = [
"bitflags",
"memchr",
"unicase",
]
[[package]]
name = "quickcheck"
version = "1.0.3"
@ -2519,18 +2530,18 @@ dependencies = [
[[package]]
name = "rend"
version = "0.3.6"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "79af64b4b6362ffba04eef3a4e10829718a4896dac19daa741851c86781edf95"
checksum = "581008d2099240d37fb08d77ad713bcaec2c4d89d50b5b21a8bb1996bbab68ab"
dependencies = [
"bytecheck",
]
[[package]]
name = "rkyv"
version = "0.7.39"
version = "0.7.40"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cec2b3485b07d96ddfd3134767b8a447b45ea4eb91448d0a35180ec0ffd5ed15"
checksum = "c30f1d45d9aa61cbc8cd1eb87705470892289bb2d01943e7803b873a57404dc3"
dependencies = [
"bytecheck",
"hashbrown 0.12.3",
@ -2542,9 +2553,9 @@ dependencies = [
[[package]]
name = "rkyv_derive"
version = "0.7.39"
version = "0.7.40"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6eaedadc88b53e36dd32d940ed21ae4d850d5916f2581526921f553a72ac34c4"
checksum = "ff26ed6c7c4dfc2aa9480b86a60e3c7233543a270a680e10758a507c5a4ce476"
dependencies = [
"proc-macro2",
"quote",
@ -2599,23 +2610,23 @@ version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366"
dependencies = [
"semver 1.0.13",
"semver 1.0.16",
]
[[package]]
name = "rustix"
version = "0.36.7"
version = "0.36.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d4fdebc4b395b7fbb9ab11e462e20ed9051e7b16e42d24042c776eca0ac81b03"
checksum = "f43abb88211988493c1abb44a70efa56ff0ce98f233b7b276146f1f3f7ba9644"
dependencies = [
"bitflags",
"errno",
"errno 0.2.8",
"io-lifetimes",
"itoa",
"libc",
"linux-raw-sys",
"once_cell",
"windows-sys 0.42.0",
"windows-sys 0.45.0",
]
[[package]]
@ -2659,9 +2670,9 @@ dependencies = [
[[package]]
name = "semver"
version = "1.0.13"
version = "1.0.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "93f6841e709003d68bb2deee8c343572bf446003ec20a583e76f7b15cebf3711"
checksum = "58bc9567378fc7690d6b2addae4e60ac2eeea07becb2c64b9f218b53865cba2a"
[[package]]
name = "semver-parser"
@ -2680,9 +2691,9 @@ dependencies = [
[[package]]
name = "serde_bytes"
version = "0.11.8"
version = "0.11.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "718dc5fff5b36f99093fc49b280cfc96ce6fc824317783bff5a1fed0c7a64819"
checksum = "416bda436f9aab92e02c8e10d49a15ddd339cea90b6e340fe51ed97abb548294"
dependencies = [
"serde",
]
@ -2700,9 +2711,9 @@ dependencies = [
[[package]]
name = "serde_json"
version = "1.0.91"
version = "1.0.93"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "877c235533714907a8c2464236f5c4b2a17262ef1bd71f38f35ea592c8da6883"
checksum = "cad406b69c91885b5107daf2c29572f6c8cdb3c66826821e286c533490c0bc76"
dependencies = [
"itoa",
"ryu",
@ -2788,9 +2799,9 @@ checksum = "43b2853a4d09f215c24cc5489c992ce46052d359b5109343cbafbf26bc62f8a3"
[[package]]
name = "slab"
version = "0.4.7"
version = "0.4.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4614a76b2a8be0058caa9dbbaf66d988527d86d003c11a94fbd335d7661edcef"
checksum = "6528351c9bc8ab22353f9d776db39a20288e8d6c37ef8cfe3317cf875eecfc2d"
dependencies = [
"autocfg",
]
@ -2822,6 +2833,12 @@ dependencies = [
"version_check",
]
[[package]]
name = "static_assertions"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
[[package]]
name = "stdweb"
version = "0.4.20"
@ -2915,9 +2932,9 @@ dependencies = [
[[package]]
name = "system-interface"
version = "0.25.3"
version = "0.25.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6afe2d3c354cfbfdc14611db99b272f59f80289a2abe30c8b4355ee619bc22ef"
checksum = "f355df185d945435f24c51fda9bf01bea6acb6c0b753e1241e5cc05413a659d4"
dependencies = [
"bitflags",
"cap-fs-ext",
@ -2925,7 +2942,7 @@ dependencies = [
"fd-lock",
"io-lifetimes",
"rustix",
"windows-sys 0.42.0",
"windows-sys 0.45.0",
"winx",
]
@ -2951,9 +2968,9 @@ dependencies = [
[[package]]
name = "target-lexicon"
version = "0.12.5"
version = "0.12.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9410d0f6853b1d94f0e519fb95df60f29d2c1eff2d921ffdf01a4c8a3b54f12d"
checksum = "8ae9980cab1db3fceee2f6c6f643d5d8de2997c58ee8d25fb0cc8a9e9e7348e5"
[[package]]
name = "tempfile"
@ -3033,22 +3050,29 @@ dependencies = [
"libc",
"standback",
"stdweb",
"time-macros",
"time-macros 0.1.1",
"version_check",
"winapi",
]
[[package]]
name = "time"
version = "0.3.14"
version = "0.3.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3c3f9a28b618c3a6b9251b6908e9c99e04b9e5c02e6581ccbb67d59c34ef7f9b"
checksum = "a561bf4617eebd33bca6434b988f39ed798e527f51a1e797d0ee4f61c0a38376"
dependencies = [
"itoa",
"libc",
"num_threads",
"serde",
"time-core",
"time-macros 0.2.6",
]
[[package]]
name = "time-core"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2e153e1f1acaef8acc537e68b44906d2db6436e2b35ac2c6b42640fff91f00fd"
[[package]]
name = "time-macros"
version = "0.1.1"
@ -3059,6 +3083,15 @@ dependencies = [
"time-macros-impl",
]
[[package]]
name = "time-macros"
version = "0.2.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d967f99f534ca7e495c575c62638eebc2898a8c84c119b89e250477bc4ba16b2"
dependencies = [
"time-core",
]
[[package]]
name = "time-macros-impl"
version = "0.1.2"
@ -3083,9 +3116,9 @@ dependencies = [
[[package]]
name = "tinyvec_macros"
version = "0.1.0"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c"
checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
[[package]]
name = "toml"
@ -3135,6 +3168,15 @@ version = "1.16.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba"
[[package]]
name = "unicase"
version = "2.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "50f37be617794602aabbeee0be4f259dc1778fabe05e2d67ee8f79326d5cb4f6"
dependencies = [
"version_check",
]
[[package]]
name = "unicode-bidi"
version = "0.3.10"
@ -3162,6 +3204,12 @@ version = "0.1.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b"
[[package]]
name = "unicode-xid"
version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c"
[[package]]
name = "url"
version = "2.3.1"
@ -3187,20 +3235,20 @@ checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426"
[[package]]
name = "vergen"
version = "7.5.0"
version = "7.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "571b69f690c855821462709b6f41d42ceccc316fbd17b60bd06d06928cfe6a99"
checksum = "f21b881cd6636ece9735721cf03c1fe1e774fe258683d084bb2812ab67435749"
dependencies = [
"anyhow",
"cfg-if 1.0.0",
"enum-iterator 1.2.0",
"enum-iterator 1.3.0",
"getset",
"git2",
"rustc_version 0.4.0",
"rustversion",
"sysinfo",
"thiserror",
"time 0.3.14",
"time 0.3.17",
]
[[package]]
@ -3223,9 +3271,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
[[package]]
name = "wasi-cap-std-sync"
version = "4.0.0"
version = "5.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "79eba5cf83a4adb2ccba4c029858229a4992dd88cc35dbfa5a555ec7fc2a8416"
checksum = "11254257c965082b671fb876e63a69c25af8d68b2b742d785593192b28df87a8"
dependencies = [
"anyhow",
"async-trait",
@ -3247,9 +3295,9 @@ dependencies = [
[[package]]
name = "wasi-common"
version = "4.0.0"
version = "5.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "678ff55fb89ae721dae166003b843f53ee3e7bdb96aa96715fec8d44d012b105"
checksum = "54c08c84016536b2407809253aa6c47eacf86d5b5ecd7741b50d23f18b5bb045"
dependencies = [
"anyhow",
"bitflags",
@ -3320,9 +3368,9 @@ checksum = "0046fef7e28c3804e5e38bfa31ea2a0f73905319b677e57ebe37e49358989b5d"
[[package]]
name = "wasm-encoder"
version = "0.22.0"
version = "0.24.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ef126be0e14bdf355ac1a8b41afc89195289e5c7179f80118e3abddb472f0810"
checksum = "704553b4d614a47080b4a457a976b3c16174b19ce95b931b847561b590dd09ba"
dependencies = [
"leb128",
]
@ -3667,9 +3715,9 @@ checksum = "718ed7c55c2add6548cca3ddd6383d738cd73b892df400e96b9aa876f0141d7a"
[[package]]
name = "wasmparser"
version = "0.95.0"
version = "0.96.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f2ea896273ea99b15132414be1da01ab0d8836415083298ecaffbe308eaac87a"
checksum = "adde01ade41ab9a5d10ec8ed0bb954238cf8625b5cd5a13093d6de2ad9c2be1a"
dependencies = [
"indexmap",
"url",
@ -3677,9 +3725,9 @@ dependencies = [
[[package]]
name = "wasmtime"
version = "4.0.0"
version = "5.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4abddf11816dd8f5e7310f6ebe5a2503b43f20ab2bf050b7d63f5b1bb96a81d9"
checksum = "4e5b183a159484980138cc05231419c536d395a7b25c1802091310ea2f74276a"
dependencies = [
"anyhow",
"async-trait",
@ -3695,8 +3743,9 @@ dependencies = [
"rayon",
"serde",
"target-lexicon",
"wasmparser 0.95.0",
"wasmparser 0.96.0",
"wasmtime-cache",
"wasmtime-component-macro",
"wasmtime-cranelift",
"wasmtime-environ",
"wasmtime-fiber",
@ -3708,18 +3757,18 @@ dependencies = [
[[package]]
name = "wasmtime-asm-macros"
version = "4.0.0"
version = "5.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c1f5206486f0467ba86e84d35996c4048b077cec2c9e5b322e7b853bdbe79334"
checksum = "c0aeb1cb256d76cf07b20264c808351c8b525ece56de1ef4d93f87a0aaf342db"
dependencies = [
"cfg-if 1.0.0",
]
[[package]]
name = "wasmtime-cache"
version = "4.0.0"
version = "5.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d1e77abcf538af42517e188c109e4b50ecf6c0ee4d77ede76a438e0306b934dc"
checksum = "830570847f905b8f6d2ca635c33cf42ce701dd8e4abd7d1806c631f8f06e9e4b"
dependencies = [
"anyhow",
"base64",
@ -3736,15 +3785,35 @@ dependencies = [
]
[[package]]
name = "wasmtime-cranelift"
version = "4.0.0"
name = "wasmtime-component-macro"
version = "5.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9e5bcb1d5ef211726b11e1286fe96cb40c69044c3632e1d6c67805d88a2e1a34"
checksum = "841561f7792cc46eea82dcf296393c5bab03259e663ff1bfccf71c2ae30e8920"
dependencies = [
"proc-macro2",
"quote",
"syn",
"wasmtime-component-util",
"wasmtime-wit-bindgen",
"wit-parser",
]
[[package]]
name = "wasmtime-component-util"
version = "5.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "048583c2e765cac3e8842dd18a50d4feb3049ef3f182880db6626d6eb8a29383"
[[package]]
name = "wasmtime-cranelift"
version = "5.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2f7695d3814dcb508bf4d1c181a86ea6b97a209f6444478e95d86e2ffab8d1a3"
dependencies = [
"anyhow",
"cranelift-codegen 0.91.0",
"cranelift-entity 0.91.0",
"cranelift-frontend 0.91.0",
"cranelift-codegen 0.92.0",
"cranelift-entity 0.92.0",
"cranelift-frontend 0.92.0",
"cranelift-native",
"cranelift-wasm",
"gimli 0.26.2",
@ -3752,18 +3821,18 @@ dependencies = [
"object 0.29.0",
"target-lexicon",
"thiserror",
"wasmparser 0.95.0",
"wasmparser 0.96.0",
"wasmtime-environ",
]
[[package]]
name = "wasmtime-environ"
version = "4.0.0"
version = "5.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dcab3fac5a2ff68ce9857166a7d7c0e5251b554839b9dda7ed3b5528e191936e"
checksum = "e5a2a5f0fb93aa837a727a48dd1076e8a9f882cc2fee20b433c04a18740ff63b"
dependencies = [
"anyhow",
"cranelift-entity 0.91.0",
"cranelift-entity 0.92.0",
"gimli 0.26.2",
"indexmap",
"log",
@ -3771,15 +3840,15 @@ dependencies = [
"serde",
"target-lexicon",
"thiserror",
"wasmparser 0.95.0",
"wasmparser 0.96.0",
"wasmtime-types",
]
[[package]]
name = "wasmtime-fiber"
version = "4.0.0"
version = "5.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2fb38af221b780f2c03764d763fe7f7bc414ea9db744d66dac98f9b694892561"
checksum = "a00a5cbf3ee623d01edea8882eb4352a5370513c6c1942cc5cd56dd806293a8d"
dependencies = [
"cc",
"cfg-if 1.0.0",
@ -3790,9 +3859,9 @@ dependencies = [
[[package]]
name = "wasmtime-jit"
version = "4.0.0"
version = "5.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a7d866e2a84ee164739b7ed7bd7cc9e1f918639d2ec5e2817a31e24c148cab20"
checksum = "01c78f9fb2922dbb5a95f009539d4badb44866caeeb53d156bf2cf4d683c3afd"
dependencies = [
"addr2line 0.17.0",
"anyhow",
@ -3815,9 +3884,9 @@ dependencies = [
[[package]]
name = "wasmtime-jit-debug"
version = "4.0.0"
version = "5.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0104c2b1ce443f2a2806216fcdf6dce09303203ec5797a698d313063b31e5bc8"
checksum = "67cacdb52a77b8c8e744e510beeabf0bd698b1c94c59eed33c52b3fbd19639b0"
dependencies = [
"object 0.29.0",
"once_cell",
@ -3826,9 +3895,9 @@ dependencies = [
[[package]]
name = "wasmtime-jit-icache-coherence"
version = "3.0.0"
version = "5.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "22d9c2e92b0fc124d2cad6cb497a4c840580a7dd2414a37109e8c7cfe699c0ea"
checksum = "08fcba5ebd96da2a9f0747ab6337fe9788adfb3f63fa2c180520d665562d257e"
dependencies = [
"cfg-if 1.0.0",
"libc",
@ -3837,9 +3906,9 @@ dependencies = [
[[package]]
name = "wasmtime-runtime"
version = "4.0.0"
version = "5.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0a1f0f99297a94cb20c511d1d4e864d9b54794644016d2530dc797cacfa7224a"
checksum = "0793210acf50d4c69182c916abaee1d423dc5d172cdfde6acfea2f9446725940"
dependencies = [
"anyhow",
"cc",
@ -3862,21 +3931,21 @@ dependencies = [
[[package]]
name = "wasmtime-types"
version = "4.0.0"
version = "5.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "62f3d8ee409447cae51651fd812437a0047ed8d7f44e94171ee05ce7cb955c96"
checksum = "50d015ba8b231248a811e323cf7a525cd3f982d4be0b9e62d27685102e5f12b1"
dependencies = [
"cranelift-entity 0.91.0",
"cranelift-entity 0.92.0",
"serde",
"thiserror",
"wasmparser 0.95.0",
"wasmparser 0.96.0",
]
[[package]]
name = "wasmtime-wasi"
version = "4.0.0"
version = "5.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9f32b06e3282ccbeab6fb96c64fa12a359f1253022dfd5cf99385b2344e70830"
checksum = "bd1271c6ec6585929986d059fc2e2365e7033e32ae3bc761ed4715fd47128308"
dependencies = [
"anyhow",
"wasi-cap-std-sync",
@ -3885,6 +3954,17 @@ dependencies = [
"wiggle",
]
[[package]]
name = "wasmtime-wit-bindgen"
version = "5.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f51b1f66bc176d85b4bfa0c86731f270697f6e0e673878846c7f2971ab895652"
dependencies = [
"anyhow",
"heck",
"wit-parser",
]
[[package]]
name = "wast"
version = "35.0.2"
@ -3896,9 +3976,9 @@ dependencies = [
[[package]]
name = "wast"
version = "52.0.2"
version = "54.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "707a9fd59b0144c530f0a31f21737036ffea6ece492918cae0843dd09b6f9bc9"
checksum = "f0d3df4a63b10958fe98ab9d7e9a57a7bc900209d2b4edd10535bfb0703e6516"
dependencies = [
"leb128",
"memchr",
@ -3908,11 +3988,11 @@ dependencies = [
[[package]]
name = "wat"
version = "1.0.56"
version = "1.0.59"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "91d73cbaa81acc2f8a3303e2289205c971d99c89245c2f56ab8765c4daabc2be"
checksum = "3e9a7c7d177696d0548178c36e377d49eba54170e885801d4270e2d44e82ac84"
dependencies = [
"wast 52.0.2",
"wast 54.0.0",
]
[[package]]
@ -3928,9 +4008,9 @@ dependencies = [
[[package]]
name = "wiggle"
version = "4.0.0"
version = "5.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7a2433252352677648dc4ac0c99e7e254e1c58be8019cda3323ab3a3ce29da5b"
checksum = "63d256f306e99e90343029170d81154319a976292c35eba68b05792532fa365e"
dependencies = [
"anyhow",
"async-trait",
@ -3943,9 +4023,9 @@ dependencies = [
[[package]]
name = "wiggle-generate"
version = "4.0.0"
version = "5.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c15bf89e66bd1a9463ee529d37b999947befafd792f345d4a82e0d2b28c0845f"
checksum = "9a0e55a87dcb350634c9f9b3ec08bfc87d7b05a0303a5fe8bb3134452ba3b62f"
dependencies = [
"anyhow",
"heck",
@ -3958,9 +4038,9 @@ dependencies = [
[[package]]
name = "wiggle-macro"
version = "4.0.0"
version = "5.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "919fb8f106375c7f6daf7b388a1fea3e2092dedb273b17b2d917522917c07a3c"
checksum = "b70901617926a441dbb03f3d208bd02b3fffbda13cadd9b17e7cf9389d9c067e"
dependencies = [
"proc-macro2",
"quote",
@ -4019,12 +4099,36 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7"
dependencies = [
"windows_aarch64_gnullvm",
"windows_aarch64_msvc 0.42.0",
"windows_i686_gnu 0.42.0",
"windows_i686_msvc 0.42.0",
"windows_x86_64_gnu 0.42.0",
"windows_aarch64_msvc 0.42.1",
"windows_i686_gnu 0.42.1",
"windows_i686_msvc 0.42.1",
"windows_x86_64_gnu 0.42.1",
"windows_x86_64_gnullvm",
"windows_x86_64_msvc 0.42.0",
"windows_x86_64_msvc 0.42.1",
]
[[package]]
name = "windows-sys"
version = "0.45.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0"
dependencies = [
"windows-targets",
]
[[package]]
name = "windows-targets"
version = "0.42.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e2522491fbfcd58cc84d47aeb2958948c4b8982e9a2d8a2a35bbaed431390e7"
dependencies = [
"windows_aarch64_gnullvm",
"windows_aarch64_msvc 0.42.1",
"windows_i686_gnu 0.42.1",
"windows_i686_msvc 0.42.1",
"windows_x86_64_gnu 0.42.1",
"windows_x86_64_gnullvm",
"windows_x86_64_msvc 0.42.1",
]
[[package]]
@ -4041,9 +4145,9 @@ checksum = "cd761fd3eb9ab8cc1ed81e56e567f02dd82c4c837e48ac3b2181b9ffc5060807"
[[package]]
name = "windows_aarch64_msvc"
version = "0.42.0"
version = "0.42.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dd0f252f5a35cac83d6311b2e795981f5ee6e67eb1f9a7f64eb4500fbc4dcdb4"
checksum = "4c8b1b673ffc16c47a9ff48570a9d85e25d265735c503681332589af6253c6c7"
[[package]]
name = "windows_i686_gnu"
@ -4053,9 +4157,9 @@ checksum = "cab0cf703a96bab2dc0c02c0fa748491294bf9b7feb27e1f4f96340f208ada0e"
[[package]]
name = "windows_i686_gnu"
version = "0.42.0"
version = "0.42.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fbeae19f6716841636c28d695375df17562ca208b2b7d0dc47635a50ae6c5de7"
checksum = "de3887528ad530ba7bdbb1faa8275ec7a1155a45ffa57c37993960277145d640"
[[package]]
name = "windows_i686_msvc"
@ -4065,9 +4169,9 @@ checksum = "8cfdbe89cc9ad7ce618ba34abc34bbb6c36d99e96cae2245b7943cd75ee773d0"
[[package]]
name = "windows_i686_msvc"
version = "0.42.0"
version = "0.42.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "84c12f65daa39dd2babe6e442988fc329d6243fdce47d7d2d155b8d874862246"
checksum = "bf4d1122317eddd6ff351aa852118a2418ad4214e6613a50e0191f7004372605"
[[package]]
name = "windows_x86_64_gnu"
@ -4077,9 +4181,9 @@ checksum = "b4dd9b0c0e9ece7bb22e84d70d01b71c6d6248b81a3c60d11869451b4cb24784"
[[package]]
name = "windows_x86_64_gnu"
version = "0.42.0"
version = "0.42.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bf7b1b21b5362cbc318f686150e5bcea75ecedc74dd157d874d754a2ca44b0ed"
checksum = "c1040f221285e17ebccbc2591ffdc2d44ee1f9186324dd3e84e99ac68d699c45"
[[package]]
name = "windows_x86_64_gnullvm"
@ -4095,19 +4199,32 @@ checksum = "ff1e4aa646495048ec7f3ffddc411e1d829c026a2ec62b39da15c1055e406eaa"
[[package]]
name = "windows_x86_64_msvc"
version = "0.42.0"
version = "0.42.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f40009d85759725a34da6d89a94e63d7bdc50a862acf0dbc7c8e488f1edcb6f5"
checksum = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd"
[[package]]
name = "winx"
version = "0.34.0"
version = "0.35.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9baf690e238840de84bbfad6ad72d6628c41d34c1a5e276dab7fb2c9167ca1ac"
checksum = "129cd8ee937d535e1a239d9d3c9c0525af0454bc0967d9211a251be062513520"
dependencies = [
"bitflags",
"io-lifetimes",
"windows-sys 0.42.0",
"windows-sys 0.45.0",
]
[[package]]
name = "wit-parser"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "703eb1d2f89ff2c52d50f7ff002735e423cea75f0a5dc5c8a4626c4c47cd9ca6"
dependencies = [
"anyhow",
"id-arena",
"indexmap",
"pulldown-cmark",
"unicode-xid",
]
[[package]]
@ -4177,9 +4294,9 @@ dependencies = [
[[package]]
name = "zstd-sys"
version = "2.0.6+zstd.1.5.2"
version = "2.0.7+zstd.1.5.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "68a3f9792c0c3dc6c165840a75f47ae1f4da402c2d006881129579f6597e801b"
checksum = "94509c3ba2fe55294d752b79842c530ccfab760192521df74a081a78d2b3c7f5"
dependencies = [
"cc",
"libc",

View File

@ -20,8 +20,8 @@ systemd = ["v2", "dep:dbus"]
cgroupsv2_devices = ["rbpf", "libbpf-sys", "errno", "libc"]
[dependencies]
nix = "0.25.0"
procfs = "0.14.2"
nix = "0.26.2"
procfs = "0.15.1"
log = "0.4"
anyhow = "1.0"
oci-spec = { version = "^0.5.5", features = ["runtime"] }
@ -30,7 +30,7 @@ fixedbitset = "0.4.2"
serde = { version = "1.0", features = ["derive"] }
rbpf = {version = "0.1.0", optional = true }
libbpf-sys = { version = "1.1.1+v1.0.1", optional = true }
errno = { version = "0.2.8", optional = true }
errno = { version = "0.3.0", optional = true }
libc = { version = "0.2.139", optional = true }
[dev-dependencies]

View File

@ -64,7 +64,7 @@ impl Display for CgroupSetup {
CgroupSetup::Unified => "unified",
};
write!(f, "{}", print)
write!(f, "{print}")
}
}
@ -124,7 +124,7 @@ pub fn write_cgroup_file<P: AsRef<Path>, T: ToString>(path: P, data: T) -> Resul
#[inline]
pub fn read_cgroup_file<P: AsRef<Path>>(path: P) -> Result<String> {
let path = path.as_ref();
fs::read_to_string(path).with_context(|| format!("failed to open {:?}", path))
fs::read_to_string(path).with_context(|| format!("failed to open {path:?}"))
}
/// Determines the cgroup setup of the system. Systems typically have one of

View File

@ -238,7 +238,7 @@ fn extract_page_size(dir_name: &str) -> Result<String> {
pub fn parse_value(value: &str) -> Result<u64> {
value
.parse()
.with_context(|| format!("failed to parse {}", value))
.with_context(|| format!("failed to parse {value}"))
}
/// Parses a single valued file to an u64

View File

@ -18,7 +18,7 @@ impl Display for ControllerType {
ControllerType::Pids => "pids",
};
write!(f, "{}", print)
write!(f, "{print}")
}
}

View File

@ -99,7 +99,7 @@ impl SystemdClient for Client {
let mut properties: Vec<(&str, Variant<Box<dyn RefArg>>)> = Vec::with_capacity(6);
properties.push((
"Description",
Variant(Box::new(format!("youki container {}", container_name))),
Variant(Box::new(format!("youki container {container_name}"))),
));
// if we create a slice, the parent is defined via a Wants=
@ -123,10 +123,7 @@ impl SystemdClient for Client {
proxy
.start_transient_unit(unit_name, "replace", properties, vec![])
.with_context(|| {
format!(
"failed to start transient unit {}, parent is {}",
unit_name, parent
)
format!("failed to start transient unit {unit_name}, parent is {parent}")
})?;
Ok(())
}
@ -136,7 +133,7 @@ impl SystemdClient for Client {
proxy
.stop_unit(unit_name, "replace")
.with_context(|| format!("failed to stop unit {}", unit_name))?;
.with_context(|| format!("failed to stop unit {unit_name}"))?;
Ok(())
}
@ -154,7 +151,7 @@ impl SystemdClient for Client {
proxy
.set_unit_properties(unit_name, true, props)
.with_context(|| format!("failed to set properties for unit {:?}", unit_name))?;
.with_context(|| format!("failed to set properties for unit {unit_name:?}"))?;
Ok(())
}
@ -181,6 +178,6 @@ impl SystemdClient for Client {
.control_group()
.context("failed to get systemd control group")?;
PathBuf::try_from(&cgroup_root)
.with_context(|| format!("parse systemd control cgroup {} into path", cgroup_root))
.with_context(|| format!("parse systemd control cgroup {cgroup_root} into path"))
}
}

View File

@ -136,7 +136,7 @@ impl Manager {
let mut destructured_path = cgroups_path
.as_path()
.try_into()
.with_context(|| format!("failed to destructure cgroups path {:?}", cgroups_path))?;
.with_context(|| format!("failed to destructure cgroups path {cgroups_path:?}"))?;
ensure_parent_unit(&mut destructured_path, use_system);
let client = match use_system {
@ -189,9 +189,9 @@ impl Manager {
let cgroups_path = systemd_root
.join_safely(&parent)
.with_context(|| format!("failed to join {:?} with {:?}", systemd_root, parent))?
.with_context(|| format!("failed to join {systemd_root:?} with {parent:?}"))?
.join_safely(&unit_name)
.with_context(|| format!("failed to join {:?} with {:?}", parent, unit_name))?;
.with_context(|| format!("failed to join {parent:?} with {unit_name:?}"))?;
Ok((cgroups_path, systemd_root))
}
@ -218,8 +218,8 @@ impl Manager {
bail!("invalid slice name: {}", slice);
}
// Append the component to the path and to the prefix.
path = format!("{}/{}{}{}", path, prefix, component, suffix);
prefix = format!("{}{}-", prefix, component);
path = format!("{path}/{prefix}{component}{suffix}");
prefix = format!("{prefix}{component}-");
}
Ok(Path::new(&path).to_path_buf())
}

View File

@ -39,7 +39,7 @@ impl Unified {
"cpu.weight" => {
let shares = value
.parse::<u64>()
.with_context(|| format!("failed to parse cpu weight: {}", value))?;
.with_context(|| format!("failed to parse cpu weight: {value}"))?;
properties.insert(cpu::CPU_WEIGHT, Box::new(convert_shares_to_cgroup2(shares)));
}
"cpu.max" => {
@ -69,7 +69,7 @@ impl Unified {
}
let bitmask = to_bitmask(value)
.with_context(|| format!("invalid value for cpuset.cpus: {}", value))?;
.with_context(|| format!("invalid value for cpuset.cpus: {value}"))?;
let systemd_cpuset = match cpuset {
"cpuset.cpus" => cpuset::ALLOWED_CPUS,
@ -82,7 +82,7 @@ impl Unified {
memory @ ("memory.min" | "memory.low" | "memory.high" | "memory.max") => {
let value = value
.parse::<u64>()
.with_context(|| format!("failed to parse {}: {}", memory, value))?;
.with_context(|| format!("failed to parse {memory}: {value}"))?;
let systemd_memory = match memory {
"memory.min" => memory::MEMORY_MIN,
"memory.low" => memory::MEMORY_LOW,
@ -145,10 +145,10 @@ mod tests {
// assert
for (setting, value) in expected {
assert!(actual.contains_key(setting));
assert_eq!(value.arg_type(), actual[setting].arg_type(), "{}", setting);
assert_eq!(value.arg_type(), actual[setting].arg_type(), "{setting}");
match value.arg_type() {
ArgType::UInt64 => {
assert_eq!(value.as_u64(), actual[setting].as_u64(), "{}", setting)
assert_eq!(value.as_u64(), actual[setting].as_u64(), "{setting}")
}
ArgType::Array => assert_eq!(
value.as_iter().unwrap().next().unwrap().as_u64(),

View File

@ -61,7 +61,7 @@ pub fn create_temp_dir(test_name: &str) -> Result<TempDir> {
pub fn setup(testname: &str, cgroup_file: &str) -> (TempDir, PathBuf) {
let tmp = create_temp_dir(testname).expect("create temp directory for test");
let cgroup_file = set_fixture(&tmp, cgroup_file, "")
.unwrap_or_else(|_| panic!("set test fixture for {}", cgroup_file));
.unwrap_or_else(|_| panic!("set test fixture for {cgroup_file}"));
(tmp, cgroup_file)
}
@ -74,9 +74,9 @@ pub fn set_fixture(temp_dir: &Path, filename: &str, val: &str) -> Result<PathBuf
.write(true)
.truncate(true)
.open(&full_path)
.with_context(|| format!("failed to open {:?}", full_path))?
.with_context(|| format!("failed to open {full_path:?}"))?
.write_all(val.as_bytes())
.with_context(|| format!("failed to write to {:?}", full_path))?;
.with_context(|| format!("failed to write to {full_path:?}"))?;
Ok(full_path)
}

View File

@ -275,7 +275,7 @@ mod tests {
Blkio::apply(&tmp, &blkio).expect("apply blkio");
let content = fs::read_to_string(throttle)
.unwrap_or_else(|_| panic!("read {} content", BLKIO_THROTTLE_READ_BPS));
.unwrap_or_else(|_| panic!("read {BLKIO_THROTTLE_READ_BPS} content"));
assert_eq!("8:0 102400", content);
}
@ -296,7 +296,7 @@ mod tests {
Blkio::apply(&tmp, &blkio).expect("apply blkio");
let content = fs::read_to_string(throttle)
.unwrap_or_else(|_| panic!("read {} content", BLKIO_THROTTLE_WRITE_BPS));
.unwrap_or_else(|_| panic!("read {BLKIO_THROTTLE_WRITE_BPS} content"));
assert_eq!("8:0 102400", content);
}
@ -317,7 +317,7 @@ mod tests {
Blkio::apply(&tmp, &blkio).expect("apply blkio");
let content = fs::read_to_string(throttle)
.unwrap_or_else(|_| panic!("read {} content", BLKIO_THROTTLE_READ_IOPS));
.unwrap_or_else(|_| panic!("read {BLKIO_THROTTLE_READ_IOPS} content"));
assert_eq!("8:0 102400", content);
}
@ -338,7 +338,7 @@ mod tests {
Blkio::apply(&tmp, &blkio).expect("apply blkio");
let content = fs::read_to_string(throttle)
.unwrap_or_else(|_| panic!("read {} content", BLKIO_THROTTLE_WRITE_IOPS));
.unwrap_or_else(|_| panic!("read {BLKIO_THROTTLE_WRITE_IOPS} content"));
assert_eq!("8:0 102400", content);
}

View File

@ -33,7 +33,7 @@ impl Display for ControllerType {
Self::Freezer => "freezer",
};
write!(f, "{}", print)
write!(f, "{print}")
}
}

View File

@ -152,7 +152,7 @@ mod tests {
// arrange
let (tmp, shares) = setup("test_set_shares", CGROUP_CPU_SHARES);
let _ = set_fixture(&tmp, CGROUP_CPU_SHARES, "")
.unwrap_or_else(|_| panic!("set test fixture for {}", CGROUP_CPU_SHARES));
.unwrap_or_else(|_| panic!("set test fixture for {CGROUP_CPU_SHARES}"));
let cpu = LinuxCpuBuilder::default().shares(2048u64).build().unwrap();
// act
@ -160,7 +160,7 @@ mod tests {
// assert
let content = fs::read_to_string(shares)
.unwrap_or_else(|_| panic!("read {} file content", CGROUP_CPU_SHARES));
.unwrap_or_else(|_| panic!("read {CGROUP_CPU_SHARES} file content"));
assert_eq!(content, 2048.to_string());
}
@ -176,7 +176,7 @@ mod tests {
// assert
let content = fs::read_to_string(max)
.unwrap_or_else(|_| panic!("read {} file content", CGROUP_CPU_QUOTA));
.unwrap_or_else(|_| panic!("read {CGROUP_CPU_QUOTA} file content"));
assert_eq!(content, QUOTA.to_string());
}
@ -192,7 +192,7 @@ mod tests {
// assert
let content = fs::read_to_string(max)
.unwrap_or_else(|_| panic!("read {} file content", CGROUP_CPU_PERIOD));
.unwrap_or_else(|_| panic!("read {CGROUP_CPU_PERIOD} file content"));
assert_eq!(content, PERIOD.to_string());
}
@ -211,7 +211,7 @@ mod tests {
// assert
let content = fs::read_to_string(max)
.unwrap_or_else(|_| panic!("read {} file content", CGROUP_CPU_RT_RUNTIME));
.unwrap_or_else(|_| panic!("read {CGROUP_CPU_RT_RUNTIME} file content"));
assert_eq!(content, RUNTIME.to_string());
}
@ -238,7 +238,7 @@ mod tests {
// assert
let content = fs::read_to_string(max)
.unwrap_or_else(|_| panic!("read {} file content", CGROUP_CPU_IDLE));
.unwrap_or_else(|_| panic!("read {CGROUP_CPU_IDLE} file content"));
assert_eq!(content, IDLE.to_string());
}
@ -257,7 +257,7 @@ mod tests {
// assert
let content = fs::read_to_string(max)
.unwrap_or_else(|_| panic!("read {} file content", CGROUP_CPU_RT_PERIOD));
.unwrap_or_else(|_| panic!("read {CGROUP_CPU_RT_PERIOD} file content"));
assert_eq!(content, PERIOD.to_string());
}

View File

@ -140,9 +140,9 @@ mod tests {
let tmp = create_temp_dir(test_name).expect("create temp directory for test");
let _ = set_fixture(&tmp, CGROUP_CPUACCT_STAT, stat_content)
.unwrap_or_else(|_| panic!("create {} file", CGROUP_CPUACCT_STAT));
.unwrap_or_else(|_| panic!("create {CGROUP_CPUACCT_STAT} file"));
let _ = set_fixture(&tmp, CGROUP_CPUACCT_USAGE, usage_content)
.unwrap_or_else(|_| panic!("create {} file", CGROUP_CPUACCT_USAGE));
.unwrap_or_else(|_| panic!("create {CGROUP_CPUACCT_USAGE} file"));
tmp
}
@ -151,9 +151,9 @@ mod tests {
let tmp = create_temp_dir(test_name).expect("create temp directory for test");
let _ = set_fixture(&tmp, CGROUP_CPUACCT_PERCPU, percpu_content)
.unwrap_or_else(|_| panic!("create {} file", CGROUP_CPUACCT_PERCPU));
.unwrap_or_else(|_| panic!("create {CGROUP_CPUACCT_PERCPU} file"));
let _ = set_fixture(&tmp, CGROUP_CPUACCT_USAGE_ALL, usage_all_content)
.unwrap_or_else(|_| panic!("create {} file", CGROUP_CPUACCT_USAGE_ALL));
.unwrap_or_else(|_| panic!("create {CGROUP_CPUACCT_USAGE_ALL} file"));
tmp
}
@ -166,7 +166,7 @@ mod tests {
CpuAcct::add_task(pid, &tmp).expect("apply cpuacct");
let content = fs::read_to_string(procs)
.unwrap_or_else(|_| panic!("read {} file content", CGROUP_PROCS));
.unwrap_or_else(|_| panic!("read {CGROUP_PROCS} file content"));
assert_eq!(content, "1000");
}

View File

@ -110,7 +110,7 @@ mod tests {
// assert
let content = fs::read_to_string(cpus)
.unwrap_or_else(|_| panic!("read {} file content", CGROUP_CPUSET_CPUS));
.unwrap_or_else(|_| panic!("read {CGROUP_CPUSET_CPUS} file content"));
assert_eq!(content, "1-3");
}
@ -128,7 +128,7 @@ mod tests {
// assert
let content = fs::read_to_string(mems)
.unwrap_or_else(|_| panic!("read {} file content", CGROUP_CPUSET_MEMS));
.unwrap_or_else(|_| panic!("read {CGROUP_CPUSET_MEMS} file content"));
assert_eq!(content, "1-3");
}
}

View File

@ -81,15 +81,15 @@ impl HugeTlb {
fn stats_for_page_size(cgroup_path: &Path, page_size: &str) -> Result<HugeTlbStats> {
let mut stats = HugeTlbStats::default();
let usage_file = format!("hugetlb.{}.usage_in_bytes", page_size);
let usage_file = format!("hugetlb.{page_size}.usage_in_bytes");
let usage_content = common::read_cgroup_file(cgroup_path.join(usage_file))?;
stats.usage = usage_content.trim().parse()?;
let max_file = format!("hugetlb.{}.max_usage_in_bytes", page_size);
let max_file = format!("hugetlb.{page_size}.max_usage_in_bytes");
let max_content = common::read_cgroup_file(cgroup_path.join(max_file))?;
stats.max_usage = max_content.trim().parse()?;
let failcnt_file = format!("hugetlb.{}.failcnt", page_size);
let failcnt_file = format!("hugetlb.{page_size}.failcnt");
let failcnt_content = common::read_cgroup_file(cgroup_path.join(failcnt_file))?;
stats.fail_count = failcnt_content.trim().parse()?;

View File

@ -134,16 +134,16 @@ impl Memory {
fn get_memory_data(cgroup_path: &Path, file_prefix: &str) -> Result<MemoryData> {
let memory_data = MemoryData {
usage: parse_single_value(
&cgroup_path.join(format!("{}{}", file_prefix, MEMORY_USAGE_IN_BYTES)),
&cgroup_path.join(format!("{file_prefix}{MEMORY_USAGE_IN_BYTES}")),
)?,
max_usage: parse_single_value(
&cgroup_path.join(format!("{}{}", file_prefix, MEMORY_MAX_USAGE_IN_BYTES)),
&cgroup_path.join(format!("{file_prefix}{MEMORY_MAX_USAGE_IN_BYTES}")),
)?,
limit: parse_single_value(
&cgroup_path.join(format!("{}{}", file_prefix, MEMORY_LIMIT_IN_BYTES)),
&cgroup_path.join(format!("{file_prefix}{MEMORY_LIMIT_IN_BYTES}")),
)?,
fail_count: parse_single_value(
&cgroup_path.join(format!("{}{}", file_prefix, MEMORY_FAIL_COUNT)),
&cgroup_path.join(format!("{file_prefix}{MEMORY_FAIL_COUNT}")),
)?,
};
@ -522,11 +522,11 @@ mod tests {
};
// useful for debugging
println!("reservation_check: {:?}", reservation_check);
println!("kernel_check: {:?}", kernel_check);
println!("kernel_tcp_check: {:?}", kernel_tcp_check);
println!("swappiness_check: {:?}", swappiness_check);
println!("limit_swap_check: {:?}", limit_swap_check);
println!("reservation_check: {reservation_check:?}");
println!("kernel_check: {kernel_check:?}");
println!("kernel_tcp_check: {kernel_tcp_check:?}");
println!("swappiness_check: {swappiness_check:?}");
println!("limit_swap_check: {limit_swap_check:?}");
// combine all the checks
reservation_check && kernel_check && kernel_tcp_check && swappiness_check && limit_swap_check
@ -538,28 +538,23 @@ mod tests {
let tmp = create_temp_dir("test_stat_memory_data").expect("create test directory");
set_fixture(
&tmp,
&format!("{}{}", MEMORY_PREFIX, MEMORY_USAGE_IN_BYTES),
&format!("{MEMORY_PREFIX}{MEMORY_USAGE_IN_BYTES}"),
"1024\n",
)
.unwrap();
set_fixture(
&tmp,
&format!("{}{}", MEMORY_PREFIX, MEMORY_MAX_USAGE_IN_BYTES),
&format!("{MEMORY_PREFIX}{MEMORY_MAX_USAGE_IN_BYTES}"),
"2048\n",
)
.unwrap();
set_fixture(
&tmp,
&format!("{}{}", MEMORY_PREFIX, MEMORY_LIMIT_IN_BYTES),
&format!("{MEMORY_PREFIX}{MEMORY_LIMIT_IN_BYTES}"),
"4096\n",
)
.unwrap();
set_fixture(
&tmp,
&format!("{}{}", MEMORY_PREFIX, MEMORY_FAIL_COUNT),
"5\n",
)
.unwrap();
set_fixture(&tmp, &format!("{MEMORY_PREFIX}{MEMORY_FAIL_COUNT}"), "5\n").unwrap();
let actual = Memory::get_memory_data(&tmp, MEMORY_PREFIX).expect("get cgroup stats");
let expected = MemoryData {

View File

@ -34,7 +34,7 @@ mod tests {
PerfEvent::add_task(pid, &tmp).expect("apply perf_event");
let content = fs::read_to_string(procs)
.unwrap_or_else(|_| panic!("read {} file content", CGROUP_PROCS));
.unwrap_or_else(|_| panic!("read {CGROUP_PROCS} file content"));
assert_eq!(content, "1000");
}
}

View File

@ -21,7 +21,7 @@ impl Display for ControllerType {
Self::Pids => "pids",
};
write!(f, "{}", print)
write!(f, "{print}")
}
}
@ -49,7 +49,7 @@ impl Display for PseudoControllerType {
Self::Unified => "unified",
};
write!(f, "{}", print)
write!(f, "{print}")
}
}

View File

@ -79,11 +79,9 @@ impl Cpu {
(None, Some(period)) => Self::create_period_only_value(&cpu_max_file, period)?,
(Some(quota), None) if quota > 0 => Some(quota.to_string().into()),
(Some(quota), None) if quota <= 0 => Some(UNRESTRICTED_QUOTA.into()),
(Some(quota), Some(period)) if quota > 0 => {
Some(format!("{} {}", quota, period).into())
}
(Some(quota), Some(period)) if quota > 0 => Some(format!("{quota} {period}").into()),
(Some(quota), Some(period)) if quota <= 0 => {
Some(format!("{} {}", UNRESTRICTED_QUOTA, period).into())
Some(format!("{UNRESTRICTED_QUOTA} {period}").into())
}
_ => None,
};
@ -131,7 +129,7 @@ impl Cpu {
fn create_period_only_value(cpu_max_file: &Path, period: u64) -> Result<Option<Cow<str>>> {
let old_cpu_max = common::read_cgroup_file(cpu_max_file)?;
if let Some(old_quota) = old_cpu_max.split_whitespace().next() {
return Ok(Some(format!("{} {}", old_quota, period).into()));
return Ok(Some(format!("{old_quota} {period}").into()));
}
Ok(None)
}
@ -152,7 +150,7 @@ mod tests {
// arrange
let (tmp, weight) = setup("test_set_shares", CGROUP_CPU_WEIGHT);
let _ = set_fixture(&tmp, CGROUP_CPU_MAX, "")
.unwrap_or_else(|_| panic!("set test fixture for {}", CGROUP_CPU_MAX));
.unwrap_or_else(|_| panic!("set test fixture for {CGROUP_CPU_MAX}"));
let cpu = LinuxCpuBuilder::default().shares(22000u64).build().unwrap();
// act
@ -160,7 +158,7 @@ mod tests {
// assert
let content = fs::read_to_string(weight)
.unwrap_or_else(|_| panic!("read {} file content", CGROUP_CPU_WEIGHT));
.unwrap_or_else(|_| panic!("read {CGROUP_CPU_WEIGHT} file content"));
assert_eq!(content, 840.to_string());
}
@ -187,8 +185,8 @@ mod tests {
// assert
let content = fs::read_to_string(max)
.unwrap_or_else(|_| panic!("read {} file content", CGROUP_CPU_IDLE));
assert_eq!(content, format!("{}", IDLE))
.unwrap_or_else(|_| panic!("read {CGROUP_CPU_IDLE} file content"));
assert_eq!(content, format!("{IDLE}"))
}
#[test]
@ -203,8 +201,8 @@ mod tests {
// assert
let content = fs::read_to_string(max)
.unwrap_or_else(|_| panic!("read {} file content", CGROUP_CPU_MAX));
assert_eq!(content, format!("{}", QUOTA))
.unwrap_or_else(|_| panic!("read {CGROUP_CPU_MAX} file content"));
assert_eq!(content, format!("{QUOTA}"))
}
#[test]
@ -218,7 +216,7 @@ mod tests {
// assert
let content = fs::read_to_string(max)
.unwrap_or_else(|_| panic!("read {} file content", CGROUP_CPU_MAX));
.unwrap_or_else(|_| panic!("read {CGROUP_CPU_MAX} file content"));
assert_eq!(content, UNRESTRICTED_QUOTA)
}
@ -236,8 +234,8 @@ mod tests {
// assert
let content = fs::read_to_string(max)
.unwrap_or_else(|_| panic!("read {} file content", CGROUP_CPU_MAX));
assert_eq!(content, format!("{} {}", QUOTA, PERIOD))
.unwrap_or_else(|_| panic!("read {CGROUP_CPU_MAX} file content"));
assert_eq!(content, format!("{QUOTA} {PERIOD}"))
}
#[test]
@ -257,8 +255,8 @@ mod tests {
// assert
let content = fs::read_to_string(max)
.unwrap_or_else(|_| panic!("read {} file content", CGROUP_CPU_MAX));
assert_eq!(content, format!("{} {}", QUOTA, PERIOD));
.unwrap_or_else(|_| panic!("read {CGROUP_CPU_MAX} file content"));
assert_eq!(content, format!("{QUOTA} {PERIOD}"));
}
#[test]

View File

@ -58,7 +58,7 @@ mod tests {
// assert
let content = fs::read_to_string(cpus)
.unwrap_or_else(|_| panic!("read {} file content", CGROUP_CPUSET_CPUS));
.unwrap_or_else(|_| panic!("read {CGROUP_CPUSET_CPUS} file content"));
assert_eq!(content, "1-3");
}
@ -76,7 +76,7 @@ mod tests {
// assert
let content = fs::read_to_string(mems)
.unwrap_or_else(|_| panic!("read {} file content", CGROUP_CPUSET_MEMS));
.unwrap_or_else(|_| panic!("read {CGROUP_CPUSET_MEMS} file content"));
assert_eq!(content, "1-3");
}
}

View File

@ -287,10 +287,7 @@ mod tests {
let ret = prog.execute(*ty, *major, *minor, access.to_string());
assert!(ret.is_ok());
println!(
"execute {:?} {} {} {} -> {:?}",
ty, major, minor, access, ret
);
println!("execute {ty:?} {major} {minor} {access} -> {ret:?}");
if *ty == LinuxDeviceType::C // only this is allowed
&& *major == 10
&& *minor == 20
@ -358,10 +355,7 @@ mod tests {
let ret = prog.execute(*ty, *major, *minor, access.to_string());
assert!(ret.is_ok());
println!(
"execute {:?} {} {} {} -> {:?}",
ty, major, minor, access, ret
);
println!("execute {ty:?} {major} {minor} {access} -> {ret:?}");
assert_eq!(ret.unwrap(), 1);
}
}
@ -396,10 +390,7 @@ mod tests {
let ret = prog.execute(*ty, *major, *minor, access.to_string());
assert!(ret.is_ok());
println!(
"execute {:?} {} {} {} -> {:?}",
ty, major, minor, access, ret
);
println!("execute {ty:?} {major} {minor} {access} -> {ret:?}");
if *ty == LinuxDeviceType::C && *minor == 20 && access.eq(&"r") {
assert_eq!(ret.unwrap(), 1);
} else {
@ -447,10 +438,7 @@ mod tests {
let ret = prog.execute(*ty, *major, *minor, access.to_string());
assert!(ret.is_ok());
println!(
"execute {:?} {} {} {} -> {:?}",
ty, major, minor, access, ret
);
println!("execute {ty:?} {major} {minor} {access} -> {ret:?}");
if *ty == LinuxDeviceType::C && *major == 10 && access.eq(&"r") {
assert_eq!(ret.unwrap(), 0);
} else if *ty == LinuxDeviceType::C

View File

@ -1,7 +1,7 @@
use anyhow::{bail, Context, Result};
use std::{
fs::OpenOptions,
io::{BufRead, BufReader, Read, Seek, SeekFrom, Write},
io::{BufRead, BufReader, Read, Seek, Write},
path::Path,
str, thread,
time::Duration,
@ -111,7 +111,7 @@ impl Freezer {
}
iter += 1;
thread::sleep(wait_time);
f.seek(SeekFrom::Start(0))?;
f.rewind()?;
}
}

View File

@ -66,18 +66,18 @@ impl HugeTlb {
}
fn stats_for_page_size(cgroup_path: &Path, page_size: &str) -> Result<HugeTlbStats> {
let events_file = format!("hugetlb.{}.events", page_size);
let events_file = format!("hugetlb.{page_size}.events");
let events = common::read_cgroup_file(cgroup_path.join(&events_file))?;
let fail_count: u64 = events
.lines()
.find(|l| l.starts_with("max"))
.map(|l| l[3..].trim().parse())
.transpose()
.with_context(|| format!("failed to parse max value for {}", events_file))?
.with_context(|| format!("failed to parse max value for {events_file}"))?
.unwrap_or_default();
Ok(HugeTlbStats {
usage: parse_single_value(&cgroup_path.join(format!("hugetlb.{}.current", page_size)))?,
usage: parse_single_value(&cgroup_path.join(format!("hugetlb.{page_size}.current")))?,
fail_count,
..Default::default()
})

View File

@ -326,9 +326,9 @@ mod tests {
None => reservation_content == "0",
};
println!("limit_check: {}", limit_check);
println!("swap_check: {}", swap_check);
println!("reservation_check: {}", reservation_check);
println!("limit_check: {limit_check}");
println!("swap_check: {swap_check}");
println!("reservation_check: {reservation_check}");
limit_check && swap_check && reservation_check
}
}

View File

@ -39,11 +39,10 @@ impl Unified {
.unwrap();
let context = if !controllers.iter().any(|c| c.to_string() == subsystem) {
format!(
"failed to set {} to {}: subsystem {} is not available",
cgroup_file, value, subsystem
"failed to set {cgroup_file} to {value}: subsystem {subsystem} is not available"
)
} else {
format!("failed to set {} to {}: {}", cgroup_file, value, e)
format!("failed to set {cgroup_file} to {value}: {e}")
};
e.context(context)

View File

@ -31,11 +31,11 @@ fastrand = "^1.7.0"
futures = { version = "0.3", features = ["thread-pool"] }
libc = "0.2.139"
log = "0.4"
mio = { version = "0.8.5", features = ["os-ext", "os-poll"] }
nix = "0.25.0"
mio = { version = "0.8.6", features = ["os-ext", "os-poll"] }
nix = "0.26.2"
oci-spec = { version = "^0.5.5", features = ["runtime"] }
path-clean = "0.1.0"
procfs = "0.14.2"
procfs = "0.15.1"
prctl = "1.0.0"
libcgroups = { version = "0.0.4", path = "../libcgroups", default-features = false }
libseccomp = { version = "0.3.0" }
@ -46,8 +46,8 @@ rust-criu = "0.4.0"
wasmer = { version = "2.2.0", optional = true }
wasmer-wasi = { version = "2.3.0", optional = true }
wasmedge-sdk = { version = "0.7.1", optional = true }
wasmtime = {version = "4.0.0", optional = true }
wasmtime-wasi = {version = "4.0.0", optional = true }
wasmtime = {version = "5.0.0", optional = true }
wasmtime-wasi = {version = "5.0.0", optional = true }
[dev-dependencies]
oci-spec = { version = "^0.5.5", features = ["proptests", "runtime"] }

View File

@ -11,7 +11,7 @@ const ENABLED_PARAMETER_PATH: &str = "/sys/module/apparmor/parameters/enabled";
/// Checks if AppArmor has been enabled on the system.
pub fn is_enabled() -> Result<bool> {
let aa_enabled = fs::read_to_string(ENABLED_PARAMETER_PATH)
.with_context(|| format!("could not read {}", ENABLED_PARAMETER_PATH))?;
.with_context(|| format!("could not read {ENABLED_PARAMETER_PATH}"))?;
Ok(aa_enabled.starts_with('Y'))
}
@ -33,5 +33,5 @@ pub fn apply_profile(profile: &str) -> Result<()> {
fn activate_profile(path: &Path, profile: &str) -> Result<()> {
utils::ensure_procfs(path)?;
utils::write_file(path, format!("exec {}", profile))
utils::write_file(path, format!("exec {profile}"))
}

View File

@ -557,7 +557,7 @@ mod tests {
let tests = vec![
Testcase {
name: format!("all LinuxCapabilities fields with caps: {:?}", cps),
name: format!("all LinuxCapabilities fields with caps: {cps:?}"),
input: LinuxCapabilitiesBuilder::default()
.bounding(cps.clone().into_iter().collect::<Capabilities>())
.effective(cps.clone().into_iter().collect::<Capabilities>())
@ -575,7 +575,7 @@ mod tests {
],
},
Testcase {
name: format!("partial LinuxCapabilities fields with caps: {:?}", cps),
name: format!("partial LinuxCapabilities fields with caps: {cps:?}"),
input: LinuxCapabilitiesBuilder::default()
.bounding(cps.clone().into_iter().collect::<Capabilities>())
.effective(cps.clone().into_iter().collect::<Capabilities>())
@ -591,7 +591,7 @@ mod tests {
],
},
Testcase {
name: format!("empty LinuxCapabilities fields with caps: {:?}", cps),
name: format!("empty LinuxCapabilities fields with caps: {cps:?}"),
input: LinuxCapabilitiesBuilder::default()
.bounding(HashSet::new())
.effective(HashSet::new())

View File

@ -46,7 +46,7 @@ impl<'a> YoukiConfig {
let path = path.as_ref();
let file = fs::File::open(path.join(YOUKI_CONFIG_NAME))?;
let config = serde_json::from_reader(&file)
.with_context(|| format!("failed to load config from {:?}", path))?;
.with_context(|| format!("failed to load config from {path:?}"))?;
Ok(config)
}
}

View File

@ -133,7 +133,7 @@ impl<'a> ContainerBuilderImpl<'a> {
// if file to write the pid to is specified, write pid of the child
if let Some(pid_file) = &self.pid_file {
fs::write(pid_file, format!("{}", init_pid)).context("failed to write pid file")?;
fs::write(pid_file, format!("{init_pid}")).context("failed to write pid file")?;
}
if let Some(container) = &mut self.container {

View File

@ -96,7 +96,7 @@ impl Container {
// Remember original stdin, stdout, stderr for container restore.
let mut descriptors = Vec::new();
for n in 0..3 {
let link_path = match fs::read_link(format!("/proc/{}/fd/{}", pid, n)) {
let link_path = match fs::read_link(format!("/proc/{pid}/fd/{n}")) {
Ok(lp) => lp.into_os_string().into_string().unwrap(),
Err(..) => "/dev/null".to_string(),
};

View File

@ -68,7 +68,7 @@ impl Display for ContainerStatus {
Self::Paused => "Paused",
};
write!(f, "{}", print)
write!(f, "{print}")
}
}
@ -138,9 +138,8 @@ impl State {
pub fn load(container_root: &Path) -> Result<Self> {
let state_file_path = Self::file_path(container_root);
let state_file = File::open(&state_file_path).with_context(|| {
format!("failed to open container state file {:?}", state_file_path)
})?;
let state_file = File::open(&state_file_path)
.with_context(|| format!("failed to open container state file {state_file_path:?}"))?;
let state: Self = serde_json::from_reader(BufReader::new(state_file))?;
Ok(state)

View File

@ -184,7 +184,7 @@ impl<'a> TenantContainerBuilder<'a> {
let spec_path = container.bundle().join("config.json");
let mut spec = Spec::load(&spec_path)
.with_context(|| format!("failed to load spec from {:?}", spec_path))?;
.with_context(|| format!("failed to load spec from {spec_path:?}"))?;
spec.canonicalize_rootfs(container.bundle())
.context("failed to canonicalize rootfs")?;
@ -272,11 +272,7 @@ impl<'a> TenantContainerBuilder<'a> {
}
fn get_environment(&self) -> Result<Vec<String>> {
Ok(self
.env
.iter()
.map(|(k, v)| format!("{}={}", k, v))
.collect())
Ok(self.env.iter().map(|(k, v)| format!("{k}={v}")).collect())
}
fn get_no_new_privileges(&self) -> Option<bool> {
@ -409,7 +405,7 @@ impl<'a> TenantContainerBuilder<'a> {
fn generate_name(dir: &Path, prefix: &str) -> String {
loop {
let rand = fastrand::i32(..);
let name = format!("{}{:x}.sock", prefix, rand);
let name = format!("{prefix}{rand:x}.sock");
if !dir.join(&name).exists() {
return name;
}

View File

@ -144,7 +144,7 @@ mod test {
fn is_command_in_path(program: &str) -> bool {
if let Ok(path) = env::var("PATH") {
for p in path.split(':') {
let p_str = format!("{}/{}", p, program);
let p_str = format!("{p}/{program}");
if fs::metadata(p_str).is_ok() {
return true;
}

View File

@ -67,7 +67,7 @@ impl Namespaces {
for (ns_type, ns) in to_enter {
self.unshare_or_setns(ns)
.with_context(|| format!("failed to enter {:?} namespace: {:?}", ns_type, ns))?;
.with_context(|| format!("failed to enter {ns_type:?} namespace: {ns:?}"))?;
}
Ok(())
}
@ -79,7 +79,7 @@ impl Namespaces {
} else {
let ns_path = namespace.path().as_ref().unwrap();
let fd = fcntl::open(ns_path, fcntl::OFlag::empty(), stat::Mode::empty())
.with_context(|| format!("failed to open namespace fd: {:?}", ns_path))?;
.with_context(|| format!("failed to open namespace fd: {ns_path:?}"))?;
self.command
.set_ns(fd, get_clone_flag(namespace.typ()))
.with_context(|| "failed to set namespace")?;

View File

@ -31,7 +31,7 @@ fn sysctl(kernel_params: &HashMap<String, String>) -> Result<()> {
kernel_param
);
fs::write(path, value.as_bytes())
.with_context(|| format!("failed to set sysctl {}={}", kernel_param, value))?;
.with_context(|| format!("failed to set sysctl {kernel_param}={value}"))?;
}
Ok(())
@ -90,7 +90,7 @@ fn masked_path(path: &Path, mount_label: &Option<String>, syscall: &dyn Syscall)
log::warn!("masked path {:?} not exist", path);
} else if matches!(errno, nix::errno::Errno::ENOTDIR) {
let label = match mount_label {
Some(l) => format!("context=\"{}\"", l),
Some(l) => format!("context=\"{l}\""),
None => "".to_string(),
};
syscall.mount(
@ -213,11 +213,11 @@ pub fn container_init_process(
// change the root of filesystem of the process to the rootfs
syscall
.pivot_rootfs(rootfs_path)
.with_context(|| format!("failed to pivot root to {:?}", rootfs_path))?;
.with_context(|| format!("failed to pivot root to {rootfs_path:?}"))?;
} else {
syscall
.chroot(rootfs_path)
.with_context(|| format!("failed to chroot to {:?}", rootfs_path))?;
.with_context(|| format!("failed to chroot to {rootfs_path:?}"))?;
}
rootfs
@ -228,13 +228,13 @@ pub fn container_init_process(
if let Some(kernel_params) = linux.sysctl() {
sysctl(kernel_params)
.with_context(|| format!("failed to sysctl: {:?}", kernel_params))?;
.with_context(|| format!("failed to sysctl: {kernel_params:?}"))?;
}
}
if let Some(profile) = proc.apparmor_profile() {
apparmor::apply_profile(profile)
.with_context(|| format!("failed to apply apparmor profile {}", profile))?;
.with_context(|| format!("failed to apply apparmor profile {profile}"))?;
}
if let Some(true) = spec.root().as_ref().map(|r| r.readonly().unwrap_or(false)) {
@ -259,7 +259,7 @@ pub fn container_init_process(
// mount readonly path
for path in paths {
readonly_path(Path::new(path), syscall)
.with_context(|| format!("failed to set read only path {:?}", path))?;
.with_context(|| format!("failed to set read only path {path:?}"))?;
}
}
@ -267,7 +267,7 @@ pub fn container_init_process(
// mount masked path
for path in paths {
masked_path(Path::new(path), linux.mount_label(), syscall)
.with_context(|| format!("failed to set masked path {:?}", path))?;
.with_context(|| format!("failed to set masked path {path:?}"))?;
}
}
@ -318,7 +318,7 @@ pub fn container_init_process(
// it here, if it is 0.
if listen_fds > 0 {
envs.append(&mut vec![
format!("LISTEN_FDS={}", listen_fds),
format!("LISTEN_FDS={listen_fds}"),
"LISTEN_PID=1".to_string(),
]);
}
@ -496,12 +496,12 @@ fn set_supplementary_gids(
match rootless {
Some(r) if r.privileged => {
syscall.set_groups(&gids).with_context(|| {
format!("failed to set privileged supplementary gids: {:?}", gids)
format!("failed to set privileged supplementary gids: {gids:?}")
})?;
}
None => {
syscall.set_groups(&gids).with_context(|| {
format!("failed to set unprivileged supplementary gids: {:?}", gids)
format!("failed to set unprivileged supplementary gids: {gids:?}")
})?;
}
// this should have been detected during validation

View File

@ -47,7 +47,7 @@ pub fn container_intermediate_process(
if let Some(user_namespace) = namespaces.get(LinuxNamespaceType::User) {
namespaces
.unshare_or_setns(user_namespace)
.with_context(|| format!("failed to enter user namespace: {:?}", user_namespace))?;
.with_context(|| format!("failed to enter user namespace: {user_namespace:?}"))?;
if user_namespace.path().is_none() {
log::debug!("creating new user namespace");
// child needs to be dumpable, otherwise the non root parent is not
@ -81,7 +81,7 @@ pub fn container_intermediate_process(
if let Some(pid_namespace) = namespaces.get(LinuxNamespaceType::Pid) {
namespaces
.unshare_or_setns(pid_namespace)
.with_context(|| format!("failed to enter pid namespace: {:?}", pid_namespace))?;
.with_context(|| format!("failed to enter pid namespace: {pid_namespace:?}"))?;
}
// We have to record the pid of the child (container init process), since
@ -100,7 +100,7 @@ pub fn container_intermediate_process(
Ok(_) => Ok(0),
Err(e) => {
if let ContainerType::TenantContainer { exec_notify_fd } = args.container_type {
let buf = format!("{}", e);
let buf = format!("{e}");
write(exec_notify_fd, buf.as_bytes())?;
close(exec_notify_fd)?;
}
@ -139,7 +139,7 @@ fn apply_cgroups<C: CgroupManager + ?Sized>(
let pid = Pid::from_raw(Process::myself()?.pid());
cmanager
.add_task(pid)
.with_context(|| format!("failed to add task {} to cgroup manager", pid))?;
.with_context(|| format!("failed to add task {pid} to cgroup manager"))?;
if let Some(resources) = resources {
if init {

View File

@ -159,10 +159,7 @@ fn sync_seccomp_send_msg(listener_path: &Path, msg: &[u8], fd: i32) -> Result<()
.context("failed to create unix domain socket for seccomp listener")?;
let unix_addr = socket::UnixAddr::new(listener_path).context("failed to create unix addr")?;
socket::connect(socket, &unix_addr).with_context(|| {
format!(
"failed to connect to seccomp notify listerner path: {:?}",
listener_path
)
format!("failed to connect to seccomp notify listerner path: {listener_path:?}")
})?;
// We have to use sendmsg here because the spec requires us to send seccomp notify fds through
// SCM_RIGHTS message.
@ -184,15 +181,15 @@ fn setup_mapping(rootless: &Rootless, pid: Pid) -> Result<()> {
if !rootless.privileged {
// The main process is running as an unprivileged user and cannot write the mapping
// until "deny" has been written to setgroups. See CVE-2014-8989.
utils::write_file(format!("/proc/{}/setgroups", pid), "deny")?;
utils::write_file(format!("/proc/{pid}/setgroups"), "deny")?;
}
rootless
.write_uid_mapping(pid)
.context(format!("failed to map uid of pid {}", pid))?;
.context(format!("failed to map uid of pid {pid}"))?;
rootless
.write_gid_mapping(pid)
.context(format!("failed to map gid of pid {}", pid))?;
.context(format!("failed to map gid of pid {pid}"))?;
Ok(())
}

View File

@ -54,7 +54,7 @@ impl Device {
fn bind_dev(&self, rootfs: &Path, dev: &LinuxDevice) -> Result<()> {
let full_container_path = create_container_dev_path(rootfs, dev)
.with_context(|| format!("could not create container path for device {:?}", dev))?;
.with_context(|| format!("could not create container path for device {dev:?}"))?;
let fd = open(
&full_container_path,
@ -82,7 +82,7 @@ impl Device {
}
let full_container_path = create_container_dev_path(rootfs, dev)
.with_context(|| format!("could not create container path for device {:?}", dev))?;
.with_context(|| format!("could not create container path for device {dev:?}"))?;
self.syscall.mknod(
&full_container_path,

View File

@ -81,7 +81,7 @@ impl Mount {
&mount_option_config,
options.label,
)
.with_context(|| format!("failed to mount /dev: {:?}", mount))?;
.with_context(|| format!("failed to mount /dev: {mount:?}"))?;
} else {
self.mount_into_container(
mount,
@ -89,7 +89,7 @@ impl Mount {
&mount_option_config,
options.label,
)
.with_context(|| format!("failed to mount: {:?}", mount))?;
.with_context(|| format!("failed to mount: {mount:?}"))?;
}
}
}
@ -197,10 +197,10 @@ impl Mount {
.collect::<Vec<String>>(),
)
.build()
.with_context(|| format!("failed to build {}", subsystem_name))?;
.with_context(|| format!("failed to build {subsystem_name}"))?;
let data: Cow<str> = if named {
format!("name={}", subsystem_name).into()
format!("name={subsystem_name}").into()
} else {
subsystem_name.into()
};
@ -217,7 +217,7 @@ impl Mount {
&mount_options_config,
options.label,
)
.with_context(|| format!("failed to mount {:?}", subsystem_mount))
.with_context(|| format!("failed to mount {subsystem_mount:?}"))
}
#[cfg(feature = "v1")]
@ -232,7 +232,7 @@ impl Mount {
) -> Result<()> {
log::debug!("Mounting (emulated) {:?} cgroup subsystem", subsystem_name);
let named_hierarchy: Cow<str> = if named {
format!("name={}", subsystem_name).into()
format!("name={subsystem_name}").into()
} else {
subsystem_name.into()
};
@ -243,10 +243,7 @@ impl Mount {
host_mount
.join_safely(proc_path.as_str())
.with_context(|| {
format!(
"failed to join mount source for {} subsystem",
subsystem_name
)
format!("failed to join mount source for {subsystem_name} subsystem")
})?,
)
.destination(
@ -255,8 +252,7 @@ impl Mount {
.join_safely(subsystem_name)
.with_context(|| {
format!(
"failed to join mount destination for {} subsystem",
subsystem_name
"failed to join mount destination for {subsystem_name} subsystem"
)
})?,
)
@ -271,7 +267,7 @@ impl Mount {
log::debug!("Mounting emulated cgroup subsystem: {:?}", emulated);
self.setup_mount(&emulated, options)
.with_context(|| format!("failed to mount {} cgroup hierarchy", subsystem_name))?;
.with_context(|| format!("failed to mount {subsystem_name} cgroup hierarchy"))?;
} else {
log::warn!("Could not mount {:?} cgroup subsystem", subsystem_name);
}
@ -378,7 +374,7 @@ impl Mount {
if let Some(l) = label {
if typ != Some("proc") && typ != Some("sysfs") {
match mount_option_config.data.is_empty() {
true => d = format!("context=\"{}\"", l),
true => d = format!("context=\"{l}\""),
false => d = format!("{},context=\"{}\"", mount_option_config.data, l),
}
}
@ -394,7 +390,7 @@ impl Mount {
.with_context(|| "no source in mount spec".to_string())?;
let src = if typ == Some("bind") {
let src = canonicalize(source)
.with_context(|| format!("failed to canonicalize: {:?}", source))?;
.with_context(|| format!("failed to canonicalize: {source:?}"))?;
let dir = if src.is_file() {
Path::new(&dest).parent().unwrap()
} else {
@ -402,19 +398,19 @@ impl Mount {
};
create_dir_all(dir)
.with_context(|| format!("failed to create dir for bind mount: {:?}", dir))?;
.with_context(|| format!("failed to create dir for bind mount: {dir:?}"))?;
if src.is_file() {
OpenOptions::new()
.create(true)
.write(true)
.open(dest)
.with_context(|| format!("failed to create file for bind mount: {:?}", src))?;
.with_context(|| format!("failed to create file for bind mount: {src:?}"))?;
}
src
} else {
create_dir_all(dest).with_context(|| format!("Failed to create device: {:?}", dest))?;
create_dir_all(dest).with_context(|| format!("Failed to create device: {dest:?}"))?;
PathBuf::from(source)
};
@ -437,7 +433,7 @@ impl Mount {
mount_option_config.flags,
Some(&mount_option_config.data),
)
.with_context(|| format!("failed to mount {:?} to {:?}", src, dest))?;
.with_context(|| format!("failed to mount {src:?} to {dest:?}"))?;
}
if typ == Some("bind")
@ -458,7 +454,7 @@ impl Mount {
mount_option_config.flags | MsFlags::MS_REMOUNT,
None,
)
.with_context(|| format!("Failed to remount: {:?}", dest))?;
.with_context(|| format!("Failed to remount: {dest:?}"))?;
}
if let Some(mount_attr) = &mount_option_config.rec_attr {
@ -780,7 +776,7 @@ mod tests {
flags: MsFlags::MS_NOEXEC | MsFlags::MS_NOSUID | MsFlags::MS_NODEV,
data: Some(
if subsystem_name == "systemd" {
format!("name={}", subsystem_name)
format!("name={subsystem_name}")
} else {
subsystem_name.to_string()
}

View File

@ -75,7 +75,7 @@ impl RootFS {
for mount in mounts {
mounter
.setup_mount(mount, &global_options)
.with_context(|| format!("failed to setup mount {:#?}", mount))?;
.with_context(|| format!("failed to setup mount {mount:#?}"))?;
}
}

View File

@ -33,7 +33,7 @@ impl Symlink {
let link = cgroup_root.join(comount);
self.syscall
.symlink(Path::new(subsystem_name), &link)
.with_context(|| format!("failed to symlink {:?} to {:?}", link, subsystem_name))?;
.with_context(|| format!("failed to symlink {link:?} to {subsystem_name:?}"))?;
}
Ok(())

View File

@ -291,7 +291,7 @@ fn write_id_mapping(
.arg(pid.to_string())
.args(args)
.output()
.with_context(|| format!("failed to execute {:?}", map_binary))?;
.with_context(|| format!("failed to execute {map_binary:?}"))?;
}
}

View File

@ -56,7 +56,7 @@ impl TryFrom<i32> for Signal {
fn try_from(value: i32) -> Result<Self, Self::Error> {
NixSignal::try_from(value)
.with_context(|| format!("{} is not a valid signal", value))
.with_context(|| format!("{value} is not a valid signal"))
.map(Signal)
}
}

View File

@ -216,7 +216,7 @@ impl LinuxSyscall {
fn get_open_fds() -> Result<Vec<i32>> {
const PROCFS_FD_PATH: &str = "/proc/self/fd";
utils::ensure_procfs(Path::new(PROCFS_FD_PATH))
.with_context(|| format!("{} is not the actual procfs", PROCFS_FD_PATH))?;
.with_context(|| format!("{PROCFS_FD_PATH} is not the actual procfs"))?;
let fds: Vec<i32> = fs::read_dir(PROCFS_FD_PATH)?
.filter_map(|entry| match entry {

View File

@ -29,7 +29,7 @@ impl PathBufExt for Path {
bail!("relative path cannot be converted to the path in the container.")
} else {
self.strip_prefix("/")
.with_context(|| format!("failed to strip prefix from {:?}", self))
.with_context(|| format!("failed to strip prefix from {self:?}"))
}
}
@ -49,7 +49,7 @@ impl PathBufExt for Path {
fn canonicalize_safely(&self) -> Result<PathBuf> {
if self.exists() {
self.canonicalize()
.with_context(|| format!("failed to canonicalize path {:?}", self))
.with_context(|| format!("failed to canonicalize path {self:?}"))
} else {
if self.is_relative() {
let p = std::env::current_dir()
@ -142,25 +142,25 @@ pub fn get_cgroup_path(
Some(cpath) => cpath.clone(),
None => match rootless {
false => PathBuf::from(container_id),
true => PathBuf::from(format!(":youki:{}", container_id)),
true => PathBuf::from(format!(":youki:{container_id}")),
},
}
}
pub fn write_file<P: AsRef<Path>, C: AsRef<[u8]>>(path: P, contents: C) -> Result<()> {
let path = path.as_ref();
fs::write(path, contents).with_context(|| format!("failed to write to {:?}", path))?;
fs::write(path, contents).with_context(|| format!("failed to write to {path:?}"))?;
Ok(())
}
pub fn create_dir_all<P: AsRef<Path>>(path: P) -> Result<()> {
let path = path.as_ref();
fs::create_dir_all(path).with_context(|| format!("failed to create directory {:?}", path))
fs::create_dir_all(path).with_context(|| format!("failed to create directory {path:?}"))
}
pub fn open<P: AsRef<Path>>(path: P) -> Result<File> {
let path = path.as_ref();
File::open(path).with_context(|| format!("failed to open {:?}", path))
File::open(path).with_context(|| format!("failed to open {path:?}"))
}
/// Creates the specified directory and all parent directories with the specified mode. Ensures
@ -210,7 +210,7 @@ pub fn ensure_procfs(path: &Path) -> Result<()> {
let fstat_info = statfs::fstatfs(&procfs_fd.as_raw_fd())?;
if fstat_info.filesystem_type() != statfs::PROC_SUPER_MAGIC {
bail!(format!("{:?} is not on the procfs", path));
bail!(format!("{path:?} is not on the procfs"));
}
Ok(())
@ -448,7 +448,7 @@ mod tests {
fn test_parse_env() -> Result<()> {
let key = "key".to_string();
let value = "value".to_string();
let env_input = vec![format!("{}={}", key, value)];
let env_input = vec![format!("{key}={value}")];
let env_output = parse_env(&env_input);
assert_eq!(
env_output.len(),

View File

@ -25,7 +25,7 @@ impl Executor for DefaultExecutor {
let executable = args[0].as_str();
let p = CString::new(executable.as_bytes())
.with_context(|| format!("failed to convert path {:?} to cstring", executable))?;
.with_context(|| format!("failed to convert path {executable:?} to cstring"))?;
let a: Vec<CString> = args
.iter()
.map(|s| CString::new(s.as_bytes()).unwrap_or_default())

View File

@ -46,6 +46,6 @@ where
{
let pos = s
.find('=')
.ok_or_else(|| format!("invalid KEY=value: no `=` found in `{}`", s))?;
.ok_or_else(|| format!("invalid KEY=value: no `=` found in `{s}`"))?;
Ok((s[..pos].parse()?, s[pos + 1..].parse()?))
}

View File

@ -26,17 +26,17 @@ default-features = false
features = ["std", "suggestions", "derive", "cargo", "help", "usage", "error-context"]
[dependencies]
anyhow = "1.0.68"
anyhow = "1.0.69"
chrono = { version = "0.4", features = ["serde"] }
libcgroups = { version = "0.0.4", path = "../libcgroups", default-features = false }
libcontainer = { version = "0.0.4", path = "../libcontainer", default-features = false }
liboci-cli = { version = "0.0.4", path = "../liboci-cli" }
log = { version = "0.4", features = ["std"] }
nix = "0.25.0"
nix = "0.26.2"
oci-spec = { version = "^0.5.5", features = ["runtime"] }
once_cell = "1.17.0"
once_cell = "1.17.1"
pentacle = "1.0.0"
procfs = "0.14.2"
procfs = "0.15.1"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
tabwriter = "1"
@ -47,5 +47,5 @@ caps = "0.5.5"
serial_test = "1.0.0"
[build-dependencies]
anyhow = "1.0.68"
vergen = "7.5.0"
anyhow = "1.0.69"
vergen = "7.5.1"

View File

@ -140,7 +140,7 @@ pub fn print_cgroup_mounts() {
v1_mounts.sort();
for cgroup_mount in v1_mounts {
println!("{}", cgroup_mount);
println!("{cgroup_mount}");
}
}

View File

@ -55,7 +55,7 @@ pub fn list(_: List, root_path: PathBuf) -> Result<()> {
let mut tab_writer = TabWriter::new(io::stdout());
writeln!(&mut tab_writer, "ID\tPID\tSTATUS\tBUNDLE\tCREATED\tCREATOR")?;
write!(&mut tab_writer, "{}", content)?;
write!(&mut tab_writer, "{content}")?;
tab_writer.flush()?;
Ok(())

View File

@ -45,7 +45,7 @@ fn load_container<P: AsRef<Path>>(root_path: P, container_id: &str) -> Result<Co
}
Container::load(container_root)
.with_context(|| format!("could not load state for container {}", container_id))
.with_context(|| format!("could not load state for container {container_id}"))
}
fn container_exists<P: AsRef<Path>>(root_path: P, container_id: &str) -> Result<bool> {

View File

@ -36,7 +36,7 @@ pub fn ps(args: Ps, root_path: PathBuf) -> Result<()> {
let fields: Vec<&str> = line.split_whitespace().collect();
let pid: i32 = fields[pid_index].parse()?;
if pids.contains(&pid) {
println!("{}", line);
println!("{line}");
}
}
}

View File

@ -107,9 +107,9 @@ impl Log for YoukiLogger {
};
// if log file is set, write to it, else write to stderr
if let Some(mut log_file) = LOG_FILE.get().unwrap().as_ref() {
let _ = writeln!(log_file, "{}", log_msg);
let _ = writeln!(log_file, "{log_msg}");
} else {
let _ = writeln!(stderr(), "{}", log_msg);
let _ = writeln!(stderr(), "{log_msg}");
}
}
}

View File

@ -86,7 +86,7 @@ fn main() -> Result<()> {
if let Err(e) = crate::logger::init(opts.global.debug, opts.global.log, opts.global.log_format)
{
eprintln!("log init failed: {:?}", e);
eprintln!("log init failed: {e:?}");
}
log::debug!(
@ -115,7 +115,7 @@ fn main() -> Result<()> {
CommonCmd::Exec(exec) => match commands::exec::exec(exec, root_path) {
Ok(exit_code) => std::process::exit(exit_code),
Err(e) => {
eprintln!("exec failed : {}", e);
eprintln!("exec failed : {e}");
std::process::exit(-1);
}
},
@ -180,7 +180,7 @@ fn determine_root_path(root_path: Option<PathBuf>) -> Result<PathBuf> {
}
}
let tmp_dir = PathBuf::from(format!("/tmp/youki-{}", uid));
let tmp_dir = PathBuf::from(format!("/tmp/youki-{uid}"));
if create_dir_all_with_mode(&tmp_dir, uid, Mode::S_IRWXU).is_ok() {
return Ok(tmp_dir);
}
@ -200,12 +200,12 @@ fn get_default_not_rootless_path() -> PathBuf {
#[cfg(not(test))]
fn get_default_rootless_path(uid: libc::uid_t) -> PathBuf {
PathBuf::from(format!("/run/user/{}/youki", uid))
PathBuf::from(format!("/run/user/{uid}/youki"))
}
#[cfg(test)]
fn get_default_rootless_path(uid: libc::uid_t) -> PathBuf {
libcontainer::utils::get_temp_dir_path(format!("default_rootless_youki_path_{}", uid).as_str())
libcontainer::utils::get_temp_dir_path(format!("default_rootless_youki_path_{uid}").as_str())
}
#[cfg(test)]
@ -281,7 +281,7 @@ mod tests {
// Default rootless location
let uid = getuid().as_raw();
let default_rootless_path =
get_temp_dir_path(format!("default_rootless_youki_path_{}", uid).as_str());
get_temp_dir_path(format!("default_rootless_youki_path_{uid}").as_str());
// Create temp dir so it gets cleaned up. This is needed as we later switch permissions of this directory.
let _temp_dir =
TempDir::new(&default_rootless_path).context("failed to create temp dir")?;
@ -307,7 +307,7 @@ mod tests {
std::env::remove_var("HOME");
// Use temp dir
let expected_temp_path = PathBuf::from(format!("/tmp/youki-{}", uid));
let expected_temp_path = PathBuf::from(format!("/tmp/youki-{uid}"));
// Create temp dir so it gets cleaned up. This is needed as we later switch permissions of this directory.
let _temp_dir = TempDir::new(&expected_temp_path).context("failed to create temp dir")?;
let path = determine_root_path(None).context("failed with temp path")?;

View File

@ -6,7 +6,7 @@ This section has the general information and resources needed to work with any p
Youki is a low level container runtime, which deals with the creation and management of Linux containers. Some of other such low-level runtimes are [runc](https://github.com/opencontainers/runc) and [crun](https://github.com/containers/crun). These are usually used by a higher-level runtime such as Docker or Podman to actually create and manage containers, where the higher level runtime provides a much easier interface for users.
Before you start working on developing youki, you should go through [the User documentation](../user/introduction) as it specifies the requirements and setup for running youki. For developing youki, you will need to install the dependencies and clone the repo, as specified in the [Basic Setup](../user/basic_setup.md) and [Basic Usage](../user/basic_usage.md) sections.
Before you start working on developing youki, you should go through [the User documentation](../user/introduction.md) as it specifies the requirements and setup for running youki. For developing youki, you will need to install the dependencies and clone the repo, as specified in the [Basic Setup](../user/basic_setup.md) and [Basic Usage](../user/basic_usage.md) sections.
## Testing while developing

3
rust-toolchain.toml Normal file
View File

@ -0,0 +1,3 @@
[toolchain]
profile="default"
channel="1.67.0"

@ -1 +1 @@
Subproject commit 0105384f68e16803891d0a17d9067b1def6a2778
Subproject commit a6a073817ab0311b14dadeb6491b968c5bc35d7e

View File

@ -10,12 +10,12 @@ flate2 = "1.0"
libcgroups = { path = "../../../crates/libcgroups" }
libcontainer = { path = "../../../crates/libcontainer" }
log = { version = "0.4", features = ["std"] }
nix = "0.25.0"
nix = "0.26.2"
num_cpus = "1.15"
oci-spec = "0.6.0"
once_cell = "1.17.0"
pnet_datalink = "0.31.0"
procfs = "0.14.2"
once_cell = "1.17.1"
pnet_datalink = "0.33.0"
procfs = "0.15.1"
rand = "0.8.5"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"

View File

@ -59,7 +59,7 @@ impl Log for IntegrationLogger {
if self.enabled(record.metadata()) {
let log_msg = text_format(record);
// if log file is set, write to it, else write to stderr
let _ = writeln!(stderr(), "{}", log_msg);
let _ = writeln!(stderr(), "{log_msg}");
}
}

View File

@ -71,7 +71,7 @@ fn main() -> Result<()> {
let opts: Opts = Opts::parse();
if let Err(e) = logger::init(opts.debug) {
eprintln!("logger could not be initialized: {:?}", e);
eprintln!("logger could not be initialized: {e:?}");
}
let mut tm = TestManager::new();
@ -129,7 +129,7 @@ fn get_abs_path(rel_path: &Path) -> PathBuf {
Err(_) => match which::which(rel_path) {
Ok(path) => path,
Err(e) => {
eprintln!("Error in finding path {:?} : {}\nexiting.", rel_path, e);
eprintln!("Error in finding path {rel_path:?} : {e}\nexiting.");
std::process::exit(66);
}
},
@ -155,7 +155,7 @@ fn run(opts: Run, test_manager: &TestManager) -> Result<()> {
fn list(test_manager: &TestManager) -> Result<()> {
for test_group in test_manager.tests_groups() {
println!("{}", test_group);
println!("{test_group}");
}
Ok(())

View File

@ -77,25 +77,16 @@ fn supports_throttle_iops() -> bool {
fn parse_device_data<'a>(device_type: &'static str, line: &'a str) -> Result<(i64, i64, &'a str)> {
let (device_id, value) = line
.split_once(' ')
.with_context(|| format!("invalid {} device format : found {}", device_type, line))?;
.with_context(|| format!("invalid {device_type} device format : found {line}"))?;
let (major_str, minor_str) = device_id.split_once(':').with_context(|| {
format!(
"invalid major-minor number format for {} device : found {}",
device_type, device_id
)
format!("invalid major-minor number format for {device_type} device : found {device_id}")
})?;
let major: i64 = major_str.parse().with_context(|| {
format!(
"Error in parsing {} device major number : found {}",
device_type, major_str
)
format!("Error in parsing {device_type} device major number : found {major_str}")
})?;
let minor: i64 = minor_str.parse().with_context(|| {
format!(
"Error in parsing {} device minor number : found {}",
device_type, minor_str
)
format!("Error in parsing {device_type} device minor number : found {minor_str}")
})?;
Ok((major, minor, value))
@ -130,24 +121,18 @@ fn get_blkio_data(path: &Path) -> Result<BlockIO> {
// weight
let weight_path = path.join("blkio.weight");
let weight_string = fs::read_to_string(&weight_path)
.with_context(|| format!("error in reading block io weight from {:?}", weight_path))?;
device.weight = weight_string.parse().with_context(|| {
format!("error in parsing block io weight : found {}", weight_string)
})?;
.with_context(|| format!("error in reading block io weight from {weight_path:?}"))?;
device.weight = weight_string
.parse()
.with_context(|| format!("error in parsing block io weight : found {weight_string}"))?;
// leaf weight
let leaf_weight_path = path.join("blkio.leaf_weight");
let leaf_weight_string = fs::read_to_string(&leaf_weight_path).with_context(|| {
format!(
"error in reading block io leaf weight from {:?}",
leaf_weight_path
)
format!("error in reading block io leaf weight from {leaf_weight_path:?}")
})?;
device.leaf_weight = leaf_weight_string.parse().with_context(|| {
format!(
"error in parsing block io weight : found {}",
leaf_weight_string
)
format!("error in parsing block io weight : found {leaf_weight_string}")
})?;
}
@ -157,10 +142,7 @@ fn get_blkio_data(path: &Path) -> Result<BlockIO> {
// device weight
let device_weight_path = path.join("blkio.weight_device");
let device_weight_string = fs::read_to_string(&device_weight_path).with_context(|| {
format!(
"error in reading block io weight device from {:?}",
device_weight_path
)
format!("error in reading block io weight device from {device_weight_path:?}")
})?;
let mut weight_devices = Vec::new();
// format is <major>:<minor> <bytes_per_second>
@ -170,10 +152,7 @@ fn get_blkio_data(path: &Path) -> Result<BlockIO> {
major,
minor,
weight: Some(weight_str.parse().with_context(|| {
format!(
"error in parsing weight of weight device, found {}",
weight_str
)
format!("error in parsing weight of weight device, found {weight_str}")
})?),
leaf_weight: None,
});
@ -184,18 +163,14 @@ fn get_blkio_data(path: &Path) -> Result<BlockIO> {
let device_leaf_weight_string =
fs::read_to_string(&device_leaf_weight_path).with_context(|| {
format!(
"error in reading block io leaf weight device from {:?}",
device_leaf_weight_path
"error in reading block io leaf weight device from {device_leaf_weight_path:?}"
)
})?;
for line in device_leaf_weight_string.lines() {
let (major, minor, weight_str) = parse_device_data("weight", line)?;
let leaf_weight: u16 = weight_str.parse().with_context(|| {
format!(
"error in parsing leaf weight of weight device : found {}",
weight_str
)
format!("error in parsing leaf weight of weight device : found {weight_str}")
})?;
let mut found = false;
for dev in &mut weight_devices {
@ -226,8 +201,7 @@ fn get_blkio_data(path: &Path) -> Result<BlockIO> {
let throttle_read_bps_string =
fs::read_to_string(&throttle_read_bps_path).with_context(|| {
format!(
"error in reading block io read bps device from {:?}",
throttle_read_bps_path
"error in reading block io read bps device from {throttle_read_bps_path:?}"
)
})?;
let mut throttle_devices = Vec::new();
@ -237,10 +211,7 @@ fn get_blkio_data(path: &Path) -> Result<BlockIO> {
major,
minor,
rate: rate_str.parse().with_context(|| {
format!(
"error in parsing throttle read bps rate : found {}",
rate_str
)
format!("error in parsing throttle read bps rate : found {rate_str}")
})?,
});
}
@ -251,8 +222,7 @@ fn get_blkio_data(path: &Path) -> Result<BlockIO> {
let throttle_write_bps_string =
fs::read_to_string(&throttle_write_bps_path).with_context(|| {
format!(
"error in reading block io write bps device from {:?}",
throttle_write_bps_path
"error in reading block io write bps device from {throttle_write_bps_path:?}"
)
})?;
let mut throttle_devices = Vec::new();
@ -262,10 +232,7 @@ fn get_blkio_data(path: &Path) -> Result<BlockIO> {
major,
minor,
rate: rate_str.parse().with_context(|| {
format!(
"error in parsing throttle write bps rate : found {}",
rate_str
)
format!("error in parsing throttle write bps rate : found {rate_str}")
})?,
});
}
@ -279,8 +246,7 @@ fn get_blkio_data(path: &Path) -> Result<BlockIO> {
let throttle_read_iops_string =
fs::read_to_string(&throttle_read_iops_path).with_context(|| {
format!(
"error in reading block io read iops device from {:?}",
throttle_read_iops_path
"error in reading block io read iops device from {throttle_read_iops_path:?}"
)
})?;
let mut throttle_devices = Vec::new();
@ -290,10 +256,7 @@ fn get_blkio_data(path: &Path) -> Result<BlockIO> {
major,
minor,
rate: rate_str.parse().with_context(|| {
format!(
"error in parsing throttle read iops rate : found {}",
rate_str
)
format!("error in parsing throttle read iops rate : found {rate_str}")
})?,
});
}
@ -304,8 +267,7 @@ fn get_blkio_data(path: &Path) -> Result<BlockIO> {
let throttle_write_iops_string = fs::read_to_string(&throttle_write_iops_path)
.with_context(|| {
format!(
"error in reading block io write iops device from {:?}",
throttle_write_iops_path
"error in reading block io write iops device from {throttle_write_iops_path:?}"
)
})?;
let mut throttle_devices = Vec::new();
@ -315,10 +277,7 @@ fn get_blkio_data(path: &Path) -> Result<BlockIO> {
major,
minor,
rate: rate_str.parse().with_context(|| {
format!(
"error in parsing throttle write iops rate : found {}",
rate_str
)
format!("error in parsing throttle write iops rate : found {rate_str}")
})?,
});
}

View File

@ -266,7 +266,7 @@ fn check_cpu_weight(cgroup_name: &str, expected_weight: u64) -> Result<()> {
let actual_weight = data
.parse::<u64>()
.with_context(|| format!("failed to parse {:?}", data))?;
.with_context(|| format!("failed to parse {data:?}"))?;
assert_result_eq!(actual_weight, expected_weight, "unexpected cpu weight")
}
@ -274,7 +274,7 @@ fn check_cpu_idle(cgroup_name: &str, expected_value: i64) -> Result<()> {
let data = read_cgroup_data(cgroup_name, "cpu.idle")?;
assert_result_eq!(
data.parse::<i64>()
.with_context(|| format!("failed to parse {:?}", data))?,
.with_context(|| format!("failed to parse {data:?}"))?,
expected_value
)
}
@ -300,14 +300,14 @@ fn check_cpu_max(cgroup_name: &str, expected_quota: i64, expected_period: u64) -
} else {
let actual_quota = quota
.parse::<i64>()
.with_context(|| format!("failed to parse {:?}", quota))?;
.with_context(|| format!("failed to parse {quota:?}"))?;
assert_result_eq!(expected_quota, actual_quota, "unexpected cpu quota")?;
}
let period = parts[1].trim();
let actual_period = period
.parse::<u64>()
.with_context(|| format!("failed to parse {:?}", period))?;
.with_context(|| format!("failed to parse {period:?}"))?;
assert_result_eq!(expected_period, actual_period, "unexpected cpu period")
}
@ -319,7 +319,7 @@ fn read_cgroup_data(cgroup_name: &str, cgroup_file: &str) -> Result<String> {
log::debug!("reading value from {:?}", cgroup_path);
let content = fs::read_to_string(&cgroup_path)
.with_context(|| format!("failed to read {:?}", cgroup_path))?;
.with_context(|| format!("failed to read {cgroup_path:?}"))?;
let trimmed = content.trim();
Ok(trimmed.to_owned())
}
@ -337,12 +337,12 @@ fn prepare_cpu_max(spec: &Spec, quota: &str, period: &str) -> Result<()> {
let full_cgroup_path = PathBuf::from(common::DEFAULT_CGROUP_ROOT).join_safely(cgroups_path)?;
fs::create_dir_all(&full_cgroup_path)
.with_context(|| format!("could not create cgroup {:?}", full_cgroup_path))?;
.with_context(|| format!("could not create cgroup {full_cgroup_path:?}"))?;
attach_controller(Path::new(DEFAULT_CGROUP_ROOT), cgroups_path, "cpu")?;
let cpu_max_path = full_cgroup_path.join("cpu.max");
fs::write(&cpu_max_path, format!("{} {}", quota, period))
.with_context(|| format!("failed to write to {:?}", cpu_max_path))?;
fs::write(&cpu_max_path, format!("{quota} {period}"))
.with_context(|| format!("failed to write to {cpu_max_path:?}"))?;
Ok(())
}

View File

@ -14,7 +14,7 @@ pub fn cleanup_v1() -> Result<()> {
let runtime_test = subsystem.join("runtime-test");
if runtime_test.exists() {
fs::remove_dir(&runtime_test)
.with_context(|| format!("failed to delete {:?}", runtime_test))?;
.with_context(|| format!("failed to delete {runtime_test:?}"))?;
}
}
@ -25,7 +25,7 @@ pub fn cleanup_v2() -> Result<()> {
let runtime_test = Path::new("/sys/fs/cgroup/runtime-test");
if runtime_test.exists() {
let _: Result<Vec<_>, _> = fs::read_dir(runtime_test)
.with_context(|| format!("failed to read {:?}", runtime_test))?
.with_context(|| format!("failed to read {runtime_test:?}"))?
.filter_map(|e| e.ok())
.map(|e| e.path())
.filter(|e| e.is_dir())
@ -33,7 +33,7 @@ pub fn cleanup_v2() -> Result<()> {
.collect();
fs::remove_dir(runtime_test)
.with_context(|| format!("failed to delete {:?}", runtime_test))?;
.with_context(|| format!("failed to delete {runtime_test:?}"))?;
}
Ok(())
@ -77,10 +77,6 @@ pub fn attach_controller(cgroup_root: &Path, cgroup_path: &Path, controller: &st
fn write_controller(cgroup_path: &Path, controller: &str) -> Result<()> {
let controller_file = cgroup_path.join("cgroup.subtree_control");
fs::write(controller_file, format!("+{}", controller)).with_context(|| {
format!(
"failed to attach {} controller to {:?}",
controller, cgroup_path
)
})
fs::write(controller_file, format!("+{controller}"))
.with_context(|| format!("failed to attach {controller} controller to {cgroup_path:?}"))
}

View File

@ -85,7 +85,7 @@ fn check_pid_limit_set(cgroup_name: &str, expected: i64) -> Result<()> {
.join(cgroup_name)
.join("pids.max");
let content = fs::read_to_string(&cgroup_path)
.with_context(|| format!("failed to read {:?}", cgroup_path))?;
.with_context(|| format!("failed to read {cgroup_path:?}"))?;
let trimmed = content.trim();
if trimmed.is_empty() {
@ -106,7 +106,7 @@ fn check_pid_limit_set(cgroup_name: &str, expected: i64) -> Result<()> {
let actual: i64 = trimmed
.parse()
.with_context(|| format!("could not parse {:?}", trimmed))?;
.with_context(|| format!("could not parse {trimmed:?}"))?;
if expected != actual {
bail!(
"expected {:?} to contain a pid limit of {}, but the limit was {}",
@ -125,7 +125,7 @@ fn check_pids_are_unlimited(cgroup_name: &str) -> Result<()> {
.join(cgroup_name)
.join("pids.max");
let content = fs::read_to_string(&cgroup_path)
.with_context(|| format!("failed to read {:?}", cgroup_path))?;
.with_context(|| format!("failed to read {cgroup_path:?}"))?;
let trimmed = content.trim();
if trimmed.is_empty() {

View File

@ -26,7 +26,7 @@ fn write_log_hook(content: &str) -> Hook {
.args(vec![
"sh".to_string(),
"-c".to_string(),
format!("echo '{}' >> {}", content, output,),
format!("echo '{content}' >> {output}",),
])
.build()
.expect("could not build hook")

View File

@ -62,7 +62,7 @@ fn setup_network_namespace(project_path: &Path, id: &str) -> Result<(), TestResu
.stdout(Stdio::piped())
.stderr(Stdio::piped())
.arg("-t")
.arg(format!("{}", pid))
.arg(format!("{pid}"))
.arg("-a")
.args(vec!["/bin/ip", "link", "set", "up", "dev", "lo"])
.spawn()

View File

@ -83,7 +83,7 @@ impl TestableGroup for ContainerCreate {
"empty_id" => ret.push(("empty_id", self.create_empty_id())),
"valid_id" => ret.push(("valid_id", self.create_valid_id())),
"duplicate_id" => ret.push(("duplicate_id", self.create_duplicate_id())),
_ => eprintln!("No test named {} in lifecycle", name),
_ => eprintln!("No test named {name} in lifecycle"),
};
}
ret

View File

@ -110,7 +110,7 @@ impl TestableGroup for ContainerLifecycle {
"kill" => ret.push(("kill", self.kill())),
"state" => ret.push(("state", self.state())),
"delete" => ret.push(("delete", self.delete())),
_ => eprintln!("No test named {} in lifecycle", name),
_ => eprintln!("No test named {name} in lifecycle"),
};
}
ret

View File

@ -10,7 +10,7 @@ pub fn state(project_path: &Path, id: &str) -> TestResult {
TestResult::Failed(anyhow!("Error :\nstdout : {}\nstderr : {}", stdout, stderr))
} else {
// confirm that the status is stopped, as this is executed after the kill command
if !(stdout.contains(&format!(r#""id": "{}""#, id))
if !(stdout.contains(&format!(r#""id": "{id}""#))
&& stdout.contains(r#""status": "stopped""#))
{
TestResult::Failed(anyhow!("Expected state stopped, got : {}", stdout))

View File

@ -97,10 +97,10 @@ fn check_recursive_readonly() -> TestResult {
let mount_options = vec!["rbind".to_string(), "rro".to_string()];
let mut mount_spec = Mount::default();
mount_spec
.set_destination(mount_dest_path.clone())
.set_destination(mount_dest_path)
.set_typ(None)
.set_source(Some(rro_dir_path.clone()))
.set_options(Some(mount_options.clone()));
.set_options(Some(mount_options));
let spec = get_spec(
vec![mount_spec],
vec!["runtimetest".to_string(), "mounts_recursive".to_string()],
@ -129,7 +129,7 @@ fn check_recursive_nosuid() -> TestResult {
.set_destination(mount_dest_path.clone())
.set_typ(None)
.set_source(Some(rnosuid_dir_path.clone()))
.set_options(Some(mount_options.clone()));
.set_options(Some(mount_options));
let spec = get_spec(
vec![mount_spec],
vec![
@ -211,10 +211,10 @@ fn check_recursive_noexec() -> TestResult {
let mount_options = vec!["rbind".to_string(), "rnoexec".to_string()];
let mut mount_spec = Mount::default();
mount_spec
.set_destination(mount_dest_path.clone())
.set_destination(mount_dest_path)
.set_typ(None)
.set_source(Some(rnoexec_dir_path.clone()))
.set_options(Some(mount_options.clone()));
.set_options(Some(mount_options));
let spec = get_spec(
vec![mount_spec],
vec!["runtimetest".to_string(), "mounts_recursive".to_string()],
@ -229,10 +229,10 @@ fn check_recursive_noexec() -> TestResult {
let in_container_executable_subdir_file_path =
rnoexec_subdir_path.join(executable_file_name);
fs::copy(&executable_file_path, &in_container_executable_file_path)?;
fs::copy(&executable_file_path, in_container_executable_file_path)?;
fs::copy(
&executable_file_path,
&in_container_executable_subdir_file_path,
in_container_executable_subdir_file_path,
)?;
Ok(())

View File

@ -82,8 +82,9 @@ pub fn recv_seccomp_listener(seccomp_listener: &Path) -> SeccompAgentResult {
if msg.bytes >= DEFAULT_BUFFER_SIZE {
bail!("received more than the DEFAULT_BUFFER_SIZE");
}
let msg_bytes = msg.bytes;
buf.truncate(msg.bytes);
buf.truncate(msg_bytes);
let container_process_state: libcontainer::container::ContainerProcessState =
serde_json::from_slice(&buf[..])

View File

@ -95,7 +95,7 @@ fn get_tlb_sizes() -> Vec<String> {
fn validate_tlb(id: &str, size: &str, limit: i64) -> TestResult {
let root = "/sys/fs/cgroup/hugetlb";
let path = format!("{}/{}/hugetlb.{}.limit_in_bytes", root, id, size);
let path = format!("{root}/{id}/hugetlb.{size}.limit_in_bytes");
let val_str = std::fs::read_to_string(path).unwrap();
let val: i64 = val_str.trim().parse().unwrap();
if val == limit {

View File

@ -34,7 +34,7 @@ pub fn get_project_path() -> PathBuf {
let current_dir_path_result = env::current_dir();
match current_dir_path_result {
Ok(path_buf) => path_buf,
Err(e) => panic!("directory is not found, {}", e),
Err(e) => panic!("directory is not found, {e}"),
}
}
@ -52,7 +52,7 @@ pub fn generate_uuid() -> Uuid {
match Uuid::parse_str(&rand_string) {
Ok(uuid) => uuid,
Err(e) => panic!("can not parse uuid, {}", e),
Err(e) => panic!("can not parse uuid, {e}"),
}
}
@ -63,7 +63,7 @@ pub fn prepare_bundle(id: &Uuid) -> Result<TempDir> {
let tar_source = std::env::current_dir()?.join(tar_file_name);
let tar_target = temp_dir.as_ref().join(tar_file_name);
std::fs::copy(&tar_source, &tar_target)
.with_context(|| format!("could not copy {:?} to {:?}", tar_source, tar_target))?;
.with_context(|| format!("could not copy {tar_source:?} to {tar_target:?}"))?;
let tar_gz = File::open(&tar_source)?;
let tar = GzDecoder::new(tar_gz);

View File

@ -15,8 +15,7 @@ pub struct TempDir {
impl TempDir {
pub fn new<P: Into<PathBuf>>(path: P) -> Result<Self> {
let p = path.into();
std::fs::create_dir_all(&p)
.with_context(|| format!("failed to create diectory {:?}", p))?;
std::fs::create_dir_all(&p).with_context(|| format!("failed to create diectory {p:?}"))?;
Ok(Self { path: Some(p) })
}

View File

@ -5,6 +5,6 @@ edition = "2021"
[dependencies]
oci-spec = { version = "0.6.0", features = ["runtime"] }
nix = "0.25.0"
nix = "0.26.2"
anyhow = "1.0"

View File

@ -12,7 +12,7 @@ fn get_spec() -> Spec {
match Spec::load(path) {
Ok(spec) => spec,
Err(e) => {
eprintln!("Error in loading spec, {:?}", e);
eprintln!("Error in loading spec, {e:?}");
std::process::exit(66);
}
}
@ -30,9 +30,6 @@ fn main() {
"readonly_paths" => tests::validate_readonly_paths(&spec),
"set_host_name" => tests::validate_hostname(&spec),
"mounts_recursive" => tests::validate_mounts_recursive(&spec),
_ => eprintln!(
"error due to unexpected execute test name: {}",
execute_test
),
_ => eprintln!("error due to unexpected execute test name: {execute_test}"),
}
}

View File

@ -30,8 +30,7 @@ pub fn validate_readonly_paths(spec: &Spec) {
/* This is expected */
} else {
eprintln!(
"in readonly paths, error in testing read access for path {} : {:?}",
path, e
"in readonly paths, error in testing read access for path {path} : {e:?}"
);
return;
}
@ -48,16 +47,12 @@ pub fn validate_readonly_paths(spec: &Spec) {
/* This is expected */
} else {
eprintln!(
"in readonly paths, error in testing write access for path {} : {:?}",
path, e
"in readonly paths, error in testing write access for path {path} : {e:?}"
);
return;
}
} else {
eprintln!(
"in readonly paths, path {} expected to not be writable, found writable",
path
);
eprintln!("in readonly paths, path {path} expected to not be writable, found writable");
return;
}
}
@ -73,8 +68,7 @@ pub fn validate_hostname(spec: &Spec) {
let actual_hostname = actual_hostname.to_str().unwrap();
if actual_hostname != expected_hostname {
eprintln!(
"Unexpected hostname, expected: {:?} found: {:?}",
expected_hostname, actual_hostname
"Unexpected hostname, expected: {expected_hostname:?} found: {actual_hostname:?}"
);
}
}
@ -119,7 +113,7 @@ pub fn validate_mounts_recursive(spec: &Spec) {
Ok(())
})
{
eprintln!("error in testing rro recursive mounting : {}", e);
eprintln!("error in testing rro recursive mounting : {e}");
}
}
"rnoexec" => {
@ -134,7 +128,7 @@ pub fn validate_mounts_recursive(spec: &Spec) {
Ok(())
},
) {
eprintln!("error in testing rnoexec recursive mounting: {}", e);
eprintln!("error in testing rnoexec recursive mounting: {e}");
}
}
_ => {}

View File

@ -40,10 +40,7 @@ pub fn test_read_access(path: &str) -> Result<(), std::io::Error> {
Err(std::io::Error::new(
std::io::ErrorKind::Other,
format!(
"cannot test read access for {:?}, has mode {:x}",
path, mode
),
format!("cannot test read access for {path:?}, has mode {mode:x}"),
))
}
@ -72,10 +69,7 @@ pub fn test_write_access(path: &str) -> Result<(), std::io::Error> {
Err(std::io::Error::new(
std::io::ErrorKind::Other,
format!(
"cannot test write access for {:?}, has mode {:x}",
path, mode
),
format!("cannot test write access for {path:?}, has mode {mode:x}"),
))
}
@ -88,6 +82,6 @@ pub fn test_file_executable(path: &str) -> Result<(), std::io::Error> {
Err(std::io::Error::new(
std::io::ErrorKind::Other,
format!("{:?} is directory, so cannot execute", path),
format!("{path:?} is directory, so cannot execute"),
))
}

View File

@ -6,5 +6,5 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
anyhow = "1.0.68"
anyhow = "1.0.69"
crossbeam = "0.8.2"

View File

@ -39,7 +39,7 @@ impl TestManager {
/// Prints the given test results, usually used to print
/// results of a test group
fn print_test_result(&self, name: &str, res: &[(&'static str, TestResult)]) {
println!("# Start group {}", name);
println!("# Start group {name}");
let len = res.len();
for (idx, (name, res)) in res.iter().enumerate() {
print!("{} / {} : {} : ", idx + 1, len, name);
@ -51,11 +51,11 @@ impl TestManager {
println!("skipped");
}
TestResult::Failed(e) => {
println!("not ok\n\t{}", e);
println!("not ok\n\t{e}");
}
}
}
println!("# End group {}\n", name);
println!("# End group {name}\n");
}
/// Run all tests from all tests group
pub fn run_all(&self) {
@ -72,7 +72,7 @@ impl TestManager {
.unwrap();
for cleaner in &self.cleanup {
if let Err(e) = cleaner() {
print!("Failed to cleanup: {}", e);
print!("Failed to cleanup: {e}");
}
}
}
@ -89,7 +89,7 @@ impl TestManager {
};
collector.push((test_group_name, r));
} else {
eprintln!("Error : Test Group {} not found, skipping", test_group_name);
eprintln!("Error : Test Group {test_group_name} not found, skipping");
}
}
for (name, handle) in collector {
@ -100,7 +100,7 @@ impl TestManager {
for cleaner in &self.cleanup {
if let Err(e) = cleaner() {
print!("Failed to cleanup: {}", e);
print!("Failed to cleanup: {e}");
}
}
}

View File

@ -1,11 +1,11 @@
fn main() {
println!("Printing args");
for arg in std::env::args().skip(1) {
println!("{}", arg);
println!("{arg}");
}
println!("Printing envs");
for envs in std::env::vars() {
println!("{:?}", envs);
println!("{envs:?}");
}
}