diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d0fb45f7..f4622cdb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,6 +29,7 @@ jobs: steps: - uses: actions/checkout@v3 - run: rustup toolchain install nightly --component rustfmt + - run: rustup show - name: Install Protoc uses: arduino/setup-protoc@v1.1.2 with: diff --git a/runc/src/sandbox.rs b/runc/src/sandbox.rs index 00eb532d..376fc9f9 100644 --- a/runc/src/sandbox.rs +++ b/runc/src/sandbox.rs @@ -165,18 +165,19 @@ impl Sandboxer for RuncSandboxer { let mut sandbox = sandbox.lock().await; let mut sandbox_parent = self.sandbox_parent.lock().await; let sandbox_pid = sandbox_parent.fork_sandbox_process(id, &sandbox.data.netns)?; - sandbox.prepare_sandbox_ns(sandbox_pid).await.map_err(|e| { - kill(Pid::from_raw(sandbox_pid), Signal::SIGKILL).unwrap_or_default(); - e - })?; + sandbox + .prepare_sandbox_ns(sandbox_pid) + .await + .inspect_err(|_| { + kill(Pid::from_raw(sandbox_pid), Signal::SIGKILL).unwrap_or_default(); + })?; sandbox .data .task_address .clone_from(&format!("ttrpc+{}", self.task_address)); - sandbox.dump().await.map_err(|e| { + sandbox.dump().await.inspect_err(|_| { kill(Pid::from_raw(sandbox_pid), Signal::SIGKILL).unwrap_or_default(); - e })?; Ok(()) } diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 6b54e954..50fc19cf 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,3 +1,3 @@ [toolchain] -channel = "1.78" +channel = "1.81" components = ["rustfmt", "clippy", "llvm-tools"] diff --git a/vmm/common/build.rs b/vmm/common/build.rs index 3e108bed..049ba5b2 100644 --- a/vmm/common/build.rs +++ b/vmm/common/build.rs @@ -14,6 +14,8 @@ See the License for the specific language governing permissions and limitations under the License. */ +use std::fs; + use ttrpc_codegen::{Codegen, Customize, ProtobufCustomize}; fn main() { @@ -45,4 +47,24 @@ fn main() { ) .run() .expect("Gen protos code failed"); + + // Protobuf-rust 3.5.1 no longer generates the `#![allow(box_pointers)]` lint. + // However, ttrpc-rust has not yet upgraded to protobuf-rust 3.5.1. + // As a temporary measure, we are modifying the files to suppress the warning. + remove_box_pointers("src/api").expect("Remove api box_pointer failed"); +} + +fn remove_box_pointers(dir: &str) -> std::io::Result<()> { + for entry in fs::read_dir(dir)? { + let entry = entry?; + let path = entry.path(); + + if path.is_file() { + let content = fs::read_to_string(&path)?; + let new_content = content.replace("#![allow(box_pointers)]", ""); + + fs::write(path, new_content)?; + } + } + Ok(()) }