From bfaefc4206c245afaad738ede4195abf95211b6b Mon Sep 17 00:00:00 2001 From: naman-crabnebula <155433377+naman-crabnebula@users.noreply.github.com> Date: Mon, 8 Jan 2024 18:26:39 +0530 Subject: [PATCH] fix: fix deb permissions (#120) * Fix Debian package launching issue * Update .changes/fix-deb-launching.md --------- Co-authored-by: Amr Bashir --- .changes/fix-deb-launching.md | 5 +++++ crates/packager/src/package/deb/mod.rs | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 .changes/fix-deb-launching.md diff --git a/.changes/fix-deb-launching.md b/.changes/fix-deb-launching.md new file mode 100644 index 00000000..35228c01 --- /dev/null +++ b/.changes/fix-deb-launching.md @@ -0,0 +1,5 @@ +--- +"cargo-packager": patch +--- + +Fix Debian packages launching issues due to incorrect permissions diff --git a/crates/packager/src/package/deb/mod.rs b/crates/packager/src/package/deb/mod.rs index 85e52644..42876aed 100644 --- a/crates/packager/src/package/deb/mod.rs +++ b/crates/packager/src/package/deb/mod.rs @@ -419,19 +419,19 @@ fn create_tar_from_dir, W: Write>(src_dir: P, dest_file: W) -> cr if entry.file_type().is_dir() { let stat = std::fs::metadata(src_path)?; let mut header = tar::Header::new_gnu(); + header.set_mode(0o755); header.set_metadata(&stat); header.set_uid(0); header.set_gid(0); - header.set_mode(0o755); tar_builder.append_data(&mut header, dest_path, &mut std::io::empty())?; } else { let mut src_file = std::fs::File::open(src_path)?; let stat = src_file.metadata()?; let mut header = tar::Header::new_gnu(); + header.set_mode(0o644); header.set_metadata(&stat); header.set_uid(0); header.set_gid(0); - header.set_mode(0o644); tar_builder.append_data(&mut header, dest_path, &mut src_file)?; } }