Skip to content

Commit

Permalink
fix(zfs): Fix destroy_bookmarks method (#170)
Browse files Browse the repository at this point in the history
Issue was wrong type. Turns out boolean and boolean_value are not
the same thing.

Closes #159
  • Loading branch information
andoriyu authored Apr 17, 2022
1 parent e7f94dd commit 755e2cd
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 7 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ target*
test-results/
.direnv
.vagrant
libfuckery
build.rs
5 changes: 4 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ bitflags = "1.2.1"
once_cell = "1.3.1"

[dependencies.libnv]
version = "0.2.3"
version = "0.3.0"
default-features = false
features = ["nvpair"]

Expand All @@ -51,5 +51,8 @@ slog-term = "2"
tempdir = "0.3"
tempfile = "3"

[build-dependencies]
cmake = "0.1"

[package.metadata.release]
dev-version-ext = "pre"
1 change: 1 addition & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
vagrant
just
zlib
cmake
];
PROJECT_ROOT = builtins.toString ./.;
RUST_SRC_PATH = "${rust}/lib/rustlib/src/rust/library";
Expand Down
6 changes: 6 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,9 @@ const VERSION: &str = env!("CARGO_PKG_VERSION");

pub mod log;
pub use log::GlobalLogger;

pub mod fuckery {
extern {
pub(crate) fn fuckery_make_nvlist() -> *mut zfs_core_sys::nvlist_t;
}
}
2 changes: 1 addition & 1 deletion src/zfs/lzc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ impl ZfsEngine for ZfsLzc {
let mut bookmarks_list = NvList::default();

for bookmark in bookmarks {
bookmarks_list.insert(&bookmark.to_string_lossy(), true)?;
bookmarks_list.insert_boolean(&bookmark.to_string_lossy())?;
}

let mut errors_list_ptr = null_mut();
Expand Down
8 changes: 3 additions & 5 deletions tests/test_zfs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -284,11 +284,9 @@ fn easy_snapshot_and_bookmark() {
zfs.destroy_snapshots(&expected_snapshots, DestroyTiming::RightNow).unwrap();
assert_eq!(Ok(false), zfs.exists(expected_snapshots[0].clone()));

// TODO: Fix this method
// Still no clue what is wrong after entire day trying. GH Issue: 159
//zfs.destroy_bookmarks(&expected_bookmarks).unwrap();
//let bookmarks = zfs.list_bookmarks(root).expect("failed to list bookmarks");
//assert!(bookmarks.is_empty())
zfs.destroy_bookmarks(&expected_bookmarks).unwrap();
let bookmarks = zfs.list_bookmarks(root).expect("failed to list bookmarks");
assert!(bookmarks.is_empty())
}

#[test]
Expand Down

0 comments on commit 755e2cd

Please sign in to comment.