Skip to content

Commit

Permalink
fix(bundler): In .deb packages, set uid=0 for all files (#7980)
Browse files Browse the repository at this point in the history
  • Loading branch information
olivierlemasle authored Oct 16, 2023
1 parent d0ae675 commit 113bcd7
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changes/bundler-deb-fix-owner.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'tauri-bundler': 'patch:bug'
---

In Debian packages, set `root` the owner of control files and package files.
14 changes: 12 additions & 2 deletions tooling/bundler/src/bundle/linux/debian.rs
Original file line number Diff line number Diff line change
Expand Up @@ -367,10 +367,20 @@ fn create_tar_from_dir<P: AsRef<Path>, W: Write>(src_dir: P, dest_file: W) -> cr
}
let dest_path = src_path.strip_prefix(src_dir)?;
if entry.file_type().is_dir() {
tar_builder.append_dir(dest_path, src_path)?;
let stat = fs::metadata(src_path)?;
let mut header = tar::Header::new_gnu();
header.set_metadata(&stat);
header.set_uid(0);
header.set_gid(0);
tar_builder.append_data(&mut header, dest_path, &mut io::empty())?;
} else {
let mut src_file = fs::File::open(src_path)?;
tar_builder.append_file(dest_path, &mut src_file)?;
let stat = src_file.metadata()?;
let mut header = tar::Header::new_gnu();
header.set_metadata(&stat);
header.set_uid(0);
header.set_gid(0);
tar_builder.append_data(&mut header, dest_path, &mut src_file)?;
}
}
let dest_file = tar_builder.into_inner()?;
Expand Down

0 comments on commit 113bcd7

Please sign in to comment.