Skip to content

Commit

Permalink
Merge pull request #360 from rbran/fix-push-dir-all
Browse files Browse the repository at this point in the history
Fix issue 359, missing uid/gid
  • Loading branch information
wcampbell0x2a authored Nov 22, 2023
2 parents 42bcf6f + 47c5918 commit 7da9724
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
11 changes: 11 additions & 0 deletions backhand-test/tests/issues.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,14 @@ fn issue_275() {
let mut fs = backhand::FilesystemWriter::default();
fs.write(&mut writer).unwrap();
}

/// https://github.com/wcampbell0x2a/backhand/issues/359
#[test]
#[cfg(feature = "xz")]
fn issue_359() {
let mut writer = std::io::Cursor::new(vec![]);
let mut fs = backhand::FilesystemWriter::default();
let header = backhand::NodeHeader { permissions: 0, uid: 1, gid: 2, mtime: 3 };
fs.push_dir_all("a/b/c/d/e/f/g", header).unwrap();
fs.write(&mut writer).unwrap();
}
11 changes: 1 addition & 10 deletions backhand/src/filesystem/writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -350,16 +350,7 @@ impl<'a, 'b> FilesystemWriter<'a, 'b> {
}
}
//if the dir don't exists, create it
Err(index) => {
self.root.nodes.insert(
index,
Node::new(
file.to_path_buf(),
header,
InnerNode::Dir(SquashfsDir::default()),
),
);
}
Err(_index) => self.push_dir(file, header)?,
}
}
Ok(())
Expand Down

0 comments on commit 7da9724

Please sign in to comment.