From 48a4509c676248353d62dcfc4161066ebcd03d99 Mon Sep 17 00:00:00 2001 From: Christian Ebner Date: Thu, 4 Jul 2019 14:24:13 +0200 Subject: [PATCH] src/pxar/encoder.rs: fix bug with incorrect offset stored in goodbye table Commit cd7dc87903a3c45e3d1521c3e7c1ea1500617a23 introduced the special treatment for .pxarexclude files when stored in the archive. The incorrect placement of a code snipplet from this path leads to an incorrect offset and size stored in the goodbye table. This fix places the start to the correct position, restoring the previously correct behaviour. Signed-off-by: Christian Ebner --- src/pxar/encoder.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pxar/encoder.rs b/src/pxar/encoder.rs index 1b607eae..e4db5fc5 100644 --- a/src/pxar/encoder.rs +++ b/src/pxar/encoder.rs @@ -676,6 +676,8 @@ impl <'a, W: Write> Encoder<'a, W> { let mut goodbye_items = vec![]; for (filename, stat, exclude_list) in name_list { + let start_pos = self.writer_pos; + if filename.as_bytes() == b".pxarexclude" { if let Some((ref content, ref stat)) = pxar_exclude { let filefd = match nix::fcntl::openat(rawfd, filename.as_ref(), OFlag::O_NOFOLLOW, Mode::empty()) { @@ -706,8 +708,6 @@ impl <'a, W: Write> Encoder<'a, W> { if self.verbose { println!("{:?}", self.full_path()); } - let start_pos = self.writer_pos; - if is_directory(&stat) { let mut dir = match nix::dir::Dir::openat(rawfd, filename.as_ref(), OFlag::O_DIRECTORY|OFlag::O_NOFOLLOW, Mode::empty()) {