Skip to content

Commit e3afb93

Browse files
author
Saiteja Kura
committed
fix: FileLock path tracking in cargo package operation
Use the new FileLock::rename method instead, which keeps the FileLock's internal path synchronized with the actual file location. Fixes #7863
1 parent bdd6b7c commit e3afb93

File tree

1 file changed

+2
-4
lines changed
  • src/cargo/ops/cargo_package

1 file changed

+2
-4
lines changed

src/cargo/ops/cargo_package/mod.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use std::collections::BTreeMap;
22
use std::collections::BTreeSet;
33
use std::collections::HashMap;
4-
use std::fs::{self, File};
4+
use std::fs::File;
55
use std::io::SeekFrom;
66
use std::io::prelude::*;
77
use std::path::{Path, PathBuf};
@@ -177,10 +177,8 @@ fn create_package(
177177
.context("failed to prepare local package for uploading")?;
178178

179179
dst.seek(SeekFrom::Start(0))?;
180-
let src_path = dst.path();
181180
let dst_path = dst.parent().join(&filename);
182-
fs::rename(&src_path, &dst_path)
183-
.context("failed to move temporary tarball into final location")?;
181+
dst.rename(&dst_path)?;
184182

185183
let dst_metadata = dst
186184
.file()

0 commit comments

Comments
 (0)