Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to 1.65 and fix lint errors #1321

Merged
merged 1 commit into from
Nov 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/integration_tests_validation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
timeout-minutes: 15
strategy:
matrix:
rust: [1.63.0, 1.64.0]
rust: [1.64.0, 1.65.0]
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
timeout-minutes: 15
strategy:
matrix:
rust: [1.63.0, 1.64.0]
rust: [1.64.0, 1.65.0]
dirs: ${{ fromJSON(needs.changes.outputs.dirs) }}
steps:
- uses: actions/checkout@v3
Expand All @@ -55,7 +55,7 @@ jobs:
timeout-minutes: 15
strategy:
matrix:
rust: [1.63.0, 1.64.0]
rust: [1.64.0, 1.65.0]
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
Expand All @@ -77,7 +77,7 @@ jobs:
- name: Toolchain setup
uses: actions-rs/toolchain@v1
with:
toolchain: 1.62.1
toolchain: 1.65.0
override: true
profile: minimal
components: llvm-tools-preview
Expand Down Expand Up @@ -105,7 +105,7 @@ jobs:
timeout-minutes: 15
strategy:
matrix:
rust: [1.63.0, 1.64.0]
rust: [1.64.0, 1.65.0]
steps:
- uses: actions/checkout@v3
with:
Expand Down
2 changes: 1 addition & 1 deletion crates/libcgroups/src/v1/freezer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ impl Controller for Freezer {

fn apply(controller_opt: &ControllerOpt, cgroup_root: &Path) -> Result<()> {
log::debug!("Apply Freezer cgroup config");
create_dir_all(&cgroup_root)?;
create_dir_all(cgroup_root)?;

if let Some(freezer_state) = Self::needs_to_handle(controller_opt) {
Self::apply(freezer_state, cgroup_root).context("failed to appyl freezer")?;
Expand Down
2 changes: 1 addition & 1 deletion crates/libcontainer/src/container/builder_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion crates/libcontainer/src/container/init_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ impl<'a> InitContainerBuilder<'a> {
unistd::chdir(&container_dir)?;
let notify_path = container_dir.join(NOTIFY_FILE);
// convert path of root file system of the container to absolute path
let rootfs = fs::canonicalize(&spec.root().as_ref().context("no root in spec")?.path())?;
let rootfs = fs::canonicalize(spec.root().as_ref().context("no root in spec")?.path())?;

// if socket file path is given in commandline options,
// get file descriptors of console socket
Expand Down
2 changes: 1 addition & 1 deletion crates/libcontainer/src/container/tenant_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ impl<'a> TenantContainerBuilder<'a> {
unistd::chdir(&container_dir)?;
let notify_path = Self::setup_notify_listener(&container_dir)?;
// convert path of root file system of the container to absolute path
let rootfs = fs::canonicalize(&spec.root().as_ref().context("no root in spec")?.path())?;
let rootfs = fs::canonicalize(spec.root().as_ref().context("no root in spec")?.path())?;

// if socket file path is given in commandline options,
// get file descriptors of console socket
Expand Down
2 changes: 1 addition & 1 deletion crates/libcontainer/src/hooks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ pub fn run_hooks(hooks: Option<&Vec<Hook>>, container: Option<&Container>) -> Re

if let Some(hooks) = hooks {
for hook in hooks {
let mut hook_command = process::Command::new(&hook.path());
let mut hook_command = process::Command::new(hook.path());
// Based on OCI spec, the first argument of the args vector is the
// arg0, which can be different from the path. For example, path
// may be "/usr/bin/true" and arg0 is set to "true". However, rust
Expand Down
2 changes: 1 addition & 1 deletion crates/libcontainer/src/notify_socket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ impl NotifySocket {
log::debug!("notify container start");
let cwd = env::current_dir()?;
unistd::chdir(self.path.parent().unwrap())?;
let mut stream = UnixStream::connect(&self.path.file_name().unwrap())?;
let mut stream = UnixStream::connect(self.path.file_name().unwrap())?;
stream.write_all(b"start container")?;
log::debug!("notify finished");
unistd::chdir(&cwd)?;
Expand Down
2 changes: 1 addition & 1 deletion crates/libcontainer/src/rootfs/device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ fn create_container_dev_path(rootfs: &Path, dev: &LinuxDevice) -> Result<PathBuf
.with_context(|| format!("could not join {:?} with {:?}", rootfs, dev.path()))?;

crate::utils::create_dir_all(
&full_container_path
full_container_path
.parent()
.unwrap_or_else(|| Path::new("")),
)?;
Expand Down
11 changes: 5 additions & 6 deletions crates/libcontainer/src/rootfs/mount.rs
Original file line number Diff line number Diff line change
Expand Up @@ -373,21 +373,20 @@ impl Mount {
Path::new(&dest)
};

create_dir_all(&dir)
create_dir_all(dir)
.with_context(|| format!("failed to create dir for bind mount: {:?}", dir))?;

if src.is_file() {
OpenOptions::new()
.create(true)
.write(true)
.open(&dest)
.open(dest)
.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)
};
Expand Down Expand Up @@ -560,7 +559,7 @@ mod tests {
let mounter = Mount::new();

let spec_cgroup_mount = SpecMountBuilder::default()
.destination(&container_cgroup)
.destination(container_cgroup)
.source("cgroup")
.typ("cgroup")
.build()
Expand Down Expand Up @@ -611,7 +610,7 @@ mod tests {
let mounter = Mount::new();

let spec_cgroup_mount = SpecMountBuilder::default()
.destination(&container_cgroup)
.destination(container_cgroup)
.source("cgroup")
.typ("cgroup")
.build()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ pub fn cleanup_v2() -> Result<()> {
.map(fs::remove_dir)
.collect();

fs::remove_dir(&runtime_test)
fs::remove_dir(runtime_test)
.with_context(|| format!("failed to delete {:?}", runtime_test))?;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ fn check_readonly_paths() -> TestResult {
}
}

let test_file = bundle_path.join(&ro_file);
let test_file = bundle_path.join(ro_file);
match fs::File::create(&test_file) {
io::Result::Ok(_) => { /*This is expected*/ }
io::Result::Err(e) => {
Expand Down Expand Up @@ -134,7 +134,7 @@ fn check_readonly_rel_path() -> TestResult {
fn check_readonly_symlinks() -> TestResult {
let root = PathBuf::from("/");
let ro_symlink = "readonly_symlink";
let ro_paths = vec![root.join(&ro_symlink).to_string_lossy().to_string()];
let ro_paths = vec![root.join(ro_symlink).to_string_lossy().to_string()];

let spec = get_spec(ro_paths);

Expand Down Expand Up @@ -185,14 +185,14 @@ fn check_readonly_symlinks() -> TestResult {
fn test_node(mode: u32) -> TestResult {
let root = PathBuf::from("/");
let ro_device = "readonly_device";
let ro_paths = vec![root.join(&ro_device).to_string_lossy().to_string()];
let ro_paths = vec![root.join(ro_device).to_string_lossy().to_string()];

let spec = get_spec(ro_paths);

test_inside_container(spec, &|bundle_path| {
use std::os::unix::fs::OpenOptionsExt;
use std::{fs, io};
let test_file = bundle_path.join(&ro_device);
let test_file = bundle_path.join(ro_device);

let mut opts = fs::OpenOptions::new();
opts.mode(mode);
Expand Down